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
|
@ -10,7 +10,7 @@ local RootView = require "core.rootview"
|
||||||
local DocView = require "core.docview"
|
local DocView = require "core.docview"
|
||||||
local Doc = require "core.doc"
|
local Doc = require "core.doc"
|
||||||
|
|
||||||
config.plugins.autocomplete = {
|
config.plugins.autocomplete = {
|
||||||
-- Amount of characters that need to be written for autocomplete
|
-- Amount of characters that need to be written for autocomplete
|
||||||
min_len = 3,
|
min_len = 3,
|
||||||
-- The max amount of visible items
|
-- The max amount of visible items
|
||||||
|
@ -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