nvim: Drop dependency on vim-airline
Use a custom status line and buftabline. Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
c880a370d4
commit
8af9c11813
2 changed files with 90 additions and 25 deletions
|
@ -12,8 +12,8 @@ Plug 'haya14busa/incsearch-easymotion.vim'
|
|||
Plug 'junegunn/fzf.vim'
|
||||
" Remove extraneous whitespace when edit mode is exited
|
||||
Plug 'axelf4/vim-strip-trailing-whitespace'
|
||||
" Status bar mods
|
||||
Plug 'vim-airline/vim-airline'
|
||||
" Tabline
|
||||
Plug 'ap/vim-buftabline'
|
||||
" Manage Project sessions
|
||||
Plug 'thaerkh/vim-workspace'
|
||||
" Commenter
|
||||
|
@ -185,9 +185,6 @@ set completeopt=menu,noselect,preview,noinsert
|
|||
set sessionoptions-=blank
|
||||
set grepprg=rg\ --vimgrep
|
||||
|
||||
" Theme
|
||||
colorscheme gruvbox8_hard
|
||||
|
||||
" --------------------------- Key Bindings -----------------------------------
|
||||
" Remap escape keys to something usable on home row
|
||||
inoremap jk <Esc>
|
||||
|
@ -399,26 +396,6 @@ augroup ResizeWindowsProportionally
|
|||
augroup END
|
||||
|
||||
" --------------------------- Plugin settings --------------------------------
|
||||
" Use airline
|
||||
let g:airline#extensions#keymap#enabled = 0
|
||||
let g:airline#extensions#whitespace#enabled = 0
|
||||
let g:airline#extensions#wordcount#enabled = 0
|
||||
let g:airline#extensions#term#enabled = 0
|
||||
let g:airline#extensions#tabline#enabled = 1
|
||||
let g:airline#extensions#tabline#fnamemod = ':t'
|
||||
let g:airline#extensions#tabline#left_sep = ' '
|
||||
let g:airline#extensions#tabline#left_alt_sep = '|'
|
||||
let g:airline#extensions#tabline#right_sep = ' '
|
||||
let g:airline#extensions#tabline#right_alt_sep = '|'
|
||||
let g:airline#extensions#tabline#formatter = 'default'
|
||||
let g:airline#extensions#tabline#buffer_nr_show = 1
|
||||
let g:airline_left_sep = ' '
|
||||
let g:airline_left_alt_sep = '|'
|
||||
let g:airline_right_sep = ' '
|
||||
let g:airline_right_alt_sep = '|'
|
||||
let g:airline_section_y = '%{winnr()}'
|
||||
let g:airline_highlighting_cache = 1
|
||||
|
||||
" Let vim-gitgutter do its thing on large files
|
||||
let g:gitgutter_max_signs=1000
|
||||
let g:gitgutter_map_keys = 0
|
||||
|
@ -512,6 +489,11 @@ let g:grepper.prompt = 0
|
|||
" Easymotion incsearch
|
||||
let g:incsearch#auto_nohlsearch = 1
|
||||
|
||||
" Buftabline
|
||||
let g:buftabline_plug_max = 0
|
||||
let g:buftabline_numbers = 1
|
||||
let g:buftabline_indicators = 1
|
||||
|
||||
" Deoplete
|
||||
let g:deoplete#enable_at_startup = 0
|
||||
let g:deoplete#sources#rust#disable_keymap = 1
|
||||
|
|
83
nvim/.config/nvim/plugin/statusline.vim
Normal file
83
nvim/.config/nvim/plugin/statusline.vim
Normal file
|
@ -0,0 +1,83 @@
|
|||
augroup UserStatusline
|
||||
autocmd!
|
||||
autocmd BufEnter,WinEnter,TermOpen * setlocal statusline=%!ActiveStatus()
|
||||
autocmd WinLeave * setlocal statusline=%!PassiveStatus()
|
||||
augroup END
|
||||
|
||||
augroup UserStatusLineColors
|
||||
autocmd!
|
||||
autocmd ColorScheme *
|
||||
\ hi User1 guifg=DarkRed guibg=Black |
|
||||
\ hi User2 guifg=White guibg=Black |
|
||||
\ hi User3 guifg=Cyan guibg=Black |
|
||||
\ hi User4 guifg=Orange guibg=Black |
|
||||
\ hi User5 guifg=Red guibg=Black |
|
||||
\ hi User6 guifg=Gray guibg=Black |
|
||||
\ hi User7 guifg=Gray guibg=Black |
|
||||
\ hi User8 guifg=DarkYellow guibg=Black
|
||||
augroup END
|
||||
|
||||
function! GitInfo()
|
||||
let git = fugitive#head()
|
||||
if git != ''
|
||||
return ' '.fugitive#head()
|
||||
else
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
" https://nest.pijul.com/tae/setup:master/
|
||||
function! GetCursorPosition()
|
||||
if &buftype == ''
|
||||
let l:position = getcurpos()
|
||||
return l:position[1] . 'Ⲷ ' . l:position[2] . 'Ⲽ'
|
||||
endif
|
||||
|
||||
return &buftype ==# 'quickfix'
|
||||
\ ? line('.') . '/' . line('$')
|
||||
\ : ''
|
||||
endfunction
|
||||
|
||||
function! GetFileDir()
|
||||
if &buftype != ''
|
||||
return ''
|
||||
endif
|
||||
|
||||
if &filetype ==# 'gitcommit'
|
||||
return 'New commit on '
|
||||
endif
|
||||
|
||||
if &filetype ==# 'gitrebase'
|
||||
return 'Interactive rebase on '
|
||||
endif
|
||||
|
||||
let l:path = expand('%:h')
|
||||
return len(l:path) > 0 ? l:path : ''
|
||||
endfunction
|
||||
|
||||
function! ActiveStatus() abort
|
||||
let statusline=""
|
||||
let statusline.="%1*\ %{winnr()}\ "
|
||||
let statusline.="%2*\ %{GitInfo()}"
|
||||
let statusline.="%2*\ %Y\ "
|
||||
let statusline.="%3*%<%{GetFileDir()}"
|
||||
let statusline.="%="
|
||||
let statusline.="%4*\ %{GetCursorPosition()}\ (%3p%%)"
|
||||
return statusline
|
||||
endfunction
|
||||
|
||||
function! PassiveStatus() abort
|
||||
let statusline=""
|
||||
let statusline.="%5*\ %{winnr()}\ "
|
||||
let statusline.="%6*\ %{GitInfo()}"
|
||||
let statusline.="%6*\ %Y\ "
|
||||
let statusline.="%7*%<%{GetFileDir()}"
|
||||
let statusline.="%="
|
||||
let statusline.="%8*\ %{GetCursorPosition()}\ (%3p%%)"
|
||||
return statusline
|
||||
endfunction
|
||||
|
||||
set statusline=%!ActiveStatus()
|
||||
" The colorscheme needs to be set here as it seems the autocmd group handling
|
||||
" color scheme must always be defined before the colorscheme is set else the
|
||||
" custom highlighting color groups for status line do not seem to take effect.
|
||||
colorscheme gruvbox8_hard
|
Loading…
Reference in a new issue