(1)javascript格式化插件jsbeauty
下载地址: http://www.vim.org/scripts/script.php?script_id=2727
下载后放到 ~/.vim/plugin 下,然后再~/.vimrc中添加 、
nnoremap <F4> :call g:Jsbeautify()<CR>
let mapleader="," 在Js文件中就可以使用 (,ff ) 或者f4来格式化javascript代码了。。
(2)jslint进行javascipt代码语法检查参考http://www.jshint.com/install/
(3)打造Vim为强大的IDE整合(Winmanager,NERDTree和MiniBufExplorer)常用的还有(ctags实现函数跳转,taglist)
这是一种我的vim的配置可以参考:
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplMapWindowNavVim = 1
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
let Tlist_File_Fold_Auto_Close=1
let g:NERDTree_title="[NERD Tree]"
let g:winManagerWindowLayout='NERDTree|TagList'
let g:winManagerWidth = 30
function! NERDTree_Start()
exec 'NERDTree'
endfunction
function! NERDTree_IsValid()
return 1
endfunction
nmap <silent> <F8> :if IsWinManagerVisible() <BAR> WMToggle<CR> <BAR> else <BAR> WMToggle<CR>:q<CR> endif <CR><CR>
function! Make()
if &modified | silent write | endif
if &makeprg == 'make' | return | endif
silent make
execute 'cw'
endfunction
autocmd Filetype javascript setlocal makeprg=jsl\ -nologo\ -nofilelisting\ -nosummary\ -nocontext\ -conf\ /etc/jsl.conf\ -process\ % |
autocmd BufWritePost *.js call Make()
execute pathogen#infect()