Let escape in normal mode clear counts

This commit is contained in:
Felix Van der Jeugt 2019-12-07 00:06:27 +01:00
parent 74d2a15176
commit eca5a75996
No known key found for this signature in database
GPG Key ID: 58B209295023754D

View File

@ -19,20 +19,25 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win)
vis:command('set number') vis:command('set number')
end) end)
vis:map(vis.modes.NORMAL, "<Escape>", function()
if vis.count then
vis.count = nil
else
vis:feedkeys"<vis-selections-remove-all>"
end
end)
vis:command_register("fzf", function(argv, force, cur_win, selection, range) vis:command_register("fzf", function(argv, force, cur_win, selection, range)
local out = io.popen("fzf"):read() local out = io.popen("fzf"):read()
--local out = io.popen("fzf " .. table.concat(argv, " ")):read()
if out then if out then
if argv[1] then if argv[1] then
vis:command(string.format('e "%s"', out)) vis:command(string.format('e "%s"', out))
-- or vis:command(string.format('open %s', out))
-- should e return false when failed
else else
vis:command(string.format('open "%s"', out)) vis:command(string.format('open "%s"', out))
end end
vis:feedkeys("<vis-redraw>") vis:feedkeys("<vis-redraw>")
end end
end) end, 'fuzzy file search')
vis:map(vis.modes.NORMAL, ";l", function() vis:map(vis.modes.NORMAL, ";l", function()
vis:command('fzf') vis:command('fzf')