JλvλScript
I like JavaScript. No really. I like it.
The only thing that bugs me is writing function all the time. And seeing function everywhere. For such a fundamental part of the language, the keyword is way too long.
Lets fix it.
" replace 'function' with λ
au BufNewFile,BufRead *.js syntax keyword javasScriptFunction function conceal cchar=λ
au BufNewFile,BufRead *.js hi! link javasScriptFunction Conceal
au BufNewFile,BufRead *.js setlocal conceallevel=2
" add abbreviations for JS
" f_
" expands to
" function() {
" <cursor>
"
" }
" f- expands to
" function() { <cursor )
autocmd Filetype javascript iabbr f_ function(){<CR>:}<ESC>?:<CR><ESC>xO
autocmd Filetype javascript iabbr f- function(){:}<ESC>?:<CR><ESC>xO
Code is also available as a gist https://gist.github.com/3305649
Written by Łukasz Korecki
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Vim
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#