Dilip's Log

Vim Proficiency

Published on

Although I don’t use vim, it has good points for being easy keyboard glue. Why not learn both of the best worlds of Editors?

Apart from normal vim navigations and operators, These are some of the unique vim magics, which I haven’t used at all.

Marks

This is the important one, I have not used this at all. Should try and make use of it. Although emacs mark-ring is alot better.

ShortcutDescription
`^Last position of cursor in insert mode
`.Last change in current buffer
`"Last exited current buffer
`0In last file edited
''Back to line in current buffer where jumped from
``Back to position in current buffer where jumped from
`[To beginning of previously changed or yanked text
`]To end of previously changed or yanked text
`<To beginning of last visual selection
`>To end of last visual selection
maMark this cursor position as a
`aJump to the cursor position a
'aJump to the beginning of the line with position a
d'aDelete from current line to line of mark a
d`aDelete from current position to position of mark a
c'aChange text from current line to line of a
y`aYank text from current position to position of a
:marksList all current marks
:delm aDelete mark a
:delm a-dDelete marks a, b, c, d
:delm abcDelete marks a, b, c

ShortcutDescription
%Nearest/matching {[()]}
[( [{ [<Previous ( or { or <
])Next
[mPrevious method start
[MPrevious method end

Jumping

ShortcutDescription
<C-O>Go back to previous location
<C-I>Go forward
gfGo to file in cursor

Counters

ShortcutDescription
<C-A>Increment number
<C-X>Decrement

Tags

ShortcutDescription
:tag ClassnameJump to first definition of Classname
<C-]>Jump to definition
g]See all definitions
<C-T>Go back to last tag
<C-O> <C-I>Back/forward
:tselect ClassnameFind definitions of Classname
:tjump ClassnameFind definitions of Classname (auto-select 1st)

Folds

ShortcutDescription
zo / zOOpen
zc / zCClose
za / zAToggle
zvOpen folds for this line
zMClose all
zROpen all
zmFold more (foldlevel += 1)
zrFold less (foldlevel -= 1)
zxUpdate folds

Command line

ShortcutDescription
<C-R><C-W>Insert current word into the command line
<C-R>"Paste from ” register
<C-X><C-F>Auto-completion of path in insert mode

Spell checking

ShortcutDescription
:set spell spelllang=en_usTurn on US English spell checking
]sMove to next misspelled word after the cursor
[sMove to previous misspelled word before the cursor
z=Suggest spellings for the word under/after the cursor
zgAdd word to spell list
zwMark word as bad/mispelling
zu / C-X (Insert Mode)Suggest words for bad word under cursor from spellfile

See :help spell


Source of this cheatsheet : https://devhints.io/vim

With that noted, I hope you turn out to be a proficient Vimmer or an efficient Emacser

For emacs, I have my previous post for it.