On Github thiderman / talk-vimscript
function! Shout(msg) echo msg . '!' endfunction
Last changed: 2013-01-09 19:31:31 GMT +0100
function! Timestamp()
let match = '\v\C%(<Last changed\s*:\s+) <TIMESTAMP>'
let repl = '%Y-%m-%d %H:%M:%S %z %Z'
for linenr in range(1, 20)
let line = getline(linenr)
if line =~ match
let newline = substitute(line, match, strftime(repl), '')
return setline(linenr, newline)
endif
endfor
endfunction
:call Timestamp()
au BufWritePost *.json echo "Wrote a JSON file, lol!"
au BufWritePre * call Timestamp()
au BufRead,BufNewFile *nginx/*.conf set ft=nginx
au FileType nginx set foldmethod=marker foldmarker={,}
au FileType nginx set shiftwidth=4 softtabstop=4 noexpandtab
au FileType nginx set commentstring=#%s
(by Steve Losh)