diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-05-04 21:50:57 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-05-04 21:50:57 +0200 |
commit | 7671090a24afd3271a1505927468430c7b3012e1 (patch) | |
tree | 7aa3a4d68829fffece2e1762f8886e1df578458a /modules/by-name/nv | |
parent | modules/nvim/plgs/nvim-cmp: Unify key mappings by moving to the global module (diff) | |
download | nixos-config-7671090a24afd3271a1505927468430c7b3012e1.zip |
modules/nvim/plgs/luasnip: Provide key mappings
These make jumping through snippets possible
Diffstat (limited to 'modules/by-name/nv')
-rw-r--r-- | modules/by-name/nv/nvim/plgs/luasnip/default.nix | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/modules/by-name/nv/nvim/plgs/luasnip/default.nix b/modules/by-name/nv/nvim/plgs/luasnip/default.nix index e7c006a6..8e445d40 100644 --- a/modules/by-name/nv/nvim/plgs/luasnip/default.nix +++ b/modules/by-name/nv/nvim/plgs/luasnip/default.nix @@ -16,6 +16,62 @@ cfg = config.soispha.programs.nvim; in { home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + keymaps = [ + { + key = "<C-K>"; + mode = ["i"]; + action.__raw = '' + function() + require('luasnip').expand() + end + ''; + options = { + # silent = true; + desc = "Expand the snippet"; + }; + } + { + key = "<C-L>"; + mode = ["i" "s"]; + action.__raw = '' + function() + require('luasnip').jump(1) + end + ''; + options = { + # silent = true; + desc = "Jump forward in snippet insert nodes"; + }; + } + { + key = "<C-J>"; + mode = ["i" "s"]; + action.__raw = '' + function() + require('luasnip').jump(-1) + end + ''; + options = { + # silent = true; + desc = "Jump backwards in snippet insert nodes"; + }; + } + { + key = "<C-E>"; + mode = ["i" "s"]; + action.__raw = '' + function() + if require('luasnip').choice_active() then + require('luasnip').change_choice(1) + end + end + ''; + options = { + # silent = true; + desc = "Cycle through the snippets choice nodes"; + }; + } + ]; plugins.luasnip = { enable = true; |