Created
August 2, 2021 15:55
-
-
Save muniter/5f304b4e4dbb81465b58e3a0d6135978 to your computer and use it in GitHub Desktop.
Completion su mode in lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------ Completion ^X submode mappings | |
M._my_completion_mappings = function () | |
--@note: Function that sets mappings to workaround completeopt="noselect" | |
--this allows for actually selecting the first entry when using <C-x> | |
--submodes, and therefore easier chaining <C-x><C-n> brcomes | |
--<C-x><C-n><C-n> | |
if string.match(vim.o.completeopt, "noselect") == nil then return end | |
local modes= {"l", "n", "k", "t", "i", "]", "f", "d", "v", "u", "o", "s", "p"} | |
for _, mode in pairs(modes) do | |
local map = string.format("<C-x><C-%s>", mode) | |
local remap = string.format("<C-x><C-%s><C-%s>", mode, mode) | |
gmap('i', map, remap, opts) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment