Vim insert tips

To delete a word in insert mode, ctrl+w

Delete a character in insert mode, ctrl+h

Jump to the next line and remain in insert mode, ctrl+j

Paste in insert mode ctrl+a


Search and Replace in vim

To search and replace text in vim, change to command mode and you can do this;


The above code will look for all the ‘search'¬†text in the current buffer and change them to ‘replace' text. The ‘gc' tells vim to look though the entire buffer and confirm the change before it replaces the text, if you leave out the ‘c’ it will change without needing a user’s confirmation.

Vertical split two files in gvim

These sites were useful.

:e filename – Edit a file in a new buffer
:bnext (or :bn) – go to next buffer
:bprev (of :bp) – go to previous buffer
:bd – delete a buffer (close a file)
:sp filename – Open a file in a new buffer and split window
ctrl+ws – Split windows
ctrl+ww – switch between windows
ctrl+wq – Quit a window
ctrl+wv – Split windows vertically