2020-03-19 16:17:53 +00:00
|
|
|
"auto_window_settings {{{
|
2020-08-01 11:08:43 +00:00
|
|
|
function! OnWinEnter() abort"{{{
|
2020-03-19 16:17:53 +00:00
|
|
|
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
|
2020-03-19 16:17:53 +00:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
"}}}
|
2020-08-01 11:08:43 +00:00
|
|
|
function! OnWinLeave() abort"{{{
|
2020-03-19 16:17:53 +00:00
|
|
|
let b:colorcolumn_restore = &colorcolumn
|
|
|
|
setlocal colorcolumn=0
|
2020-08-01 11:08:43 +00:00
|
|
|
setlocal nocursorline
|
|
|
|
setlocal nocursorcolumn
|
|
|
|
setlocal norelativenumber
|
2020-03-19 16:17:53 +00:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
"}}}
|
|
|
|
augroup auto_window_settings "{{{
|
|
|
|
autocmd!
|
2020-08-01 11:08:43 +00:00
|
|
|
autocmd WinEnter * call OnWinEnter()
|
|
|
|
autocmd WinLeave * call OnWinLeave()
|
2020-03-19 16:17:53 +00:00
|
|
|
augroup END
|
|
|
|
"}}} augroup auto_window_settings
|
|
|
|
" }}} auto_window_settings
|
|
|
|
|