Wikia

Vim Tips Wiki

Changes: Mappings

Edit

Back to page

(convenient redirection)
 
(Make an overview. Should this be a tip?)
 
Line 1: Line 1:
#REDIRECT [[Mapping_keys_in_Vim_-_Tutorial_(Part_1)]]
+
Mapping a key causes Vim to perform a sequence of operations when a specified key is pressed. See:
  +
*[[Mapping keys in Vim - Tutorial (Part 1)]]
  +
*[[Mapping keys in Vim - Tutorial (Part 2)]]
  +
*[[Mapping keys in Vim - Tutorial (Part 3)]]
  +
*[[Short mappings for common tasks]] examples of useful mappings
  +
  +
==Keys to map==
  +
For information on which keys to map, see {{help|map-which-keys}} and {{help|keycodes}} and [[Mapping keys in Vim - Tutorial (Part 2)#Finding unused keys|part 2]] of the tutorial. It is also possible to map mouse events, see [[Mapping keys in Vim - Tutorial (Part 1)#Mapping mouse events|part 1]] of the tutorial.
  +
  +
In insert mode, you can determine the name of a special key by pressing Ctrl-K then pressing the special key. For example, enter <code>i</code> to enter insert mode, then press Ctrl-K followed by Ctrl-Left (hold down the Ctrl key and press the left arrow key). Vim will insert the name of the key, namely <code><C-Left></code>.
  +
  +
The keys above the cursor arrows keys are:
  +
*<code><Insert></code>
  +
*<code>&lt;Del></code>
  +
*<code><Home></code>
  +
*<code><End></code>
  +
*<code><PageUp></code>
  +
*<code><PageDown></code>
  +
  +
The keys on the numeric keypad are:
  +
*<code><kDivide></code>
  +
*<code><kMultiply></code>
  +
*<code><kHome></code>
  +
*<code><kEnd></code>
  +
*<code><kPageUp></code>
  +
*<code><kPageDown></code>
  +
*<code><kMinus></code>
  +
*<code><kPlus></code>
  +
*<code><kEnter></code>
  +
*<code><kPoint></code>
  +
*<code><k0></code> to <code><k9></code>
  +
  +
==Comments==
  +
I don't know whether to make this a "tip". Perhaps an overview with a quickref is useful? Should we think if a couple of pages like this might be created, but not given the "tip" template at the top? [[User:JohnBeckett|JohnBeckett]] ([[User talk:JohnBeckett|talk]]) 04:11, July 30, 2012 (UTC)

Latest revision as of 04:11, July 30, 2012

Mapping a key causes Vim to perform a sequence of operations when a specified key is pressed. See:

Keys to mapEdit

For information on which keys to map, see :help map-which-keys and :help keycodes and part 2 of the tutorial. It is also possible to map mouse events, see part 1 of the tutorial.

In insert mode, you can determine the name of a special key by pressing Ctrl-K then pressing the special key. For example, enter i to enter insert mode, then press Ctrl-K followed by Ctrl-Left (hold down the Ctrl key and press the left arrow key). Vim will insert the name of the key, namely <C-Left>.

The keys above the cursor arrows keys are:

  • <Insert>
  • <Del>
  • <Home>
  • <End>
  • <PageUp>
  • <PageDown>

The keys on the numeric keypad are:

  • <kDivide>
  • <kMultiply>
  • <kHome>
  • <kEnd>
  • <kPageUp>
  • <kPageDown>
  • <kMinus>
  • <kPlus>
  • <kEnter>
  • <kPoint>
  • <k0> to <k9>

CommentsEdit

I don't know whether to make this a "tip". Perhaps an overview with a quickref is useful? Should we think if a couple of pages like this might be created, but not given the "tip" template at the top? JohnBeckett (talk) 04:11, July 30, 2012 (UTC)

Around Wikia's network

Random Wiki