fixes/improvements

This commit is contained in:
Ray Elliott 2020-08-01 12:08:43 +01:00
parent c3fd2d2d3b
commit 8301d70c31
1 changed files with 14 additions and 7 deletions

View File

@ -1,26 +1,33 @@
"auto_window_settings {{{
function! WinEnterColorColumn() abort"{{{
function! OnWinEnter() abort"{{{
if &buftype != ''
setlocal colorcolumn=0
elseif exists('b:colorcolumn_restore')
execute 'setlocal colorcolumn=' . b:colorcolumn_restore
endif
if &buftype == 'terminal'
setlocal nonumber norelativenumber
else
setlocal number relativenumber
endif
setlocal cursorline
setlocal cursorcolumn
endfunction
"}}}
function! WinLeaveColorColumn() abort"{{{
function! OnWinLeave() abort"{{{
let b:colorcolumn_restore = &colorcolumn
setlocal colorcolumn=0
setlocal nocursorline
setlocal nocursorcolumn
setlocal norelativenumber
endfunction
"}}}
augroup auto_window_settings "{{{
autocmd!
autocmd WinEnter * call WinEnterColorColumn()
autocmd WinEnter * set cursorline | set cursorcolumn
" autocmd WinLeave * setlocal colorcolumn=0
autocmd WinLeave * call WinLeaveColorColumn()
autocmd WinLeave * set nocursorline | set nocursorcolumn
autocmd WinEnter * call OnWinEnter()
autocmd WinLeave * call OnWinLeave()
augroup END
"}}} augroup auto_window_settings
" }}} auto_window_settings