Vim sign column toggle -
when signs defined in vim, column appears @ left of screen.
from vim help:
when signs defined file, vim automatically add column of two
characters display them in. when last sign unplaced column
disappears again.
is possible remove column whilst there still signs defined?
ideally toggle column on / off.
well, need unplace signs current buffer have them not displayed. recent vims (e.g. newer thane 7.3.596) can use :sign unplace *
.
you can take plugin https://github.com/chrisbra/savesigns.vim save signs temporary file (which in fact create vim script, able replace signs. using plugin can write custom function toggle displaying signs.
something might work you:
fu! mysignstoggle() if !has("signs") || empty(bufname('')) return endif if !exists("s:signfile") let s:signfile = tempname().'_' endif redir =>a|exe "sil sign place buffer=".bufnr('')|redir end let signs = split(a, "\n")[1:] if !empty(signs) let bufnr = bufnr('') exe ":sil savesigns!" s:signfile.bufnr('') if bufnr('') != bufnr exe "noa wq" endif sign unplace * elseif filereadable(s:signfile.bufnr('')) exe "so" s:signfile.bufnr('') call delete(s:signfile.bufnr('')) endif endfu
Comments
Post a Comment