Make vim Zenmode toggleable
This commit is contained in:
parent
ce5408975e
commit
6f48b4119d
1 changed files with 22 additions and 6 deletions
|
@ -1,10 +1,26 @@
|
||||||
|
function s:loadState(state)
|
||||||
|
for name in keys(a:state)
|
||||||
|
exec "let" name.'="'.a:state[name].'"'
|
||||||
|
endfor
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function s:dumpState(state)
|
||||||
|
let l:newstate = {}
|
||||||
|
for name in keys(a:state)
|
||||||
|
exec "let l:newstate[\"".name."\"]=".name
|
||||||
|
endfor
|
||||||
|
return l:newstate
|
||||||
|
endfun
|
||||||
|
|
||||||
|
let s:state = { "&number": "0", "&relativenumber": "0", "&colorcolumn": "0", "&laststatus": "0", "&fillchars": "eob:\\ " }
|
||||||
|
|
||||||
function Zen()
|
function Zen()
|
||||||
set nonumber
|
if exists("g:zenState")
|
||||||
set norelativenumber
|
call s:loadState(g:zenState)
|
||||||
set colorcolumn=0
|
unlet g:zenState
|
||||||
set laststatus=0
|
else
|
||||||
if has("nvim")
|
let g:zenState = s:dumpState(s:state)
|
||||||
set fillchars=eob:\
|
call s:loadState(s:state)
|
||||||
end
|
end
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue