Unbloat NeoVim config and edit statusline

This commit is contained in:
Wiktor Zykubek 2020-05-20 12:13:04 +02:00
parent f37099cbf8
commit 8cd5de43a7
6 changed files with 106 additions and 153 deletions

View File

@ -53,4 +53,3 @@ st.font: Monospace:pixelsize=13:antialias=true:autohint=true:hintstyle=hintmediu
! white ! white
*.color7: #cccccc *.color7: #cccccc

View File

@ -5,18 +5,6 @@
let mapleader = ' ' let mapleader = ' '
let g:move_key_modifier = 'A' let g:move_key_modifier = 'A'
"~~~~~
" Git
"~~~~~
" Show git commit list
map <Leader>gv :GV<CR>
" Show status
nnoremap <Leader>gs :Git<CR>
" Pull
nnoremap <Leader>gpu :Gpull<CR>
"~~~~~~~~~~~~~~~~~ "~~~~~~~~~~~~~~~~~
" File Management " File Management
"~~~~~~~~~~~~~~~~~ "~~~~~~~~~~~~~~~~~
@ -24,12 +12,6 @@ nnoremap <Leader>gpu :Gpull<CR>
nmap <silent> <Leader>f :Files<CR> nmap <silent> <Leader>f :Files<CR>
nmap <silent> <Leader>fg :GFiles<CR> nmap <silent> <Leader>fg :GFiles<CR>
" vifm
nmap <silent> <Leader>r :Vifm<CR>
" NERDTree
map <silent> <Leader>n :NERDTreeToggle<CR>
"~~~~~~~~~ "~~~~~~~~~
" Linters " Linters
"~~~~~~~~~ "~~~~~~~~~
@ -48,10 +30,6 @@ map <Leader>ad :ALEDetail<CR>
map <Leader>ag :ALEGoToDefinitionInSplit<CR> map <Leader>ag :ALEGoToDefinitionInSplit<CR>
map <Leader>aG :ALEGoToDefinition<CR> map <Leader>aG :ALEGoToDefinition<CR>
" LSP
" nnoremap <silent> <C-]> :LspNextDiagnostic<CR>
" nnoremap <silent> <C-[> :LspPreviousDiagnostic<CR>
" Spell-check (English US and Polish) " Spell-check (English US and Polish)
map <F6> :setlocal spell! spelllang=en_us<CR> map <F6> :setlocal spell! spelllang=en_us<CR>
map <F7> :setlocal spell! spelllang=pl<CR> map <F7> :setlocal spell! spelllang=pl<CR>
@ -65,25 +43,15 @@ map <S-d> :tabclose<CR>
nnoremap <S-j> gt nnoremap <S-j> gt
nnoremap <S-k> gT nnoremap <S-k> gT
" Split Managment
nnoremap <C-A-j> <C-w><C-j>
nnoremap <C-A-k> <C-w><C-k>
nnoremap <C-A-l> <C-w><C-l>
nnoremap <C-A-h> <C-w><C-h>
" Open terminal " Open terminal
noremap <C-A-t> :split term://zsh<cr>:resize 10<cr> noremap <C-A-t> :split term://zsh<cr>:resize 10<cr>
" Exit from terminal mode " Exit from terminal mode
tnoremap <C-e> <C-\><C-n> tnoremap <C-e> <C-\><C-n>
"~~~~~~~ "~~~~~~~
" Other " Other
"~~~~~~~ "~~~~~~~
" Sudo read-only file
cnoremap sudow w !sudo tee % >/dev/null
" Disable hlsearch " Disable hlsearch
map <silent> <C-s> :noh<CR> map <silent> <C-s> :noh<CR>

View File

@ -1,12 +1,12 @@
" "
" ██ " ██
" ░██ " ░██
" █████ ██████ ░██ ██████ ██████ ██████ " █████ ██████ ░██ ██████ ██████ ██████
" ██░░░██ ██░░░░██ ░██ ██░░░░██░░██░░█ ██░░░░ " ██░░░██ ██░░░░██ ░██ ██░░░░██░░██░░█ ██░░░░
" ░██ ░░ ░██ ░██ ░██░██ ░██ ░██ ░ ░░█████ " ░██ ░░ ░██ ░██ ░██░██ ░██ ░██ ░ ░░█████
" ░██ ██░██ ░██ ░██░██ ░██ ░██ ░░░░░██ " ░██ ██░██ ░██ ░██░██ ░██ ░██ ░░░░░██
" ░░█████ ░░██████ ███░░██████ ░███ ██████ " ░░█████ ░░██████ ███░░██████ ░███ ██████
" ░░░░░ ░░░░░░ ░░░ ░░░░░░ ░░░ ░░░░░░ " ░░░░░ ░░░░░░ ░░░ ░░░░░░ ░░░ ░░░░░░
if exists('syntax_on') if exists('syntax_on')
syntax reset syntax reset
@ -14,54 +14,54 @@ endif
hi clear hi clear
hi TabLine ctermfg=NONE ctermbg=NONE cterm=NONE hi TabLine ctermfg=NONE ctermbg=NONE cterm=NONE
hi TabLineSel ctermfg=4 ctermbg=NONE cterm=bold hi TabLineSel ctermfg=4 ctermbg=NONE cterm=bold
hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=NONE hi TabLineFill ctermfg=NONE ctermbg=NONE cterm=NONE
hi Title ctermfg=15 ctermbg=NONE cterm=NONE hi Title ctermfg=15 ctermbg=NONE cterm=NONE
hi LineNr ctermfg=6 cterm=NONE
hi CursorLineNr ctermfg=5 cterm=bold
hi ColorColumn ctermfg=1 ctermbg=0 cterm=undercurl
hi SignColumn ctermfg=7
hi VertSplit ctermfg=0 ctermbg=8
hi Comment ctermfg=4
hi String ctermfg=1
hi Visual ctermbg=8
hi Search ctermbg=8 cterm=bold,reverse
hi MatchParen ctermfg=3 ctermbg=0 cterm=bold
hi Statement ctermfg=3
hi ErrorMsg ctermfg=1 ctermbg=none
hi Error ctermfg=0 ctermbg=1 cterm=undercurl
hi SpellBad ctermfg=0 ctermbg=1 cterm=undercurl
hi SpellCap ctermfg=0 ctermbg=2 cterm=undercurl
hi SpellRare ctermfg=0 ctermbg=none cterm=undercurl
hi SpellLocal ctermfg=0 ctermbg=5 cterm=undercurl
hi DiffAdd ctermfg=0 ctermbg=2
hi DiffChange ctermfg=0 ctermbg=4
hi DiffDelete ctermfg=0 ctermbg=1
hi DiffText ctermfg=0 ctermbg=4
hi Folded ctermbg=8
hi FoldColumn ctermbg=8
hi Pmenu ctermfg=4 ctermbg=233
hi PmenuSel ctermfg=4 ctermbg=8
hi PmenuThumb ctermfg=8 ctermbg=8
hi PmenuSbar ctermfg=0 ctermbg=0
hi StatusLineNC ctermfg=8 ctermbg=NONE cterm=bold
hi StatusLine ctermfg=5 ctermbg=NONE cterm=NONE
hi MyStatuslineFilename ctermfg=4 ctermbg=NONE
hi MyStatuslineFiletype ctermfg=9 ctermbg=none cterm=italic
hi MyStatuslineLineCol ctermfg=35 ctermbg=none cterm=none hi LineNr ctermfg=238 cterm=none
hi MyStatuslineLinePerc ctermfg=2 ctermbg=none cterm=none hi CursorLineNr ctermfg=220 ctermbg=8 cterm=bold
hi CursorLine ctermbg=8 cterm=NONE hi ColorColumn ctermfg=1 ctermbg=0 cterm=undercurl
hi CursorColumn ctermbg=8 cterm=NONE hi SignColumn ctermfg=7
hi VertSplit ctermfg=0 ctermbg=8
hi Comment ctermfg=4
hi String ctermfg=1
hi Visual ctermbg=8
hi Search ctermbg=8 cterm=bold,reverse
hi MatchParen ctermfg=3 ctermbg=0 cterm=bold
hi Statement ctermfg=3
hi ErrorMsg ctermfg=1 ctermbg=none
hi Error ctermfg=0 ctermbg=1 cterm=undercurl
hi SpellBad ctermfg=0 ctermbg=1 cterm=undercurl
hi SpellCap ctermfg=0 ctermbg=2 cterm=undercurl
hi SpellRare ctermfg=0 ctermbg=none cterm=undercurl
hi SpellLocal ctermfg=0 ctermbg=5 cterm=undercurl
hi DiffAdd ctermfg=0 ctermbg=2
hi DiffChange ctermfg=0 ctermbg=4
hi DiffDelete ctermfg=0 ctermbg=1
hi DiffText ctermfg=0 ctermbg=4
hi Folded ctermbg=8
hi FoldColumn ctermbg=8
hi Pmenu ctermfg=4 ctermbg=233
hi PmenuSel ctermfg=4 ctermbg=8
hi PmenuThumb ctermfg=8 ctermbg=8
hi PmenuSbar ctermfg=0 ctermbg=0
hi StatusLineNC ctermfg=8 ctermbg=NONE cterm=bold
hi StatusLine ctermfg=14 ctermbg=NONE cterm=NONE
hi MyStatuslineFilename ctermfg=4 ctermbg=NONE
hi MyStatuslineFiletype ctermfg=9 ctermbg=none cterm=italic
hi MyStatuslineLineCol ctermfg=1 ctermbg=none cterm=none
hi MyStatuslineLinePerc ctermfg=2 ctermbg=none cterm=none
hi CursorLine ctermbg=8 cterm=NONE
hi CursorColumn ctermbg=8 cterm=NONE
" ALE " ALE
hi ALEWarning cterm=undercurl hi ALEWarning cterm=undercurl
@ -77,20 +77,20 @@ hi LspErrorText ctermfg=red ctermbg=none
" Cursorline highlight " Cursorline highlight
augroup CursorLine augroup CursorLine
au! au!
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
au WinLeave * setlocal nocursorline au WinLeave * setlocal nocursorline
augroup END augroup END
" Files " Files
hi Win ctermfg=white ctermbg=none cterm=none hi Win ctermfg=white ctermbg=none cterm=none
hi Directory ctermfg=blue ctermbg=none cterm=bold hi Directory ctermfg=blue ctermbg=none cterm=bold
hi Link ctermfg=cyan ctermbg=none cterm=none hi Link ctermfg=cyan ctermbg=none cterm=none
hi BrokenLink ctermfg=red ctermbg=none cterm=bold hi BrokenLink ctermfg=red ctermbg=none cterm=bold
hi Socket ctermfg=magenta ctermbg=none cterm=bold hi Socket ctermfg=magenta ctermbg=none cterm=bold
hi Device ctermfg=red ctermbg=none cterm=bold hi Device ctermfg=red ctermbg=none cterm=bold
hi Fifo ctermfg=red ctermbg=none cterm=bold hi Fifo ctermfg=red ctermbg=none cterm=bold
" hi Executable ctermfg=0 ctermbg=1 cterm=bold " hi Executable ctermfg=0 ctermbg=1 cterm=bold
" Syntax " Syntax
@ -108,4 +108,3 @@ hi GitGutterChange ctermbg=none ctermfg=3 cterm=bold
hi GitGutterAdd ctermbg=none ctermfg=2 cterm=bold hi GitGutterAdd ctermbg=none ctermfg=2 cterm=bold
hi GitGutterDelete ctermbg=none ctermfg=1 cterm=bold hi GitGutterDelete ctermbg=none ctermfg=1 cterm=bold
hi GitGutterChangeDelete ctermbg=none ctermfg=5 cterm=bold hi GitGutterChangeDelete ctermbg=none ctermfg=5 cterm=bold

View File

@ -34,9 +34,22 @@ set mouse=a
set splitright set splitright
set splitbelow set splitbelow
set noshowmode set noshowmode
set shortmess+=I
color biual color biual
highlight OverLength ctermbg=none ctermfg=14 cterm=underline " Ignore files which vim doesn't use
set wildignore+=.git,.hg,.svn
set wildignore+=*.aux,*.out,*.toc
set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
set wildignore+=*.ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp
set wildignore+=*.avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg
set wildignore+=*.mp3,*.oga,*.ogg,*.wav,*.flac,*.opus
set wildignore+=*.eot,*.otf,*.ttf,*.woff
set wildignore+=*.doc,*.pdf,*.cbr,*.cbz
set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
set wildignore+=*.swp,.lock,.DS_Store,._*
highlight OverLength cterm=underline
match OverLength /\%81v.\+/ match OverLength /\%81v.\+/
" Restore cursor position " Restore cursor position
@ -69,12 +82,12 @@ augroup langindentation
autocmd Filetype sh setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 autocmd Filetype sh setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2
augroup END augroup END
" oh, gods - this is beautiful " Automatically reload configs on save
autocmd BufWritePost *Xresources,*Xdefaults !xrdb % autocmd BufWritePost *Xresources,*Xdefaults !xrdb %
autocmd BufWritePost *sxhkdrc !pkill -USR1 sxhkd autocmd BufWritePost *sxhkdrc !pkill -USR1 sxhkd
autocmd BufWritePost *picom.conf !pkill -USR1 picom autocmd BufWritePost *picom.conf !pkill -USR1 picom
" Automatically deletes all trailing whitespace and newlines at end of file on save. " Automatically deletes all trailing whitespace and newlines at end of file on save
autocmd BufWritePre * %s/\s\+$//e autocmd BufWritePre * %s/\s\+$//e
autocmd BufWritepre * %s/\n\+\%$//e autocmd BufWritepre * %s/\n\+\%$//e

View File

@ -13,9 +13,6 @@ call plug#begin('~/.config/nvim/bundle')
" files management " files management
Plug '~/.fzf' Plug '~/.fzf'
Plug 'junegunn/fzf.vim' Plug 'junegunn/fzf.vim'
Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'vifm/vifm.vim'
" linters/deoplete " linters/deoplete
Plug 'dense-analysis/ale' Plug 'dense-analysis/ale'
@ -23,9 +20,7 @@ call plug#begin('~/.config/nvim/bundle')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'tbodt/deoplete-tabnine', { 'do': './install.sh' } Plug 'tbodt/deoplete-tabnine', { 'do': './install.sh' }
Plug 'Shougo/deoplete-clangx' Plug 'Shougo/deoplete-clangx'
" Plug 'deoplete-plugins/deoplete-jedi'
Plug 'deoplete-plugins/deoplete-zsh' Plug 'deoplete-plugins/deoplete-zsh'
" Plug 'deoplete-plugins/deoplete-go', { 'do': 'make'}
Plug 'prabirshrestha/async.vim' Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/asyncomplete.vim' Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/vim-lsp' Plug 'prabirshrestha/vim-lsp'
@ -53,13 +48,10 @@ call plug#begin('~/.config/nvim/bundle')
Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' } Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
" git " git
Plug 'tpope/vim-fugitive'
Plug 'junegunn/gv.vim'
Plug 'airblade/vim-gitgutter' Plug 'airblade/vim-gitgutter'
" syntax " syntax
Plug 'bfrg/vim-cpp-modern' Plug 'bfrg/vim-cpp-modern'
Plug 'udalov/kotlin-vim'
Plug 'vim-python/python-syntax' Plug 'vim-python/python-syntax'
Plug 'jelera/vim-javascript-syntax' Plug 'jelera/vim-javascript-syntax'
call plug#end() call plug#end()
@ -72,7 +64,6 @@ let g:ale_sign_error = ''
let g:lsp_signs_error = {'text': ''} let g:lsp_signs_error = {'text': ''}
let g:ale_sign_warning = '' let g:ale_sign_warning = ''
let g:lsp_signs_warning = {'text': ''} let g:lsp_signs_warning = {'text': ''}
" let g:lsp_signs_error = {'', 'icon': '/path/to/some/icon'} " icons require GUI
let g:lsp_signs_hint = {'text': ''} " icons require GUI let g:lsp_signs_hint = {'text': ''} " icons require GUI
let g:ale_linters = { let g:ale_linters = {
@ -84,7 +75,6 @@ let g:ale_linters = {
\ 'sh': ['language_server', 'shellcheck', 'shell'], \ 'sh': ['language_server', 'shellcheck', 'shell'],
\ 'zsh': ['language_server', 'shellcheck', 'shell'], \ 'zsh': ['language_server', 'shellcheck', 'shell'],
\ 'go': ['gofmt'], \ 'go': ['gofmt'],
\ 'kotlin': ['ktlint'],
\} \}
let g:ale_fixers = { let g:ale_fixers = {
\ '*': ['trim_whitespace', 'remove_trailing_lines'], \ '*': ['trim_whitespace', 'remove_trailing_lines'],
@ -120,16 +110,12 @@ let g:fzf_colors =
\ 'spinner': ['fg', 'Label'], \ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] } \ 'header': ['fg', 'Comment'] }
let g:fzf_layout = { 'down': '~40%' } let g:fzf_layout = { 'down': '~50%' }
let g:fzf_preview_window = 'right:60%' let g:fzf_preview_window = 'right:60%'
" gitgutter " gitgutter
set updatetime=1000 set updatetime=1000
" NERDTree
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" emmet-vim " emmet-vim
let g:user_emmet_mode='a' let g:user_emmet_mode='a'
let g:user_emmet_leader_key=',' let g:user_emmet_leader_key=','
@ -169,8 +155,9 @@ if (executable('typescript-language-server'))
\ 'whitelist': ['javascript', 'javascript.jsx', 'javascriptreact'] \ 'whitelist': ['javascript', 'javascript.jsx', 'javascriptreact']
\ }) \ })
augroup END augroup END
endif endif
" for C/C++ language server
if (executable('ccls')) if (executable('ccls'))
augroup LspCpp augroup LspCpp
autocmd! autocmd!
@ -184,8 +171,7 @@ if (executable('ccls'))
augroup END augroup END
endif endif
" for golang language server " for Go language server
if executable('gopls') if executable('gopls')
au User lsp_setup call lsp#register_server({ au User lsp_setup call lsp#register_server({
\ 'name': 'gopls', \ 'name': 'gopls',
@ -204,8 +190,8 @@ if executable('go-langserver')
autocmd BufWritePre *.go LspDocumentFormatSync autocmd BufWritePre *.go LspDocumentFormatSync
endif endif
let g:lsp_diagnostics_enabled = 1 let g:lsp_diagnostics_enabled = 1
let g:lsp_signs_enabled = 1 let g:lsp_signs_enabled = 1
let g:lsp_diagnostics_echo_cursor = 1 let g:lsp_diagnostics_echo_cursor = 1
let g:lsp_highlights_enabled = 0 let g:lsp_highlights_enabled = 0
let g:lsp_textprop_enabled = 0 let g:lsp_textprop_enabled = 0
@ -216,7 +202,7 @@ let g:lsp_highlight_references_enabled = 1
let g:AutoPairs={'(':')', '[':']', '{':'}', "'":"'", '"':'"', "`":"`", '```':'```', '"""':'"""', "'''":"'''"} "'<':'>', let g:AutoPairs={'(':')', '[':']', '{':'}', "'":"'", '"':'"', "`":"`", '```':'```', '"""':'"""', "'''":"'''"} "'<':'>',
" LaTeX " LaTeX
let g:livepreview_previewer = 'mupdf' let g:livepreview_previewer = 'zathura'
" Enable "Rainbow Parentheses Improved" " Enable "Rainbow Parentheses Improved"
let g:rainbow_active = 1 let g:rainbow_active = 1
@ -230,5 +216,3 @@ augroup END
" python syntax " python syntax
let g:python_highlight_all = 1 let g:python_highlight_all = 1

View File

@ -5,25 +5,25 @@
function! Mode(mode) " {{{ function! Mode(mode) " {{{
" normal mode " normal mode
if a:mode == 'n' if a:mode == 'n'
return ' normal ' return ' '
" insert mode " insert mode
elseif a:mode == 'i' elseif a:mode == 'i'
return ' insert ' return ' '
" replace mode " replace mode
elseif a:mode == 'R' elseif a:mode == 'R'
return ' replace ' return ' '
" visual mode " visual mode
elseif a:mode == 'v' elseif a:mode == 'v'
return ' visual ' return ' '
" visual block mode " visual block mode
elseif a:mode == '' elseif a:mode == ''
return ' v-block ' return ' '
" command mode " command mode
elseif a:mode == 'c' elseif a:mode == 'c'
return ' command ' return ' '
" terminal mode " terminal mode
elseif a:mode == 't' elseif a:mode == 't'
return ' terminal ' return ' '
endif endif
" Return empty string so as not to display anything in the statusline " Return empty string so as not to display anything in the statusline
return ' ' return ' '
@ -34,11 +34,10 @@ endfunction
function! SetModifiedSymbol(modified) " {{{ function! SetModifiedSymbol(modified) " {{{
if a:modified == 1 if a:modified == 1
hi MyStatuslineModifiedBody ctermbg=NONE cterm=NONE ctermfg=3 hi MyStatuslineModifiedBody ctermbg=NONE cterm=NONE ctermfg=3
return ' (+) '
else else
hi MyStatuslineModifiedBody ctermbg=NONE cterm=bold ctermfg=7 hi MyStatuslineModifiedBody ctermbg=NONE cterm=bold ctermfg=8
return ' '
endif endif
return ' '
endfunction endfunction
" }}} " }}}
@ -52,25 +51,16 @@ function! SetFiletype(filetype) " {{{
endfunction endfunction
" }}} " }}}
set statusline=%#MyStatuslineSeparator#\ \ set statusline=%#MyStatuslineSeparator#\ "
set statusline+=%{Mode(mode())} set statusline+=%{Mode(mode())}
" filename set statusline+=%#MyStatuslineSeparator#\ "
set statusline+=%#MyStatuslineSeparator#\ \
set statusline+=%#MyStatuslineFilename#%t
set statusline+=%#MyStatuslineSeparator#\ \
" Modified status
set statusline+=%#MyStatuslineModifiedBody#%{SetModifiedSymbol(&modified)}%#Reset#
set statusline+=%=
set statusline+=%{FugitiveStatusline()}
set statusline+=%#MyStatuslineSeparator#\ \
set statusline+=%#MyStatuslineLineCol# set statusline+=%#MyStatuslineLineCol#
set statusline+=%l,%c set statusline+=%l,%c
set statusline+=%#MyStatuslineSeparator#\ \
" set statusline+=%<%f\ %h%m%r%{FugitiveStatusline()}%=%-14.(%l,%c%V%)\ %P set statusline+=%=
set statusline+=%#MyStatuslineSeparator#\ \
set statusline+=\%#MyStatuslineFiletype#%{SetFiletype(&filetype)} set statusline+=\%#MyStatuslineFiletype#%{SetFiletype(&filetype)}
set statusline+=%#MyStatuslineSeparator#\ \ "
set statusline+=%#MyStatuslineFilename#%t
set statusline+=%#MyStatuslineSeparator#\ \ "
set statusline+=%#MyStatuslineModifiedBody#%{SetModifiedSymbol(&modified)}%#Reset#