Skip to content

Commit

Permalink
增加javascript自动补全及语法检查
Browse files Browse the repository at this point in the history
  • Loading branch information
wklken committed May 24, 2014
1 parent f34ad66 commit 37accc4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ bundle/*
*.pyc
*.bak
*.bk
configs
myconfig.sh
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,22 @@ molokai主题
sudo pip install pylint
sudo pip install pep8

#使用javascript需要安装jshint和jslint,用于javascript语法检查
需要nodejs支持,各个系统安装见文档 https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager

#ubuntu
sudo apt-get install nodejs
sudo npm install -g jslint
sudo npm install jshint -g

#mac
brew install node
npm install jshint -g
npm install jslint -g




3. 安装插件

cd k-vim/
Expand Down Expand Up @@ -554,7 +570,7 @@ molokai主题

解决问题:使用tagbar当函数比较多的时候,移动耗时较长,使用快速搜索快很多

,fu 进入当前文件函数搜索
,fu 进入当前文件函数搜索
,fU 搜索光标下单词对应函数


Expand Down Expand Up @@ -711,6 +727,12 @@ molokai主题

[pangloss/vim-javascript](https://github.com/pangloss/vim-javascript) 偶尔会看看js,频率不高

[marijnh/tern_for_vim](https://github.com/marijnh/tern_for_vim) 配合ycm进行js/jquery自动补全,需要安装 tern_for_vim 并
配置文档 [ternjs](http://ternjs.net/)


cd ~/.vim/bundle/tern_for_vim && npm install

[maksimr/vim-jsbeautify](https://github.com/maksimr/vim-jsbeautify) js/html/css 格式化, 未配置

[nono/jquery.vim](https://github.com/nono/jquery.vim) jquery高亮
Expand Down
11 changes: 11 additions & 0 deletions vimrc.bundles
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ let g:syntastic_check_on_open=1
let g:syntastic_enable_highlighting = 0
"let g:syntastic_python_checker="flake8,pyflakes,pep8,pylint"
let g:syntastic_python_checkers=['pyflakes'] " 使用pyflakes,速度比pylint快
let g:syntastic_javascript_checkers = ['jsl', 'jshint']
let g:syntastic_html_checkers=['tidy', 'jshint']
highlight SyntasticErrorSign guifg=white guibg=black


Expand All @@ -57,6 +59,11 @@ let g:ycm_collect_identifiers_from_tags_files = 1
let g:ycm_global_ycm_extra_conf = "~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py"
" 直接触发自动补全
let g:ycm_key_invoke_completion = '<C-Space>'
" 黑名单,不启用
let g:ycm_filetype_blacklist = {
\ 'tagbar' : 1,
\ 'gitcommit' : 1,
\}


" 代码片段快速插入
Expand Down Expand Up @@ -277,6 +284,7 @@ Bundle 'scrooloose/nerdtree'
map <leader>n :NERDTreeToggle<CR>
let NERDTreeHighlightCursorline=1
let NERDTreeIgnore=[ '\.pyc$', '\.pyo$', '\.obj$', '\.o$', '\.so$', '\.egg$', '^\.git$', '^\.svn$', '^\.hg$' ]
"let NERDTreeDirArrows=0
"let g:netrw_home='~/bak'
"close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | end
Expand Down Expand Up @@ -401,6 +409,9 @@ let g:html_indent_inctags = "html,body,head,tbody"
let g:html_indent_script1 = "inc"
let g:html_indent_style1 = "inc"

" for javascript 自动补全,配合YCM,需要安装nodejs&npm
Bundle "marijnh/tern_for_vim"

"for jquery
Bundle 'nono/jquery.vim'

Expand Down

0 comments on commit 37accc4

Please sign in to comment.