~2 min read|
A place to store vim commands that aren’t muscle memory yet.
Doing a little consolidation as I’ve previously had to learn to undo and redo in vim.
u is Undo
. will repeat the last command (e.g. if you just pasted in a word and then use
., it will paste it again)
ctrl-r is Redo - the inverse of the
ctrl-v- enter visual block mode
4j- highlight the same position in the next four rows
Escto insert before the cursor or
Escto insert after the cursor. In this case, I’m not replacing text, but inserting. In theory, you could also use
c2wto replace the first two words.
Note An important thing to know for first time users of the visual block editing is that when in Insert mode to make the change, vim will only render the changes on the first line. The changes will be applied to all lines in the visual block once Insert mode has been escaped (
visual-block mode and
:to enter a command - you should see
:'<,'>. It is automatically added by Vim and means “act on the selected area”
norm[al]enables executing normal mode commands on a range of lines
Enter the command, e.g.,
norm ^w2 i"<C-v
^puts the cursor on the first char of the line.
wmoves to the next word.
"before the cursor.
<Escis Vim’s way to input a control character in this context, here it’s
<Esc>used to exit insert mode.
eemoves to the end of the next word.
a"appends a ” after the cursor.
<CR> executes the command.
Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!