vis-config
lua scripts to configure vis editor
git clone https://9o.is/git/vis-config.git
commit 78fa7edc28785ddb6b87340821f24794baca385c parent 06764931cb49c0e1ea1a6bf8572419200338de4c Author: Jul <jul@9o.is> Date: Fri, 20 Feb 2026 22:53:27 +0800 avoid screen flicker on K (man) that doesn't exist Diffstat:
| M | lib/utils.lua | | | 6 | +++--- |
| M | visrc.lua | | | 7 | +++++-- |
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/lib/utils.lua b/lib/utils.lua @@ -1,9 +1,9 @@ -function exists(prog) - return os.execute('type ' .. prog .. ' >/dev/null 2>&1') +function runq(cmd) + return os.execute(cmd .. ' >/dev/null 2>&1') end function start_lspc(lspc, name) - if not (lspc.enabled and exists(name)) then + if not (lspc.enabled and runq('type '..name)) then return false end diff --git a/visrc.lua b/visrc.lua @@ -88,10 +88,13 @@ settings = { vis:command('set ctags-autosave on') mapwin(win, {m.NORMAL, m.VISUAL}, 'K', function() - local sec = vis.count or 1 + local sec = vis.count local name = content(vis.win) vis.count = nil - vis:command(string.format('terminal man %d %s', sec, name)) + + if runq(string.format('whatis %s %s', sec and '-s '..sec or '', name)) then + vis:command(string.format('terminal man %s %s', sec or '', name)) + end end, 'Man') end end,