This repository is a list of the most commonly used VIM motions and commands that I use in my day to day coding. There are other resources that cover this a lot better. This one serves more as a memory jogger for when my hands fail to remember the pattern.
ct'
- Cut to the'
then enter insert modeyt'
- Yank to the'
and remain in normal mode:%y
- yank all contents of file to the registerdat
- Delete around tags. Deletes contents of an html tag including the tag that the cursor is ondit
- Delete the contents of a tags that that the cursor is on%y+
- Yank to he clipboard instead of the vim registerdw
- Delete worddvb
- Delete word going backwards
:h rtp
- view neovim's folder location:Ex
- file explorer
:%s/;.*/helloworld
- Substitute the;
and everything after it.*
withhelloworld
.:%s/replacethis\(.*\)/replacethis\1\r"Month":\1/g
- Example for substitution using capture groups
cd directory
- Changes directory to specified:Ex
- enter explore mode%
- to enter a new filed
- to make a new directory
- Position cursor to the first line you wish to comment,
SHIFT - V
to enter visual block modej
ofk
to select the linesSHIFT - i
to enter insert mode- type your comment, eg.
//
ESC
to complete the comment
- :mksession! ~/today.ses - Saves a new session
- vim -S ~/today.ses - Loads the saved session
Pull requests are welcome!