neovim: add mappings to jump between choice in snippets
This commit is contained in:
@@ -58,20 +58,13 @@ cmp.setup({
|
|||||||
}),
|
}),
|
||||||
["<A-j>"] = cmp.mapping.scroll_docs(4),
|
["<A-j>"] = cmp.mapping.scroll_docs(4),
|
||||||
["<A-k>"] = cmp.mapping.scroll_docs(-4),
|
["<A-k>"] = cmp.mapping.scroll_docs(-4),
|
||||||
["<C-l>"] = cmp.mapping(function(fallback)
|
["<C-f>"] = cmp.mapping(function(fallback)
|
||||||
if ls.expand_or_jumpable() then
|
if ls.expand_or_jumpable() then
|
||||||
ls.expand_or_jump()
|
ls.expand_or_jump()
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end),
|
end),
|
||||||
["<C-h>"] = cmp.mapping(function(fallback)
|
|
||||||
if ls.jumpable(-1) then
|
|
||||||
ls.jump(-1)
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end),
|
|
||||||
},
|
},
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
local ts = require("telescope.builtin")
|
local ts = require("telescope.builtin")
|
||||||
local u = require("daniil.utils")
|
local u = require("daniil.utils")
|
||||||
local git = require("daniil.git")
|
local git = require("daniil.git")
|
||||||
|
local ls = require("luasnip")
|
||||||
|
|
||||||
-- General keymaps
|
-- General keymaps
|
||||||
vim.keymap.set("n", "<C-c>", ":nohl<CR>")
|
vim.keymap.set("n", "<C-c>", ":nohl<CR>")
|
||||||
@@ -109,3 +110,19 @@ vim.keymap.set("n", "<leader>gg", ":G<CR>")
|
|||||||
vim.keymap.set("n", "<leader>go", function()
|
vim.keymap.set("n", "<leader>go", function()
|
||||||
git.open_commit_on_github()
|
git.open_commit_on_github()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- Luasnip
|
||||||
|
local function next_choice()
|
||||||
|
if ls.jumpable(1) then
|
||||||
|
ls.jump(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function prev_choice()
|
||||||
|
if ls.jumpable(-1) then
|
||||||
|
ls.jump(-1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.keymap.set("i", "<C-l>", next_choice, { noremap = true, silent = true })
|
||||||
|
vim.keymap.set("s", "<C-l>", next_choice, { noremap = true, silent = true })
|
||||||
|
vim.keymap.set("i", "<C-h>", prev_choice, { noremap = true, silent = true })
|
||||||
|
vim.keymap.set("s", "<C-h>", prev_choice, { noremap = true, silent = true })
|
||||||
|
|||||||
Reference in New Issue
Block a user