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