Learning about jumplist
Issue was trying to get back to a previous location in a file after jumping to it. Still jump movements but they should help you move a bit more efficiently.
Clear line and drop into insert mode
Wow, this one is really cool, I usually just want to nuke a line and go right into insert mode. Instead of dding and then going back up and line and going into insert mode you can just use
Don’t auto close brackets.
If you are using a plugin such as auto pairs, sometimes you don’t want it to auto-close after you open a brace.
ctrl + v
Navigate to the 3rd word ahead:
Navigate to the beginning of text on the current line:
Navigate to the first line:
Jump back to a previous location:
ctrl + o
Jump back to next location:
Go to last line in file:
Go to matching parenthesis or brackets
Navigate to a previous search result:
Searching backwards for the word “carmen”
ctrl + r
Change to the end of the line. Not sure if it’s more efficient to use c$ over C, regardless it’s two keystrokes.
C or c$
Replacing a string good with bad on the current line:
Delete a word with a leading space. See
diw for just deleting a “inner” word.
Moving back a word
Delete everything inside 
Navigation between splits.
Navigating between splits - I was frustrated for a long time when a help screen would open and I don’t know how to close it.
ctrl-w + j
Writing to a file when you don’t have write permissions
This one was from peep code. Say you open a file and edit it only realizing that you need to be root to write to it. Instead of saving the file to something like /tmp then copying it back over the original file with higher elevated privileges, you can do all this with one single command.
:w !sudo tee %
% here expands to the current file name
Regex search and replace
% - search the current buffer
g - search for all occurrences.
c - ask for confirmation `
Capital V is line wise selection/copy.
This is letter by letter visual selection.
Paste before current line.
y to yank or
d to delete you can use
c to “change” text. This is useful because it deletes the text and puts you into insert mode immediately.
Moving code words
Move to the middle of a line
Repeating character jumps
I often confused character jumping with
. which is repetition but instead using
; after a jump to repeat it. The
, repeates the jump in the opposite direction.
Jumping to middle of screen
Add marks with
ma then jump to it using `
Moving between sentences
) to move between sentences.
comments powered by Disqus