Vim - Notes

interactive history of commands


global command


The global command is actually the origin of grep’s name - :g/re/p would print out all lines matching the regular expression “re”.

delete all lines containing a pattern:


call vs. exec (execute)


local functions and their usage in autocommands and mappings

  2. help :local-function

say, we have a local function (a function local to a script, starts with s:):

function! s:GoToPrevTab()

inside autocommands it can be called as is:

augroup tabs
  autocmd TabEnter * call s:GoToPrevTab()
augroup END

but inside mappings you must prefix its name with <SID> (instead of s:):

nnoremap <C-Tab> :call <SID>GoToPrevTab()<CR>

filetype-specific settings

filetype-specific settings can be set in 2 ways: