Vim Script
- Vim contains its own declarative scripting language, that can be used to extend it in style.
- One can put such code in the .vimrc, or in
:source
'ed files or (with a lesser convenience) write it in command-line mode. - Here is an example for a function and some bindings that use it that play an MP3 using XMMS:
function Xmms_Play_Mp3(xmms_opts)
let line = getline(".")
let repl = substitute(line, "'", "'\\\\''", "ge")
let repl = substitute(repl, "!", "\\\\!", "g")
execute "silent !xmms " . a:xmms_opts . " '" . repl . "'"
endfunction
map <F3> :call Xmms_Play_Mp3("-e")<CR>
map <S-F3> :call Xmms_Play_Mp3("")<CR>