diff --git a/vimrc b/vimrc index 3449871..0ed8dd2 100644 --- a/vimrc +++ b/vimrc @@ -38,7 +38,7 @@ Plug 'rhysd/conflict-marker.vim' Plug 'airblade/vim-gitgutter' Plug 'inside/vim-search-pulse' -Plug 'rking/ag.vim' +Plug 'mileszs/ack.vim' Plug 'BufOnly.vim' @@ -48,8 +48,7 @@ Plug 'chriskempson/base16-vim' Plug 'pangloss/vim-javascript', { 'for': 'javascript' } Plug 'marijnh/tern_for_vim', { 'do': 'npm install', 'for': 'javascript' } -Plug 'mtscout6/syntastic-local-eslint.vim', { 'for': 'javascript' } -Plug 'mxw/vim-jsx', { 'for': 'javascript.jsx' } +Plug 'mxw/vim-jsx', { 'for': 'javascript' } Plug 'suan/vim-instant-markdown', { 'for': 'markdown' } Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' } @@ -171,6 +170,9 @@ nnoremap :noh nnoremap j gj nnoremap k gk +"" open last buffer +nnoremap + " Easier split navigation " Use ctrl-[hjkl] to select the active split! @@ -235,6 +237,11 @@ vnoremap 0 :!node nnoremap + nnoremap - +" debugging, use leader-DD to start, do a slow action, then leader-DQ to +" finish. Your output will be in profile.log +nnoremap DD :exe ":profile start profile.log":exe ":profile func *":exe ":profile file *" +nnoremap DQ :exe ":profile pause":noautocmd qall! + "" abbreviations cnoreabbrev W! w! cnoreabbrev Q! q! @@ -263,14 +270,41 @@ set undoreload=10000 " Plugin Configuration " -"" syntastic -let g:syntastic_javascript_checkers = ['eslint'] +"" ACK +if executable('ag') + let g:ackprg = 'ag --vimgrep' +endif +"" syntastic let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 0 let g:syntastic_check_on_open = 1 let g:syntastic_check_on_wq = 0 +" local linter support + +let g:syntastic_javascript_checkers = [] + +function CheckJavaScriptLinter(filepath, linter) + if exists('b:syntastic_checkers') + return + endif + if filereadable(a:filepath) + let b:syntastic_checkers = [a:linter] + let {'b:syntastic_' . a:linter . '_exec'} = a:filepath + endif +endfunction + +function SetupJavaScriptLinter() + let l:current_folder = expand('%:p:h') + let l:bin_folder = fnamemodify(syntastic#util#findFileInParent('package.json', l:current_folder), ':h') + let l:bin_folder = l:bin_folder . '/node_modules/.bin/' + call CheckJavaScriptLinter(l:bin_folder . 'standard', 'standard') + call CheckJavaScriptLinter(l:bin_folder . 'eslint', 'eslint') +endfunction + +autocmd FileType javascript call SetupJavaScriptLinter() + "" lightline if filereadable(expand("~/.vim/lightline.vim")) source ~/.vim/lightline.vim @@ -312,7 +346,7 @@ let g:tex_flavor = "latex" let g:livepreview_previewer = 'zathura' " JSX -" let g:jsx_ext_required = 0 " Allow JSX in normal JS files +let g:jsx_ext_required = 0 " Allow JSX in normal JS files " " Autocmd Rules