diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-07 15:45:02 +0200 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-07 17:26:26 +0200 |
| commit | 2ec8ea6f06e9a307f0ef03f323efb21d3cfbe558 (patch) | |
| tree | 091de276906cb46fdf6cf2a5035d4f2d7fe580c7 | |
| parent | d348c9693d182780a76eab98d67ae0c08e154090 (diff) | |
| download | dotfiles-2ec8ea6f06e9a307f0ef03f323efb21d3cfbe558.tar.gz dotfiles-2ec8ea6f06e9a307f0ef03f323efb21d3cfbe558.zip | |
misc(nvim): add key mappings for jumping between snippets
| -rw-r--r-- | .config/nvim/plugin/50-completion.lua | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/.config/nvim/plugin/50-completion.lua b/.config/nvim/plugin/50-completion.lua index fe418e8..caf749d 100644 --- a/.config/nvim/plugin/50-completion.lua +++ b/.config/nvim/plugin/50-completion.lua @@ -27,6 +27,14 @@ vim.keymap.set("i", "<S-Tab>", function() return vim.fn.pumvisible() == 1 and "<C-p>" or "<S-Tab>" end, { expr = true }) +-- Jump between snippet placeholders, falling back to native behavior when no snippet is active +vim.keymap.set({ "i", "s" }, "<C-n>", function() + return vim.snippet.active({ direction = 1 }) and "<Cmd>lua vim.snippet.jump(1)<CR>" or "<C-n>" +end, { expr = true }) +vim.keymap.set({ "i", "s" }, "<C-p>", function() + return vim.snippet.active({ direction = -1 }) and "<Cmd>lua vim.snippet.jump(-1)<CR>" or "<C-p>" +end, { expr = true }) + ------------------------------------------------------------------------------------------------------------------------ -- Command-line mode completion ------------------------------------------------------------------------------------------------------------------------ |
