After 8 months of using Vim here are my most used commands. I now find it easier and more enjoyable to edit text in Vim than in any other editor.

Vim 2023

qa - start recording a macro and put into the a register
# do stuff
q - stop recording and save

@a - replay a macro
@@ - replay last used macro
10@a - replay a macro 10 times

Vim commands

h,j,k,l - j (down), h (left), k (right), l (up) 

i - insert
I - insert at the beginning of line
A - append to end of line
o - insert on next line
a - append (same as insert just goes to next character)

esc - Normal mode
Caps Lock - Normal mode (see below for autohotkey mapping)

$ - end of line
0 - beginning of line
~ - first non whitespace character of line

gg - start of file
G - end of file

x - delete character under cursor

w - next word
b - previous word

yy - yank line
y$ - yank to EOL
:%y - select all
:%d - delete all
p - put text after the cursor
P - put here
I, Ctrl shift v / middle mouse wheel - paste system clipboard

rx - replace this character with an x
shift R - replace mode

ce - change word
c$ - change to end of line
ci" - change all text inside " " on line 
f" - find next " on this line 

dd - delete line (or cut line)
D - delete to end of line
de - delete word including last character
. - repeat last command (commonly use with dw)

u - undo
ctrl r - redo

J - join 2 lines
~ - change case of character

/ - search
n - next in search

:q! - quit without saving
:wq - write then quit
:x - does sames as wq

:e .  - open up file browser

M - move to middle of page

% - move to matching character (default supported pairs: '()', '{}', '[]' - use :h matchpairs in vim for more info)

fx - jump to next occurrence of x
; - repeat previous f

} - jump to next paragraph

zz - centre cursor on screen

ctrl d - move forward 1/2 screen
ctrl u - move back 1/2 screen

ea - insert (append) at the end of the word

Multiple Files
Ctrl ws - split window
:split - split
Ctrl ww - switch windows
Ctrl wq - quit window
Ctrl wv - split window vertically
:vs - vsplit (split window vertically)

:e .
:Ex .

Ctrl ^ - close out of explorer (switch buffer)
qa! - quit all (buffers)

/ - search for a file

Surround plugin

clone https://github.com/tpope/vim-surround
copy docs to \users\davidma.vim\docs
copy plugin to \users\davidma.vim\plugins

## using Surround plugin
VS<p> - surround with <p></p>
viwS' - select inner word and surround with quotes
cst - change surrounding tags
dst - delete surrounding tags
cs'" - change surrounding ' to "
V... :jk norm yss<p>  - all lines selected, surround with <p> tag and </p> on each line

Macros

q<letter><commands>q
<number>@<letter>

Config

Showing line numbers

set number
set nonumber

_vimrc

This optional config file on a windows machine is in c:\users\dave

" This is a comment in c:\users\dave\_vimrc
colo desert
syntax on

set belloff=all

" Useful for synchronising clipboard with windows system https://stackoverflow.com/a/30691754/26086
" but causes issues in VS2017 vim plugin crashing and going slow scrolling
" set clipboard=unnamed

" If working on dos files a lot this stops the ^M line endings marker being shown
set ffs=dos

Cmder

I used Cmder as my shell in Windows and really like it. Running Vim inside it was annoying as keyboard binding were confliced - specifically Ctrl W for new split windows. I mapped Ctrl W to Ctrl Shift W in Cmder as shown.

Interestinly Ctrl WV doesnt work but :vs works fine. I use Ctrl WW to switch between windows.

AutoHotKey

As escape is a long way up and left, it is closer to use the caps lock key as the escape key.
Wikia Caps Lock. And my article on this blog

  • create new file on desktop called caps.ahk
  • Capslock::Esc
  • Right click and run the script

VSCode

Sometimes the plugin stops working. Deleting the extensions directory seems to work

Vimtutor

Is an application installed. Essentially a text file that you go through in Vim teaching you about Vim :-) I get to it by typing windows key, Vim Tutor