nvim/init.auto-window.vim

35 lines
789 B
VimL
Raw Permalink Normal View History

"auto_window_settings {{{
2020-08-01 11:08:43 +00:00
function! OnWinEnter() abort"{{{
if &buftype != ''
setlocal colorcolumn=0
elseif exists('b:colorcolumn_restore')
execute 'setlocal colorcolumn=' . b:colorcolumn_restore
endif
2020-08-01 11:08:43 +00:00
if &buftype == 'terminal'
setlocal nonumber norelativenumber
else
setlocal number relativenumber
endif
setlocal cursorline
setlocal cursorcolumn
endfunction
"}}}
2020-08-01 11:08:43 +00:00
function! OnWinLeave() abort"{{{
let b:colorcolumn_restore = &colorcolumn
setlocal colorcolumn=0
2020-08-01 11:08:43 +00:00
setlocal nocursorline
setlocal nocursorcolumn
setlocal norelativenumber
endfunction
"}}}
augroup auto_window_settings "{{{
autocmd!
2020-08-01 11:08:43 +00:00
autocmd WinEnter * call OnWinEnter()
autocmd WinLeave * call OnWinLeave()
augroup END
"}}} augroup auto_window_settings
" }}} auto_window_settings