From 07dff40957e72200355dd01d559f4f74f625561a Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Wed, 17 Aug 2016 22:58:10 +0200 Subject: [PATCH 1/7] plyglot has already mustach support --- vimrc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/vimrc b/vimrc index 3bc463f..f090745 100644 --- a/vimrc +++ b/vimrc @@ -49,7 +49,6 @@ Plug 'Raimondi/delimitMate' Plug 'pangloss/vim-javascript' Plug 'marijnh/tern_for_vim', { 'do': 'npm install', 'for': 'javascript'} -Plug 'mustache/vim-mustache-handlebars' Plug 'mtscout6/syntastic-local-eslint.vim' "Plug 'mxw/vim-jsx' @@ -271,7 +270,7 @@ set undoreload=10000 let g:syntastic_javascript_checkers = ['eslint'] let g:syntastic_always_populate_loc_list = 1 -let g:syntastic_auto_loc_list = 0 +let g:syntastic_auto_loc_list = 0 let g:syntastic_check_on_open = 1 let g:syntastic_check_on_wq = 0 @@ -440,7 +439,7 @@ let g:UltiSnipsJumpForwardTrigger="" let g:tex_flavor = "latex" let g:livepreview_previewer = 'zathura' -" JSX +" JSX " let g:jsx_ext_required = 0 " Allow JSX in normal JS files " @@ -470,4 +469,4 @@ au FileType javascript map r :TernRename au BufRead,BufNewFile *.json set ft=json "" Mustache -au BufRead,BufNewFile *.template set filetype=html syntax=mustache +au BufRead,BufNewFile *.template set filetype=html.mustache syntax=mustache From e42b44da7f872d2151efcaa253647ec217c27750 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Wed, 17 Aug 2016 23:15:11 +0200 Subject: [PATCH 2/7] load plugins only for specific filetypes --- vimrc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vimrc b/vimrc index f090745..d76458a 100644 --- a/vimrc +++ b/vimrc @@ -47,13 +47,13 @@ Plug 'chriskempson/base16-vim' Plug 'Raimondi/delimitMate' -Plug 'pangloss/vim-javascript' -Plug 'marijnh/tern_for_vim', { 'do': 'npm install', 'for': 'javascript'} -Plug 'mtscout6/syntastic-local-eslint.vim' -"Plug 'mxw/vim-jsx' +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 'suan/vim-instant-markdown' -Plug 'xuhdev/vim-latex-live-preview' +Plug 'suan/vim-instant-markdown', { 'for': 'markdown' } +Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' } call plug#end() From 3cbc957d232258ad2ccc5424398fe549a3780019 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Wed, 17 Aug 2016 23:15:43 +0200 Subject: [PATCH 3/7] move delimitMate to general stuff --- vimrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vimrc b/vimrc index d76458a..0d55790 100644 --- a/vimrc +++ b/vimrc @@ -11,6 +11,7 @@ Plug 'L9' Plug 'unimpaired.vim' Plug 'surround.vim' Plug 'Align' +Plug 'Raimondi/delimitMate' Plug 'editorconfig/editorconfig-vim' @@ -45,8 +46,6 @@ Plug 'itchyny/lightline.vim' Plug 'chriskempson/base16-vim' -Plug 'Raimondi/delimitMate' - Plug 'pangloss/vim-javascript', { 'for': 'javascript' } Plug 'marijnh/tern_for_vim', { 'do': 'npm install', 'for': 'javascript' } Plug 'mtscout6/syntastic-local-eslint.vim', { 'for': 'javascript' } From 3c2af2163b4b1bc6da30c8d463f18b7d9c906592 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Wed, 17 Aug 2016 23:16:09 +0200 Subject: [PATCH 4/7] extract huge lightline config --- vim/lightline.vim | 129 ++++++++++++++++++++++++++++++++++++++++++++ vimrc | 132 ++-------------------------------------------- 2 files changed, 133 insertions(+), 128 deletions(-) create mode 100644 vim/lightline.vim diff --git a/vim/lightline.vim b/vim/lightline.vim new file mode 100644 index 0000000..0c8101e --- /dev/null +++ b/vim/lightline.vim @@ -0,0 +1,129 @@ +"" lightline +let g:lightline = { + \ 'colorscheme': 'solarized', + \ 'active': { + \ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ], ['ctrlpmark'] ], + \ 'right': [ [ 'syntastic', 'lineinfo' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype' ] ] + \ }, + \ 'component_function': { + \ 'fugitive': 'LightLineFugitive', + \ 'filename': 'LightLineFilename', + \ 'fileformat': 'LightLineFileformat', + \ 'filetype': 'LightLineFiletype', + \ 'fileencoding': 'LightLineFileencoding', + \ 'mode': 'LightLineMode', + \ 'ctrlpmark': 'CtrlPMark', + \ }, + \ 'component_expand': { + \ 'syntastic': 'SyntasticStatuslineFlag', + \ }, + \ 'component_type': { + \ 'syntastic': 'error', + \ }, + \ 'subseparator': { 'left': '|', 'right': '|' } + \ } + +function! LightLineModified() + return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-' +endfunction + +function! LightLineReadonly() + return &ft !~? 'help' && &readonly ? 'RO' : '' +endfunction + +function! LightLineFilename() + let fname = expand('%:t') + return fname == 'ControlP' ? g:lightline.ctrlp_item : + \ fname == '__Tagbar__' ? g:lightline.fname : + \ fname =~ '__Gundo\|NERD_tree' ? '' : + \ &ft == 'vimfiler' ? vimfiler#get_status_string() : + \ &ft == 'unite' ? unite#get_status_string() : + \ &ft == 'vimshell' ? vimshell#get_status_string() : + \ ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') . + \ ('' != fname ? fname : '[No Name]') . + \ ('' != LightLineModified() ? ' ' . LightLineModified() : '') +endfunction + +function! LightLineFugitive() + try + if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head') + let mark = '' " edit here for cool mark + let _ = fugitive#head() + return strlen(_) ? mark._ : '' + endif + catch + endtry + return '' +endfunction + +function! LightLineFileformat() + return winwidth(0) > 70 ? &fileformat : '' +endfunction + +function! LightLineFiletype() + return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : '' +endfunction + +function! LightLineFileencoding() + return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : '' +endfunction + +function! LightLineMode() + let fname = expand('%:t') + return fname == '__Tagbar__' ? 'Tagbar' : + \ fname == 'ControlP' ? 'CtrlP' : + \ fname == '__Gundo__' ? 'Gundo' : + \ fname == '__Gundo_Preview__' ? 'Gundo Preview' : + \ fname =~ 'NERD_tree' ? 'NERDTree' : + \ &ft == 'unite' ? 'Unite' : + \ &ft == 'vimfiler' ? 'VimFiler' : + \ &ft == 'vimshell' ? 'VimShell' : + \ winwidth(0) > 60 ? lightline#mode() : '' +endfunction + +function! CtrlPMark() + if expand('%:t') =~ 'ControlP' + call lightline#link('iR'[g:lightline.ctrlp_regex]) + return lightline#concatenate([g:lightline.ctrlp_prev, g:lightline.ctrlp_item + \ , g:lightline.ctrlp_next], 0) + else + return '' + endif +endfunction + +let g:ctrlp_status_func = { + \ 'main': 'CtrlPStatusFunc_1', + \ 'prog': 'CtrlPStatusFunc_2', + \ } + +function! CtrlPStatusFunc_1(focus, byfname, regex, prev, item, next, marked) + let g:lightline.ctrlp_regex = a:regex + let g:lightline.ctrlp_prev = a:prev + let g:lightline.ctrlp_item = a:item + let g:lightline.ctrlp_next = a:next + return lightline#statusline(0) +endfunction + +function! CtrlPStatusFunc_2(str) + return lightline#statusline(0) +endfunction + +let g:tagbar_status_func = 'TagbarStatusFunc' + +function! TagbarStatusFunc(current, sort, fname, ...) abort + let g:lightline.fname = a:fname + return lightline#statusline(0) +endfunction + +augroup AutoSyntastic + autocmd! + autocmd BufWritePost *.c,*.cpp,*.js,*.py call s:syntastic() +augroup END +function! s:syntastic() + SyntasticCheck + call lightline#update() +endfunction + +let g:unite_force_overwrite_statusline = 0 +let g:vimfiler_force_overwrite_statusline = 0 +let g:vimshell_force_overwrite_statusline = 0 diff --git a/vimrc b/vimrc index 0d55790..0422ab0 100644 --- a/vimrc +++ b/vimrc @@ -87,6 +87,7 @@ let g:session_directory = "~/.vim/session" let g:session_autoload = "no" let g:session_autosave = "no" let g:session_command_aliases = 1 + "" Mouse set mouse=a @@ -274,134 +275,9 @@ let g:syntastic_check_on_open = 1 let g:syntastic_check_on_wq = 0 "" lightline -let g:lightline = { - \ 'colorscheme': 'solarized', - \ 'active': { - \ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ], ['ctrlpmark'] ], - \ 'right': [ [ 'syntastic', 'lineinfo' ], ['percent'], [ 'fileformat', 'fileencoding', 'filetype' ] ] - \ }, - \ 'component_function': { - \ 'fugitive': 'LightLineFugitive', - \ 'filename': 'LightLineFilename', - \ 'fileformat': 'LightLineFileformat', - \ 'filetype': 'LightLineFiletype', - \ 'fileencoding': 'LightLineFileencoding', - \ 'mode': 'LightLineMode', - \ 'ctrlpmark': 'CtrlPMark', - \ }, - \ 'component_expand': { - \ 'syntastic': 'SyntasticStatuslineFlag', - \ }, - \ 'component_type': { - \ 'syntastic': 'error', - \ }, - \ 'subseparator': { 'left': '|', 'right': '|' } - \ } - -function! LightLineModified() - return &ft =~ 'help' ? '' : &modified ? '+' : &modifiable ? '' : '-' -endfunction - -function! LightLineReadonly() - return &ft !~? 'help' && &readonly ? 'RO' : '' -endfunction - -function! LightLineFilename() - let fname = expand('%:t') - return fname == 'ControlP' ? g:lightline.ctrlp_item : - \ fname == '__Tagbar__' ? g:lightline.fname : - \ fname =~ '__Gundo\|NERD_tree' ? '' : - \ &ft == 'vimfiler' ? vimfiler#get_status_string() : - \ &ft == 'unite' ? unite#get_status_string() : - \ &ft == 'vimshell' ? vimshell#get_status_string() : - \ ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') . - \ ('' != fname ? fname : '[No Name]') . - \ ('' != LightLineModified() ? ' ' . LightLineModified() : '') -endfunction - -function! LightLineFugitive() - try - if expand('%:t') !~? 'Tagbar\|Gundo\|NERD' && &ft !~? 'vimfiler' && exists('*fugitive#head') - let mark = '' " edit here for cool mark - let _ = fugitive#head() - return strlen(_) ? mark._ : '' - endif - catch - endtry - return '' -endfunction - -function! LightLineFileformat() - return winwidth(0) > 70 ? &fileformat : '' -endfunction - -function! LightLineFiletype() - return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : '' -endfunction - -function! LightLineFileencoding() - return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : '' -endfunction - -function! LightLineMode() - let fname = expand('%:t') - return fname == '__Tagbar__' ? 'Tagbar' : - \ fname == 'ControlP' ? 'CtrlP' : - \ fname == '__Gundo__' ? 'Gundo' : - \ fname == '__Gundo_Preview__' ? 'Gundo Preview' : - \ fname =~ 'NERD_tree' ? 'NERDTree' : - \ &ft == 'unite' ? 'Unite' : - \ &ft == 'vimfiler' ? 'VimFiler' : - \ &ft == 'vimshell' ? 'VimShell' : - \ winwidth(0) > 60 ? lightline#mode() : '' -endfunction - -function! CtrlPMark() - if expand('%:t') =~ 'ControlP' - call lightline#link('iR'[g:lightline.ctrlp_regex]) - return lightline#concatenate([g:lightline.ctrlp_prev, g:lightline.ctrlp_item - \ , g:lightline.ctrlp_next], 0) - else - return '' - endif -endfunction - -let g:ctrlp_status_func = { - \ 'main': 'CtrlPStatusFunc_1', - \ 'prog': 'CtrlPStatusFunc_2', - \ } - -function! CtrlPStatusFunc_1(focus, byfname, regex, prev, item, next, marked) - let g:lightline.ctrlp_regex = a:regex - let g:lightline.ctrlp_prev = a:prev - let g:lightline.ctrlp_item = a:item - let g:lightline.ctrlp_next = a:next - return lightline#statusline(0) -endfunction - -function! CtrlPStatusFunc_2(str) - return lightline#statusline(0) -endfunction - -let g:tagbar_status_func = 'TagbarStatusFunc' - -function! TagbarStatusFunc(current, sort, fname, ...) abort - let g:lightline.fname = a:fname - return lightline#statusline(0) -endfunction - -augroup AutoSyntastic - autocmd! - autocmd BufWritePost *.c,*.cpp,*.js,*.py call s:syntastic() -augroup END -function! s:syntastic() - SyntasticCheck - call lightline#update() -endfunction - -let g:unite_force_overwrite_statusline = 0 -let g:vimfiler_force_overwrite_statusline = 0 -let g:vimshell_force_overwrite_statusline = 0 +if filereadable(expand("~/.vim/lightline.vim")) + source ~/.vim/lightline.vim +endif "" NERDTree configuration nmap n :NERDTreeToggle From 42ae9bf6a5962a24c804cbd11d644720da7997d1 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Wed, 17 Aug 2016 23:30:55 +0200 Subject: [PATCH 5/7] do not reload vimrc automatically when saved --- vimrc | 3 --- 1 file changed, 3 deletions(-) diff --git a/vimrc b/vimrc index 0422ab0..b323e2e 100644 --- a/vimrc +++ b/vimrc @@ -56,9 +56,6 @@ Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' } call plug#end() -"" reload when vim config changes -autocmd! bufwritepost .vimrc source % - "" enable local .vimrc set exrc " Enable use of directory-specific .vimrc set secure " Only run autocommands owned by me From d9bc9fcad786e833996763c454f12b69b23848de Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Wed, 17 Aug 2016 23:31:45 +0200 Subject: [PATCH 6/7] move modline overrides section --- vimrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vimrc b/vimrc index b323e2e..19131a2 100644 --- a/vimrc +++ b/vimrc @@ -88,6 +88,10 @@ let g:session_command_aliases = 1 "" Mouse set mouse=a +"" Use modeline overrides +set modeline +set modelines=10 + "" Visual settings syntax enable set cursorline @@ -108,10 +112,6 @@ if has("gui_running") set guioptions -=r endif -"" Use modeline overrides -set modeline -set modelines=10 - set title set titleold="Terminal" set titlestring=%F From d151a93b7c1b1dd363df0cfbf9f207e47b51c289 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Mon, 22 Aug 2016 23:44:24 +0200 Subject: [PATCH 7/7] open help in split view --- vimrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vimrc b/vimrc index 19131a2..3449871 100644 --- a/vimrc +++ b/vimrc @@ -342,3 +342,6 @@ au BufRead,BufNewFile *.json set ft=json "" Mustache au BufRead,BufNewFile *.template set filetype=html.mustache syntax=mustache + +"" always open help in vertical split +au FileType help wincmd L