August 9, 2023

My current Vim mnemonic sheet

When I want to adopt a new key pattern, I add it to the top of this list. I leave old ones sink at the bottom of the list.

:<Crtl-f> # display history of commands ran in command line mode
gi  # move cursor to the last edit
'm  # move cursor to mark
mm  # set mark
:marks  # list all marks
gqip    # justify paragraph, requires par, see https://yctct.com/vim-justify
zz  # redraw (replace) line where the cursor is placed in the middle of the screen (from the bottom)
vaty    # yank text in between block with tags
vat     # select text in between block with tags
vaby    # yank text in between parantheses
vab     # select text in between parantheses
<Ctrl-k>{char1}{char2} # diagraph e.g. è is <Ctrl-k>e! ; ē is <Ctrl-k>e-
g0  # move cursor to the first non-blank character of a display line
!sed -i -e '1i*[text]*' *[file]* # insert on the top line of a file while editing a file in vim
\c  # ignorecase e.g. /live\c returns live Live LIVE
dawbP   # swap the word with the previous one 
dawwP   # swap the current word with the next
<Ctrl-p> # suggest autocomplete for word from position of cursor
gul     # switch to small cap size letter
/\<keyword\> # search for matching keyword
~~:goyo x[number] or :goyo x[percentage] e.g. :goyo x35 or :goyo x90% # adjust height of display~~ I stopped using pluggins
f, t    # remember the difference between f and t, f moves on the target, t moves before the target
ZM  # close all folds
F   # move the cursor backwards on target
g^  # move the cursor to the first non-blank character of a screen line
g_  # move the cursor to the last non-blank character of a screen line
gm  # move the cursor half a screenwidth to the right
:setlocal spell spelllang=en
:%s/Search-Word/Replace-Word/gc # substitute and replace the whole page with validation
C = c$  # delete to the end of the line and Insert
D = d$  # delete to the end of the line
d0  # delete from the position of the cursor to the beginning of the line
S   # delete sentence where the cursor is located and prompt insert at the beginning of the line
Gp  # move and paste selection at the end of the file
select w/ mouse then "*y copy from vim to system clipboard
shift+insert # paste from system clipboard to vim
shift+^+insert # copy to system clipboard
gea     # append at the end of previous word #  deprecated with vim-markdown
zc  # close one fold
-   # move the cursor one line up to the first non-blank character
zo  # open one fold under the cursor
:bd     # close (delete) current buffer; ! if file was updated
:w !pandoc --lua-filter=wordcount.lua # display word count of current file in the buffer
:'<,'> w !wc -w # display word count for visual section 
dei     # delete to end of the word and Insert
:spellr[epeat] # repeat the last correction (z={number} or 1z=) on all identical words
<C-r>" or <C-r>{register} # paste from register or system clipboard in Insert mode
zR  # open all folds
ZZ  # same as :wq
J   # remove empty line below the line where the cursor is positioned; or if there is text on the following line: append the line below to the line where the cursor is positioned 
$ vi <Crtl-o-o> # open vim, open the last edited file, and move the cursor where it was last position when vim was close last
:set hls # highlight search query
:set incsearch # select matches as the search query is being type (I added this one to .vimrc)
<Crtl-x><Crtl-k> # autocomplete a word based on dictionary (need :set spell to be on)
<Crtl-n> or <Crtl-p> # autocomplete a word based on word in the buffer or next best guess? 
!echo "*[text]*" >> *[file]* # append a file while editing a file in vim
G   # move the cursor to the end of the file
gg  # move the cursor to the top of the file
]s  # move to the next misspelled word
]s  # move to the previous misspelled word
zg  # add word under the cursor to dictionary
:set nu # display line numbers
:set nonu # remove line numbers
daw     # delete a word plus trailing space
diw     # delete a word and switch to Insert mode
d/{pattern} # delete from cursor to pattern

personal computing command-line interface (cli) gnu linux trisquel shell literacy office applications wiki vim

No affiliate links, no analytics, no tracking, no cookies. This work © 2016-2024 by yctct is licensed under CC BY-ND 4.0 .   about me   contact me   all entries & tags   FAQ   GPG public key

GPG fingerprint: 2E0F FB60 7FEF 11D0 FB45 4DDC E979 E52A 7036 7A88