colorcolumn window leave/enter functions improved
This commit is contained in:
parent
550f7bec28
commit
6b9cfb620d
|
@ -7,5 +7,7 @@ set textwidth=79
|
|||
set foldmethod=indent
|
||||
set foldnestmax=1
|
||||
|
||||
set colorcolumn=88
|
||||
|
||||
nnoremap <silent> <buffer> <F5> :call SaveAndExecute('python')<CR>
|
||||
command! CTagsPython !ctags -R --fields=+l --languages=python --python-kinds=-iv -f ./.tags-py $(python -c "import os, sys; print(' '.join('{}'.format(d) for d in sys.path if os.path.isdir(d)))")
|
||||
|
|
21
vimrc
21
vimrc
|
@ -831,12 +831,20 @@ map <space>ra :call RangerExplorer()<CR>
|
|||
endif
|
||||
|
||||
"}}}
|
||||
function! SetColorColumn() abort"{{{
|
||||
if &buftype == ''
|
||||
setlocal colorcolumn=80,120
|
||||
function! WinEnterColorColumn() abort"{{{
|
||||
if &buftype != ''
|
||||
setlocal colorcolumn=0
|
||||
elseif exists('b:colorcolumn_restore')
|
||||
execute 'setlocal colorcolumn=' . b:colorcolumn_restore
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"}}}
|
||||
function! WinLeaveColorColumn() abort"{{{
|
||||
let b:colorcolumn_restore = &colorcolumn
|
||||
setlocal colorcolumn=0
|
||||
endfunction
|
||||
|
||||
"}}}
|
||||
function! GetLinterStatus(key) abort "{{{
|
||||
|
||||
|
@ -1323,12 +1331,11 @@ iabbrev ct'' content-type: '';
|
|||
if g:vimrc_auto_window_settings
|
||||
augroup auto_window_settings
|
||||
autocmd!
|
||||
autocmd WinEnter * call SetColorColumn()
|
||||
autocmd WinEnter * call WinEnterColorColumn()
|
||||
autocmd WinEnter * set cursorline | set cursorcolumn
|
||||
if exists('##CmdLineEnter')
|
||||
autocmd WinLeave * setlocal colorcolumn=0
|
||||
" autocmd WinLeave * setlocal colorcolumn=0
|
||||
autocmd WinLeave * call WinLeaveColorColumn()
|
||||
autocmd WinLeave * set nocursorline | set nocursorcolumn
|
||||
endif
|
||||
augroup END
|
||||
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue