From 0dad71d5b7eb6e9a0adf6de9752ef355287b6731 Mon Sep 17 00:00:00 2001 From: swy7ch Date: Wed, 13 May 2020 15:54:07 +0200 Subject: [PATCH] cleanup: [nvim] statusline config + update buffer mappings --- .config/nvim/init.vim | 31 +++++++++++++++---------------- .config/nvim/statusline.vim | 36 ++++++++++++++++++------------------ 2 files changed, 33 insertions(+), 34 deletions(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index ebdebb2..63bbb3e 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -106,20 +106,6 @@ set termguicolors " Colorscheme colorscheme polyjuice -" Statusline -set noshowmode -source $XDG_CONFIG_HOME/nvim/statusline.vim - -augroup statusline - autocmd! - autocmd VimEnter * - \ call UpdateInactiveWindows() - autocmd VimEnter,WinEnter,BufWinEnter * - \ call RefreshStatusLine('active') - autocmd WinLeave * - \ call RefreshStatusLine('inactive') -augroup END - "" Text, tab and indent """""""""""""""""""""""""""""""""""""""""""""""""" " Do not use spaces instead of tabs @@ -153,6 +139,19 @@ autocmd BufWritePre * %s/\s\+$//e """"""""""""""""""""""""""""""""""""""""""""""""""" "Always show the status line set laststatus=2 +set noshowmode + +source $XDG_CONFIG_HOME/nvim/statusline.vim + +augroup statusline + autocmd! + autocmd VimEnter * + \ call UpdateInactiveWindows() + autocmd VimEnter,WinEnter,BufWinEnter * + \ call RefreshStatusLine('active') + autocmd WinLeave * + \ call RefreshStatusLine('inactive') +augroup END "" Macros """""""""""""""""""""""""""""""""""""""""""""""""" @@ -160,8 +159,8 @@ set laststatus=2 noremap s :source ~/.config/nvim/init.vim " Circle through buffers -noremap n :bn -noremap p :bp +noremap n :bn +noremap p :bp " Clear the search highlight noremap q :nohl diff --git a/.config/nvim/statusline.vim b/.config/nvim/statusline.vim index b1d091b..4ae88fd 100644 --- a/.config/nvim/statusline.vim +++ b/.config/nvim/statusline.vim @@ -1,14 +1,14 @@ function! CurrentMode() let g:currentmode={ - \ 'n' : '[ NORMAL ]', - \ 'v' : '[ VISUAL ]', - \ 'V' : '[ V·LINE ]', - \ '' : '[ V·BLOCK ]', - \ 'i' : '[ INSERT ]', - \ 'R' : '[ REPLACE ]', - \ 'Rv' : '[ V·REPLACE ]', - \ 'c' : '[ COMMAND ]', - \} + \ 'n' : '[ NORMAL ]', + \ 'v' : '[ VISUAL ]', + \ 'V' : '[ V·LINE ]', + \ '' : '[ V·BLOCK ]', + \ 'i' : '[ INSERT ]', + \ 'R' : '[ REPLACE ]', + \ 'Rv' : '[ V·REPLACE ]', + \ 'c' : '[ COMMAND ]', + \} return g:currentmode[mode()] endfunction @@ -16,15 +16,15 @@ endfunction function! ModeColor() let g:modecolor={ - \ 'n' : '%#NormalMode#', - \ 'v' : '%#VisualMode#', - \ 'V' : '%#VisualMode#', - \ '' : '%#VisualMode#', - \ 'i' : '%#InsertMode#', - \ 'R' : '%#ReplaceMode#', - \ 'Rv' : '%#ReplaceMode#', - \ 'c' : '%#CommandMode#', - \} + \ 'n' : '%#NormalMode#', + \ 'v' : '%#VisualMode#', + \ 'V' : '%#VisualMode#', + \ '' : '%#VisualMode#', + \ 'i' : '%#InsertMode#', + \ 'R' : '%#ReplaceMode#', + \ 'Rv' : '%#ReplaceMode#', + \ 'c' : '%#CommandMode#', + \} return g:modecolor[mode()] endfunction