ToggleColorPreview - use buffer local variables not global

This commit is contained in:
ManjaroOne666 2018-04-18 13:06:20 +01:00
parent 185d046855
commit 5d862fb200
1 changed files with 6 additions and 4 deletions

View File

@ -314,14 +314,16 @@ nnoremap <space>cc :call ToggleColorPreview()<CR>
nnoremap <space>ci :ColorVInsert<CR>
nnoremap <space>cp :ColorVPicker<CR>
let g:colorv_is_previewing = 0
function! ToggleColorPreview() abort
if g:colorv_is_previewing == 0
if !exists('b:colorv_is_previewing')
let b:colorv_is_previewing = 0
endif
if b:colorv_is_previewing == 0
execute 'ColorVPreview'
let g:colorv_is_previewing = 1
let b:colorv_is_previewing = 1
else
execute 'ColorVClear'
let g:colorv_is_previewing = 0
let b:colorv_is_previewing = 0
endif
endfunction
"}}}