vim-reference

 Pay Notebook Creator: Salah Ahmed 0 Set Container: Numerical CPU with TINY Memory for 10 Minutes 0 Total 0

Abbreviations¶

Adding abbreviations gives you an autocorrect-like feature. These can be added to your .vimrc file for default settings.

• :ab {pattern} {replacement}
• replaces pattern with replacement when typing
• :unab {pattern}
• turns off abbreviations for pattern
• :ab
• lists abbreviations Example
• :ab @em mypersonalemail@gmail.com

Maps¶

vim is a modal text editor, meaning it supports an array of modes for the user. This in turn necessitates that the user has to specify the mode for each mapping, or to have it encompass all modes (except for insert mode) with the general 'map'.

• :map {keys} {command}
• maps keys to do the command
• example
• :map d dw
• (now you can use d to delete a word (dw))
• :unmap {keys}
• turns off map for keys
• :map
• lists maps

Mappings in other modes¶

There is also recursive support, meaning if you map a key to a command, then map another key to the previous key, then the mapping will recursively lead you to the original command. To disable recursive mapping for a particular mapping you would map it with the :noremap command.

• command, visual, select and operator modes
• :map and :noremap
• command mode
• :nmap and :nnoremap
• visual mode
• :vmap and :vnoremap

and so on.

useful maps¶

• nmap m o&lt;Esc&gt;

• inserts new line without going into insert mode by pressing key m in command mode
• :nmap zz :%s/\s\+\$//&lt;ENTER&gt;

• deletes all trailing white space by pressing key zz, (you can choose whatever key you prefer)