mirror of
https://github.com/tomru/DotfilesOld.git
synced 2026-03-04 15:07:23 +01:00
Merge remote-tracking branch 'origin/master' into jenipapo
This commit is contained in:
129
vim/lightline.vim
Normal file
129
vim/lightline.vim
Normal file
@@ -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
|
||||||
164
vimrc
164
vimrc
@@ -11,6 +11,7 @@ Plug 'L9'
|
|||||||
Plug 'unimpaired.vim'
|
Plug 'unimpaired.vim'
|
||||||
Plug 'surround.vim'
|
Plug 'surround.vim'
|
||||||
Plug 'Align'
|
Plug 'Align'
|
||||||
|
Plug 'Raimondi/delimitMate'
|
||||||
|
|
||||||
Plug 'editorconfig/editorconfig-vim'
|
Plug 'editorconfig/editorconfig-vim'
|
||||||
|
|
||||||
@@ -45,22 +46,16 @@ Plug 'itchyny/lightline.vim'
|
|||||||
|
|
||||||
Plug 'chriskempson/base16-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' }
|
||||||
|
Plug 'mxw/vim-jsx', { 'for': 'javascript.jsx' }
|
||||||
|
|
||||||
Plug 'pangloss/vim-javascript'
|
Plug 'suan/vim-instant-markdown', { 'for': 'markdown' }
|
||||||
Plug 'marijnh/tern_for_vim', { 'do': 'npm install', 'for': 'javascript'}
|
Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
|
||||||
Plug 'mustache/vim-mustache-handlebars'
|
|
||||||
Plug 'mtscout6/syntastic-local-eslint.vim'
|
|
||||||
"Plug 'mxw/vim-jsx'
|
|
||||||
|
|
||||||
Plug 'suan/vim-instant-markdown'
|
|
||||||
Plug 'xuhdev/vim-latex-live-preview'
|
|
||||||
|
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
"" reload when vim config changes
|
|
||||||
autocmd! bufwritepost .vimrc source %
|
|
||||||
|
|
||||||
"" enable local .vimrc
|
"" enable local .vimrc
|
||||||
set exrc " Enable use of directory-specific .vimrc
|
set exrc " Enable use of directory-specific .vimrc
|
||||||
set secure " Only run autocommands owned by me
|
set secure " Only run autocommands owned by me
|
||||||
@@ -89,9 +84,14 @@ let g:session_directory = "~/.vim/session"
|
|||||||
let g:session_autoload = "no"
|
let g:session_autoload = "no"
|
||||||
let g:session_autosave = "no"
|
let g:session_autosave = "no"
|
||||||
let g:session_command_aliases = 1
|
let g:session_command_aliases = 1
|
||||||
|
|
||||||
"" Mouse
|
"" Mouse
|
||||||
set mouse=a
|
set mouse=a
|
||||||
|
|
||||||
|
"" Use modeline overrides
|
||||||
|
set modeline
|
||||||
|
set modelines=10
|
||||||
|
|
||||||
"" Visual settings
|
"" Visual settings
|
||||||
syntax enable
|
syntax enable
|
||||||
set cursorline
|
set cursorline
|
||||||
@@ -112,10 +112,6 @@ if has("gui_running")
|
|||||||
set guioptions -=r
|
set guioptions -=r
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"" Use modeline overrides
|
|
||||||
set modeline
|
|
||||||
set modelines=10
|
|
||||||
|
|
||||||
set title
|
set title
|
||||||
set titleold="Terminal"
|
set titleold="Terminal"
|
||||||
set titlestring=%F
|
set titlestring=%F
|
||||||
@@ -276,134 +272,9 @@ let g:syntastic_check_on_open = 1
|
|||||||
let g:syntastic_check_on_wq = 0
|
let g:syntastic_check_on_wq = 0
|
||||||
|
|
||||||
"" lightline
|
"" lightline
|
||||||
let g:lightline = {
|
if filereadable(expand("~/.vim/lightline.vim"))
|
||||||
\ 'colorscheme': 'solarized',
|
source ~/.vim/lightline.vim
|
||||||
\ 'active': {
|
endif
|
||||||
\ '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
|
|
||||||
|
|
||||||
"" NERDTree configuration
|
"" NERDTree configuration
|
||||||
nmap <leader>n :NERDTreeToggle<CR>
|
nmap <leader>n :NERDTreeToggle<CR>
|
||||||
@@ -470,4 +341,7 @@ au FileType javascript map <leader>r <esc>:TernRename<CR>
|
|||||||
au BufRead,BufNewFile *.json set ft=json
|
au BufRead,BufNewFile *.json set ft=json
|
||||||
|
|
||||||
"" Mustache
|
"" Mustache
|
||||||
au BufRead,BufNewFile *.template set filetype=html syntax=mustache
|
au BufRead,BufNewFile *.template set filetype=html.mustache syntax=mustache
|
||||||
|
|
||||||
|
"" always open help in vertical split
|
||||||
|
au FileType help wincmd L
|
||||||
|
|||||||
Reference in New Issue
Block a user