add autocomplete:cycle
Some (probably lots) of people are used to tabbing through autocomplete. now, tab is binded to autocomplete:cycle while enter is binded to autocomplete:complete.
This commit is contained in:
parent
51f27e47ca
commit
1a21c66353
|
@ -502,6 +502,11 @@ command.add(predicate, {
|
||||||
suggestions_idx = math.min(suggestions_idx + 1, #suggestions)
|
suggestions_idx = math.min(suggestions_idx + 1, #suggestions)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
["autocomplete:cycle"] = function()
|
||||||
|
local newidx = suggestions_idx + 1
|
||||||
|
suggestions_idx = newidx > #suggestions and 1 or newidx
|
||||||
|
end,
|
||||||
|
|
||||||
["autocomplete:cancel"] = function()
|
["autocomplete:cancel"] = function()
|
||||||
reset_suggestions()
|
reset_suggestions()
|
||||||
end,
|
end,
|
||||||
|
@ -511,9 +516,11 @@ command.add(predicate, {
|
||||||
-- Keymaps
|
-- Keymaps
|
||||||
--
|
--
|
||||||
keymap.add {
|
keymap.add {
|
||||||
["tab"] = "autocomplete:complete",
|
["return"] = "autocomplete:complete",
|
||||||
|
["keypad enter"] = "autocomplete:complete",
|
||||||
["up"] = "autocomplete:previous",
|
["up"] = "autocomplete:previous",
|
||||||
["down"] = "autocomplete:next",
|
["down"] = "autocomplete:next",
|
||||||
|
["tab"] = "autocomplete:cycle",
|
||||||
["escape"] = "autocomplete:cancel",
|
["escape"] = "autocomplete:cancel",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue