Mitch's Technical Blog

My Vim Quick Notes

October 22, 2018
notes, vim (revised December 1, 2018)
permalink

Updated regularly as my vim repertoire grows. (The best reference list is the one you create and maintain yourself.)

:1,5!sort                    example filter command
"Ay                          yanks and appends to register a
"ay                          yanks and overwrites to register a
cF{char}                     change backward through {char}
cf{char}                     change forward through {char}
ci(                          change inside paren (must start within)
$ctags-exuberant *.ext       then in vim, :tag <tagname>
cT{char}                     change backward until {char}
ct{char}                     change forward until {char}
Ctrl-q                       Windows-specific substitute for Ctrl-v
dF{char}                     delete backward through {char}
df{char}                     delete forward through {char}
dT{char}                     delete backward until {char}
dt{char}                     delete forward until {char}
:E.                          explore from path of current buffer's file
:e.                          explore starting in pwd
:hardcopy                    redirect > <file>.pdf to save PDF.
:h filter                    help with filter command
:h path                      help path also :find. searching for filenames
:h quickfix                  help quick fix also :copen to view qfix list
``                           e.g. jump to prior position before % jump
:noh[lsearch]                temporarily disable search highlighting
:{num}                       jump to line number
q:                           command history
q/                           search history
:retab                       convert tabs to spaces (based on tabstop)
:set expandtab               expand tabs to spaces (see :set tabstop)
:set hls[earch]              highlight all matches
:set list                    show end of line ($) and tabs (^I)
:set nolist                  turn off :set list
:set nonum                   hide line numbers
:set nu                      show line numbers
:set tabstop=4               follow with :retab to convert to spaces
:Sexplore                    ~ :E. but open explorer in horizontal split
u                            toggle to lower case (e.g. after visual sel)
U                            toggle to upper case
:Vexplore                    ~ :E. but open explorer in vertical split
:vimgrep // **/*.py          example search within files (:copen after)
viw                          select inside word
/\v<regex>/                  sets pattern
""y                          same as y [unnamed register]

dbext plugin

:h dbext<tab>                get help
\sdt                         describe table beneath cursor
\sel                         exec selection [assumes \ as leader]
\se                          exec statement @ cursor [assumes \ as leader]

Mapping examples

map <F5> :!clear \ python3 %<CR>

Contact: hello at escapefromsql.net