mirror of
https://github.com/tomru/DotfilesOld.git
synced 2026-03-03 06:27:21 +01:00
update vimrc
This commit is contained in:
151
vimrc
151
vimrc
@@ -30,6 +30,7 @@ Plug 'SirVer/ultisnips'
|
||||
Plug 'honza/vim-snippets'
|
||||
|
||||
Plug 'scrooloose/syntastic'
|
||||
Plug 'pmsorhaindo/syntastic-local-eslint.vim'
|
||||
|
||||
Plug 'tpope/vim-fugitive'
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
@@ -48,7 +49,7 @@ Plug 'Raimondi/delimitMate'
|
||||
Plug 'pangloss/vim-javascript'
|
||||
Plug 'marijnh/tern_for_vim', { 'do': 'npm install', 'for': 'javascript'}
|
||||
Plug 'mustache/vim-mustache-handlebars'
|
||||
Plug 'mxw/vim-jsx'
|
||||
"Plug 'mxw/vim-jsx'
|
||||
|
||||
Plug 'shime/vim-livedown'
|
||||
Plug 'xuhdev/vim-latex-live-preview'
|
||||
@@ -262,22 +263,141 @@ nnoremap <leader>sc :CloseSession<CR>
|
||||
|
||||
"" syntastic
|
||||
let g:syntastic_javascript_checkers = ['eslint']
|
||||
|
||||
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
|
||||
|
||||
"" lightline
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'solarized',
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ],
|
||||
\ [ 'fugitive', 'readonly', 'filename', 'modified' ] ]
|
||||
\ },
|
||||
\ 'component': {
|
||||
\ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}'
|
||||
\ },
|
||||
\ 'component_visible_condition': {
|
||||
\ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
|
||||
\ }
|
||||
\}
|
||||
\ '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 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
|
||||
|
||||
"" NERDTree configuration
|
||||
nmap <leader>n :NERDTreeToggle<CR>
|
||||
@@ -315,7 +435,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
|
||||
@@ -337,6 +457,9 @@ au FileType markdown set wrap wm=2 textwidth=78 nocindent spell
|
||||
"" Python
|
||||
au FileType python set noexpandtab
|
||||
|
||||
"" JavaScript
|
||||
au FileType javascript map <leader>r <esc>:TernRename<CR>
|
||||
|
||||
"" Json
|
||||
au BufRead,BufNewFile *.json set ft=json
|
||||
|
||||
|
||||
Reference in New Issue
Block a user