colorcolumn window leave/enter functions improved

This commit is contained in:
ManjaroOne666 2019-03-30 17:26:43 +00:00
parent 550f7bec28
commit 6b9cfb620d
2 changed files with 17 additions and 8 deletions

View File

@ -7,5 +7,7 @@ set textwidth=79
set foldmethod=indent set foldmethod=indent
set foldnestmax=1 set foldnestmax=1
set colorcolumn=88
nnoremap <silent> <buffer> <F5> :call SaveAndExecute('python')<CR> 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)))") 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
View File

@ -831,12 +831,20 @@ map <space>ra :call RangerExplorer()<CR>
endif endif
"}}} "}}}
function! SetColorColumn() abort"{{{ function! WinEnterColorColumn() abort"{{{
if &buftype == '' if &buftype != ''
setlocal colorcolumn=80,120 setlocal colorcolumn=0
elseif exists('b:colorcolumn_restore')
execute 'setlocal colorcolumn=' . b:colorcolumn_restore
endif endif
endfunction endfunction
"}}}
function! WinLeaveColorColumn() abort"{{{
let b:colorcolumn_restore = &colorcolumn
setlocal colorcolumn=0
endfunction
"}}} "}}}
function! GetLinterStatus(key) abort "{{{ function! GetLinterStatus(key) abort "{{{
@ -1323,12 +1331,11 @@ iabbrev ct'' content-type: '';
if g:vimrc_auto_window_settings if g:vimrc_auto_window_settings
augroup auto_window_settings augroup auto_window_settings
autocmd! autocmd!
autocmd WinEnter * call SetColorColumn() autocmd WinEnter * call WinEnterColorColumn()
autocmd WinEnter * set cursorline | set cursorcolumn 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 autocmd WinLeave * set nocursorline | set nocursorcolumn
endif
augroup END augroup END
endif endif