the great restauration
* Remove unused plugins and cruft * Remove default options (in neovim) * Simplify statuline * Add neomake status
This commit is contained in:
parent
a145cd5dd4
commit
b19e514dde
63
init.vim
63
init.vim
@ -12,9 +12,6 @@ let &directory = cache.',~/,/tmp'
|
|||||||
let &backupdir = cache.',~/,/tmp'
|
let &backupdir = cache.',~/,/tmp'
|
||||||
let &viminfo = cache.'/info'
|
let &viminfo = cache.'/info'
|
||||||
|
|
||||||
" Ctags data
|
|
||||||
let &tags = cache.'/tags'
|
|
||||||
|
|
||||||
" Netrw data
|
" Netrw data
|
||||||
let g:netrw_home = cache.'/netrw'
|
let g:netrw_home = cache.'/netrw'
|
||||||
|
|
||||||
@ -33,16 +30,13 @@ call plug#begin(plugins)
|
|||||||
Plug 'kien/ctrlp.vim'
|
Plug 'kien/ctrlp.vim'
|
||||||
Plug 'itchyny/lightline.vim'
|
Plug 'itchyny/lightline.vim'
|
||||||
Plug 'airblade/vim-gitgutter'
|
Plug 'airblade/vim-gitgutter'
|
||||||
Plug 'majutsushi/tagbar', { 'on' : 'TagbarToggle' }
|
|
||||||
Plug 'mbbill/undotree', { 'on' : 'UndotreeToggle' }
|
Plug 'mbbill/undotree', { 'on' : 'UndotreeToggle' }
|
||||||
Plug 'milkypostman/vim-togglelist'
|
Plug 'milkypostman/vim-togglelist'
|
||||||
|
|
||||||
" Syntax
|
" Syntax
|
||||||
Plug 'travitch/hasksyn'
|
Plug 'travitch/hasksyn'
|
||||||
Plug 'LnL7/vim-nix'
|
Plug 'LnL7/vim-nix'
|
||||||
Plug 'ngn/vim-apl'
|
|
||||||
Plug 'vim-pandoc/vim-pandoc-syntax'
|
Plug 'vim-pandoc/vim-pandoc-syntax'
|
||||||
Plug 'kchmck/vim-coffee-script'
|
|
||||||
Plug 'hdima/python-syntax'
|
Plug 'hdima/python-syntax'
|
||||||
Plug 'dag/vim-fish'
|
Plug 'dag/vim-fish'
|
||||||
|
|
||||||
@ -60,48 +54,34 @@ call plug#end()
|
|||||||
""
|
""
|
||||||
|
|
||||||
set hidden " Hide buffers
|
set hidden " Hide buffers
|
||||||
set incsearch " Incremental search
|
|
||||||
set mouse=a " Enable mouse support
|
set mouse=a " Enable mouse support
|
||||||
|
|
||||||
set ignorecase " Case insensitive search...
|
set ignorecase " Case insensitive search...
|
||||||
set smartcase " ...for lowercase terms
|
set smartcase " ...for lowercase terms
|
||||||
|
|
||||||
set showcmd " Show command while writing it
|
|
||||||
set ruler " Show line/column position
|
|
||||||
set nowrap " Disable line wrap
|
set nowrap " Disable line wrap
|
||||||
set novb " Disable visual beep
|
|
||||||
set nofoldenable " Disable folding
|
set nofoldenable " Disable folding
|
||||||
|
|
||||||
set fsync
|
set fsync " Sync writes
|
||||||
set nobackup " Disable ~backup
|
|
||||||
set noswapfile " Disable swap files
|
set noswapfile " Disable swap files
|
||||||
set writebackup " Enable temp backups
|
set writebackup " Backup file before overwriting...
|
||||||
|
set nobackup " ...but delete it on success
|
||||||
|
|
||||||
set nomodeline " Security
|
set nomodeline " Disable for Security
|
||||||
set tabpagemax=10 " Limit number of tabs to 10
|
|
||||||
set showmatch " Highlight matched parenthesis
|
set showmatch " Highlight matched parenthesis
|
||||||
set ffs=unix " Use UNIX file format
|
set clipboard=unnamedplus " Yank to clipboard
|
||||||
set clipboard=unnamedplus " Clipboard integration
|
|
||||||
set wildignore+=*/tmp/*,*.so,*.swp " Files to ignore
|
set wildignore+=*/tmp/*,*.so,*.swp " Files to ignore
|
||||||
|
|
||||||
set shiftwidth=2 " Tab
|
set shiftwidth=2 " Tabs
|
||||||
set tabstop=2 "
|
set tabstop=2 "
|
||||||
set expandtab "
|
set expandtab "
|
||||||
|
|
||||||
set number " Line numbering
|
set number " Line numbering
|
||||||
set smartindent " Indentation
|
set smartindent " Indentation
|
||||||
set noshowmode "
|
set noshowmode " Disable printing of mode changes
|
||||||
|
set fillchars=eob:\ " Hide ~ on empty lines
|
||||||
|
|
||||||
syntax on " Syntax highlighting
|
|
||||||
runtime colors.vim " Load color scheme
|
runtime colors.vim " Load color scheme
|
||||||
filetype indent plugin on " Identify file type
|
filetype indent plugin on " Identify file type
|
||||||
|
|
||||||
" Titlebar without “-VIM”
|
|
||||||
set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:p:h\")})%)%(\ %a%)
|
|
||||||
|
|
||||||
" change cursor style
|
|
||||||
autocmd VimLeave * set guicursor=a:hor20-blinkon20
|
|
||||||
|
|
||||||
|
|
||||||
""
|
""
|
||||||
"" Key bindings
|
"" Key bindings
|
||||||
@ -109,7 +89,6 @@ autocmd VimLeave * set guicursor=a:hor20-blinkon20
|
|||||||
let mapleader=","
|
let mapleader=","
|
||||||
|
|
||||||
" Plugins
|
" Plugins
|
||||||
map <Leader>t :TagbarToggle<CR>
|
|
||||||
map <Leader>u :UndotreeToggle<CR>
|
map <Leader>u :UndotreeToggle<CR>
|
||||||
|
|
||||||
" Misc
|
" Misc
|
||||||
@ -123,12 +102,6 @@ xnoremap <silent> p p:let @+=@0<CR>
|
|||||||
" save with sudo
|
" save with sudo
|
||||||
cmap w!! w !sudo tee > /dev/null %
|
cmap w!! w !sudo tee > /dev/null %
|
||||||
|
|
||||||
" show highlight group under cursor
|
|
||||||
map <Leader>g :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
|
|
||||||
\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
|
|
||||||
\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
""
|
""
|
||||||
"" Plugin options
|
"" Plugin options
|
||||||
@ -150,28 +123,12 @@ let g:neomake_error_sign = {
|
|||||||
let g:neomake_highlight_lines = 1
|
let g:neomake_highlight_lines = 1
|
||||||
let g:neomake_virtualtext_current_error = 0
|
let g:neomake_virtualtext_current_error = 0
|
||||||
|
|
||||||
" Tagbar
|
|
||||||
let g:tagbar_status_func = "TagbarStatusFunc"
|
|
||||||
let g:tagbar_compact = 1
|
|
||||||
let g:tagbar_iconchars = [">", "∨"]
|
|
||||||
|
|
||||||
" MiniBufferExplorer
|
|
||||||
let g:miniBufExplMapWindowNavVim = 1
|
|
||||||
let g:miniBufExplMapWindowNavArrows = 1
|
|
||||||
let g:miniBufExplMapCTabSwitchBufs = 1
|
|
||||||
let g:miniBufExplModSelTarget = 1
|
|
||||||
|
|
||||||
" CtrlP
|
" CtrlP
|
||||||
let g:ctrlp_clear_cache_on_exit = 0
|
let g:ctrlp_clear_cache_on_exit = 0
|
||||||
let g:ctrlp_follow_symlinks = 1
|
let g:ctrlp_follow_symlinks = 1
|
||||||
let g:ctrlp_custom_ignore = {"dir": "\v[\/]\.(git|hg|svn|ve)$"}
|
let g:ctrlp_custom_ignore = {"dir": "\v[\/]\.git$"}
|
||||||
let g:ctrlp_status_func = {"main": "CtrlPStatusMain",
|
let g:ctrlp_status_func = {"main": "CtrlPStatusMain",
|
||||||
\"prog": "CtrlPStatusProg"}
|
\"prog": "CtrlPStatusProg"}
|
||||||
|
|
||||||
" Pandoc Markdown
|
" Pandoc Markdown
|
||||||
let g:pandoc#syntax#conceal#use = 1
|
autocmd! BufNewFile,BufFilePre,BufRead *.md set filetype=markdown.pandoc
|
||||||
|
|
||||||
" use pandoc markdown syntax
|
|
||||||
augroup pandoc_syntax
|
|
||||||
au! BufNewFile,BufFilePre,BufRead *.md set filetype=markdown.pandoc
|
|
||||||
augroup END
|
|
||||||
|
162
lightline.vim
162
lightline.vim
@ -5,37 +5,95 @@
|
|||||||
let g:lightline = {
|
let g:lightline = {
|
||||||
\"active": {
|
\"active": {
|
||||||
\ "left": [[ "mode", "paste" ],
|
\ "left": [[ "mode", "paste" ],
|
||||||
\ ["fugitive", "filename", "readonly", "ctrlpmark"]],
|
\ ["branch", "filename", "readonly", "ctrlp"]],
|
||||||
\ "right": [ ["fileencoding", "filetype"],
|
\ "right": [[ "encoding", "filetype"],
|
||||||
\ ["syntastic", "lineinfo"]]
|
\ [ "lineinfo", "warnings", "errors"]],
|
||||||
\ },
|
\ },
|
||||||
\'separator': { 'left': '', 'right': '' },
|
\"subseparator": { 'left': '→', 'right': '∘' },
|
||||||
\'subseparator': { 'left': '→', 'right': '∘' },
|
|
||||||
\"component": {
|
\"component": {
|
||||||
\"readonly": '%{&filetype=="help"?"":&readonly?"∅":""}',
|
\ "branch" : '⚑ %{SpecialBuffer()? "" : fugitive#head()}',
|
||||||
\"modified": '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}'
|
\ "readonly": '%{SpecialBuffer() || !&readonly? "" : "∅"}',
|
||||||
|
\ "encoding": '%{!strlen(&fenc) || winwidth(0) < 70? "" : &fenc}',
|
||||||
|
\ "filetype": '%{SpecialBuffer() || winwidth(0) < 70? "" : strlen(&filetype) ? &filetype : "no ft"}',
|
||||||
\ },
|
\ },
|
||||||
\'component_visible_condition': {
|
\'component_visible_condition': {
|
||||||
\"readonly": '(&filetype!="help"&& &readonly)',
|
\ "branch" : '(!SpecialBuffer() && strlen(fugitive#head()))',
|
||||||
\"modified": '(&filetype!="help"&&(&modified||!&modifiable))'
|
\ "readonly": '(!SpecialBuffer() && &readonly)',
|
||||||
|
\ "filetype": '(!SpecialBuffer() && winwidth(0) > 70)',
|
||||||
|
\ "encoding": '(strlen(&fenc) && winwidth(0) > 70)',
|
||||||
\ },
|
\ },
|
||||||
\"component_expand": {
|
\"component_expand": {
|
||||||
\ "syntastic": "SyntasticStatuslineFlag",
|
\ "errors": "NeomakeErr",
|
||||||
|
\ "warnings": "NeomakeWarn",
|
||||||
\ },
|
\ },
|
||||||
\"component_type": {
|
\"component_type": {
|
||||||
\ "syntastic": "error",
|
\ "errors": "error",
|
||||||
|
\ "warnings": "warning",
|
||||||
\ },
|
\ },
|
||||||
\"component_function": {
|
\"component_function": {
|
||||||
\ "filename": "Filename",
|
|
||||||
\ "fugitive": "Fugitive",
|
|
||||||
\ "filetype": "Filetype",
|
|
||||||
\ "fileencoding": "Fileencoding",
|
|
||||||
\ "mode": "Mode",
|
\ "mode": "Mode",
|
||||||
\ "ctrlpmark": "CtrlPMark",
|
\ "filename": "Filename",
|
||||||
|
\ "ctrlp": "CtrlPMark",
|
||||||
\ }
|
\ }
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
|
|
||||||
|
""
|
||||||
|
"" Function helpers
|
||||||
|
""
|
||||||
|
|
||||||
|
function SpecialBuffer()
|
||||||
|
return &filetype == "help" || bufname() =~ '\v(undotree|diffpanel|ControlP)'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! Filename()
|
||||||
|
let fname = expand('%:t')
|
||||||
|
let mod = &modified? "Δ" : &modifiable? "" : "δ"
|
||||||
|
return fname == 'ControlP'? g:lightline.ctrlp_item :
|
||||||
|
\ SpecialBuffer()? "" :
|
||||||
|
\ (strlen(fname)? fname : 'new-file').' '.mod
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! Mode()
|
||||||
|
let fname = expand("%:t")
|
||||||
|
return fname == "ControlP"? "CTRLP" :
|
||||||
|
\ &filetype == "help"? "HELP" :
|
||||||
|
\ bufname() =~ "undotree"? "UNDO" :
|
||||||
|
\ winwidth(0) > 60 ? lightline#mode() : ""
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! NeomakeErr()
|
||||||
|
let errs = get(neomake#statusline#LoclistCounts(), 'E', 0)
|
||||||
|
return errs? printf('%dE', errs) : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! NeomakeWarn()
|
||||||
|
let warns = get(neomake#statusline#LoclistCounts(), 'W', 0)
|
||||||
|
return warns? printf('%dW', warns) : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
autocmd User NeomakeCountsChanged,NeomakeMakerFinished call lightline#update()
|
||||||
|
|
||||||
|
function! CtrlPMark()
|
||||||
|
if bufname() =~ "ControlP"
|
||||||
|
call lightline#link("iR"[g:lightline.ctrlp_regex])
|
||||||
|
endif
|
||||||
|
return ""
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! CtrlPStatusMain(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! CtrlPStatusProg(str)
|
||||||
|
return lightline#statusline(0)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
""
|
""
|
||||||
"" Color scheme
|
"" Color scheme
|
||||||
""
|
""
|
||||||
@ -61,75 +119,3 @@ let s:p.normal.error = [ [ 00, 05 ] ]
|
|||||||
let s:p.normal.warning = [ [ 00, 02 ] ]
|
let s:p.normal.warning = [ [ 00, 02 ] ]
|
||||||
|
|
||||||
let g:lightline#colorscheme#default#palette = lightline#colorscheme#fill(s:p)
|
let g:lightline#colorscheme#default#palette = lightline#colorscheme#fill(s:p)
|
||||||
|
|
||||||
|
|
||||||
""
|
|
||||||
"" Function helpers
|
|
||||||
""
|
|
||||||
|
|
||||||
function! Fugitive()
|
|
||||||
if &ft !~? 'tagbar' && exists("*fugitive#head")
|
|
||||||
let _ = fugitive#head()
|
|
||||||
return strlen(_) ? "Σ "._ : ""
|
|
||||||
endif
|
|
||||||
return ''
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! Modified()
|
|
||||||
return &ft =~ "help" ? "" : &modified ? "Δ" : &modifiable ? "" : "δ"
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! Readonly()
|
|
||||||
return &ft !~? "help" && &readonly ? "RO" : ""
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! Filename()
|
|
||||||
let fname = expand('%:t')
|
|
||||||
return fname == 'ControlP' ? g:lightline.ctrlp_item :
|
|
||||||
\ fname == '__Tagbar__' ? g:lightline.fname :
|
|
||||||
\ ('' != fname ? fname : '[No Name]') .
|
|
||||||
\ ('' != Modified() ? ' ' . Modified() : '')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! Filetype()
|
|
||||||
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : "no ft") : ""
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! Fileencoding()
|
|
||||||
return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : ""
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! Mode()
|
|
||||||
let fname = expand("%:t")
|
|
||||||
return fname == "__Tagbar__" ? "Tagbar" :
|
|
||||||
\ fname == "ControlP" ? "CtrlP" :
|
|
||||||
\ 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
|
|
||||||
|
|
||||||
function! CtrlPStatusMain(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! CtrlPStatusProg(str)
|
|
||||||
return lightline#statusline(0)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! TagbarStatusFunc(current, sort, fname, ...) abort
|
|
||||||
let g:lightline.fname = a:fname
|
|
||||||
return lightline#statusline(0)
|
|
||||||
endfunction
|
|
||||||
|
Loading…
Reference in New Issue
Block a user