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 &viminfo = cache.'/info'
|
||||
|
||||
" Ctags data
|
||||
let &tags = cache.'/tags'
|
||||
|
||||
" Netrw data
|
||||
let g:netrw_home = cache.'/netrw'
|
||||
|
||||
@ -33,16 +30,13 @@ call plug#begin(plugins)
|
||||
Plug 'kien/ctrlp.vim'
|
||||
Plug 'itchyny/lightline.vim'
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
Plug 'majutsushi/tagbar', { 'on' : 'TagbarToggle' }
|
||||
Plug 'mbbill/undotree', { 'on' : 'UndotreeToggle' }
|
||||
Plug 'milkypostman/vim-togglelist'
|
||||
|
||||
" Syntax
|
||||
Plug 'travitch/hasksyn'
|
||||
Plug 'LnL7/vim-nix'
|
||||
Plug 'ngn/vim-apl'
|
||||
Plug 'vim-pandoc/vim-pandoc-syntax'
|
||||
Plug 'kchmck/vim-coffee-script'
|
||||
Plug 'hdima/python-syntax'
|
||||
Plug 'dag/vim-fish'
|
||||
|
||||
@ -60,48 +54,34 @@ call plug#end()
|
||||
""
|
||||
|
||||
set hidden " Hide buffers
|
||||
set incsearch " Incremental search
|
||||
set mouse=a " Enable mouse support
|
||||
|
||||
set ignorecase " Case insensitive search...
|
||||
set smartcase " ...for lowercase terms
|
||||
|
||||
set showcmd " Show command while writing it
|
||||
set ruler " Show line/column position
|
||||
set nowrap " Disable line wrap
|
||||
set novb " Disable visual beep
|
||||
set nofoldenable " Disable folding
|
||||
|
||||
set fsync
|
||||
set nobackup " Disable ~backup
|
||||
set fsync " Sync writes
|
||||
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 tabpagemax=10 " Limit number of tabs to 10
|
||||
set nomodeline " Disable for Security
|
||||
set showmatch " Highlight matched parenthesis
|
||||
set ffs=unix " Use UNIX file format
|
||||
set clipboard=unnamedplus " Clipboard integration
|
||||
set clipboard=unnamedplus " Yank to clipboard
|
||||
set wildignore+=*/tmp/*,*.so,*.swp " Files to ignore
|
||||
|
||||
set shiftwidth=2 " Tab
|
||||
set shiftwidth=2 " Tabs
|
||||
set tabstop=2 "
|
||||
set expandtab "
|
||||
|
||||
set number " Line numbering
|
||||
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
|
||||
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
|
||||
@ -109,7 +89,6 @@ autocmd VimLeave * set guicursor=a:hor20-blinkon20
|
||||
let mapleader=","
|
||||
|
||||
" Plugins
|
||||
map <Leader>t :TagbarToggle<CR>
|
||||
map <Leader>u :UndotreeToggle<CR>
|
||||
|
||||
" Misc
|
||||
@ -123,12 +102,6 @@ xnoremap <silent> p p:let @+=@0<CR>
|
||||
" save with sudo
|
||||
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
|
||||
@ -150,28 +123,12 @@ let g:neomake_error_sign = {
|
||||
let g:neomake_highlight_lines = 1
|
||||
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
|
||||
let g:ctrlp_clear_cache_on_exit = 0
|
||||
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",
|
||||
\"prog": "CtrlPStatusProg"}
|
||||
|
||||
" Pandoc Markdown
|
||||
let g:pandoc#syntax#conceal#use = 1
|
||||
|
||||
" use pandoc markdown syntax
|
||||
augroup pandoc_syntax
|
||||
au! BufNewFile,BufFilePre,BufRead *.md set filetype=markdown.pandoc
|
||||
augroup END
|
||||
autocmd! BufNewFile,BufFilePre,BufRead *.md set filetype=markdown.pandoc
|
||||
|
164
lightline.vim
164
lightline.vim
@ -4,38 +4,96 @@
|
||||
|
||||
let g:lightline = {
|
||||
\"active": {
|
||||
\ "left": [[ "mode", "paste" ],
|
||||
\ ["fugitive", "filename", "readonly", "ctrlpmark"]],
|
||||
\ "right": [ ["fileencoding", "filetype"],
|
||||
\ ["syntastic", "lineinfo"]]
|
||||
\ "left": [[ "mode", "paste" ],
|
||||
\ ["branch", "filename", "readonly", "ctrlp"]],
|
||||
\ "right": [[ "encoding", "filetype"],
|
||||
\ [ "lineinfo", "warnings", "errors"]],
|
||||
\ },
|
||||
\'separator': { 'left': '', 'right': '' },
|
||||
\'subseparator': { 'left': '→', 'right': '∘' },
|
||||
\"subseparator": { 'left': '→', 'right': '∘' },
|
||||
\"component": {
|
||||
\"readonly": '%{&filetype=="help"?"":&readonly?"∅":""}',
|
||||
\"modified": '%{&filetype=="help"?"":&modified?"+":&modifiable?"":"-"}'
|
||||
\ "branch" : '⚑ %{SpecialBuffer()? "" : fugitive#head()}',
|
||||
\ "readonly": '%{SpecialBuffer() || !&readonly? "" : "∅"}',
|
||||
\ "encoding": '%{!strlen(&fenc) || winwidth(0) < 70? "" : &fenc}',
|
||||
\ "filetype": '%{SpecialBuffer() || winwidth(0) < 70? "" : strlen(&filetype) ? &filetype : "no ft"}',
|
||||
\ },
|
||||
\'component_visible_condition': {
|
||||
\"readonly": '(&filetype!="help"&& &readonly)',
|
||||
\"modified": '(&filetype!="help"&&(&modified||!&modifiable))'
|
||||
\ "branch" : '(!SpecialBuffer() && strlen(fugitive#head()))',
|
||||
\ "readonly": '(!SpecialBuffer() && &readonly)',
|
||||
\ "filetype": '(!SpecialBuffer() && winwidth(0) > 70)',
|
||||
\ "encoding": '(strlen(&fenc) && winwidth(0) > 70)',
|
||||
\ },
|
||||
\"component_expand": {
|
||||
\ "syntastic": "SyntasticStatuslineFlag",
|
||||
\ "errors": "NeomakeErr",
|
||||
\ "warnings": "NeomakeWarn",
|
||||
\ },
|
||||
\"component_type": {
|
||||
\ "syntastic": "error",
|
||||
\ "errors": "error",
|
||||
\ "warnings": "warning",
|
||||
\ },
|
||||
\"component_function": {
|
||||
\ "filename": "Filename",
|
||||
\ "fugitive": "Fugitive",
|
||||
\ "filetype": "Filetype",
|
||||
\ "fileencoding": "Fileencoding",
|
||||
\ "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
|
||||
""
|
||||
@ -61,75 +119,3 @@ let s:p.normal.error = [ [ 00, 05 ] ]
|
||||
let s:p.normal.warning = [ [ 00, 02 ] ]
|
||||
|
||||
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