Vim - Notes


interactive history of commands

q:

global command

:g

http://disq.us/p/dkhy28:

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:

:g/foo/d

call vs. exec (execute)

  1. http://stackoverflow.com/questions/18178768/vimscript-call-vs-execute

local functions and their usage in autocommands and mappings

  1. http://vim.1045645.n5.nabble.com/lt-SID-gt-or-s-General-questions-about-functions-td4297515.html#a4298658
  2. help :local-function

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

function! s:GoToPrevTab()
  ...
endfunction

inside autocommands it can be called as is:

augroup tabs
  autocmd!
  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: