diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-09-28 01:17:06 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-09-28 01:17:06 +0200 |
commit | b7a7a40ff171aa2e6b7db87736f2c9f777aa464b (patch) | |
tree | 01242468532d6c2ebfd7183caaac9d42f7545d34 /after | |
parent | 68636ef01a9c3c758379d25dc85d68d649a156e2 (diff) |
added snippets and changed the keybinds
Also removed luasnip source for completion
Diffstat (limited to 'after')
-rw-r--r-- | after/plugin/luasnip.lua | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/after/plugin/luasnip.lua b/after/plugin/luasnip.lua index e882168..9943ba3 100644 --- a/after/plugin/luasnip.lua +++ b/after/plugin/luasnip.lua @@ -5,15 +5,17 @@ local t = ls.text_node local map = vim.keymap.set -map("i", "<C-k>", function() +map("i", "<C-h>", function() if ls.expand_or_locally_jumpable() then ls.expand_or_jump() end end, { silent = true }) -map({ "i", "s" }, "<C-J>", function() - ls.locally_jumpable(-1) -end, { silent = true }) map({ "i", "s" }, "<C-l>", function() + if ls.locally_jumpable(-1) then + ls.jump(-1) + end +end, { silent = true }) +map({ "i", "s" }, "<C-c>", function() if ls.choice_active() then ls.change_choice(1) end @@ -26,6 +28,14 @@ ls.config.set_config({ history = true, }) --- ls.add_snippets("all", { --- ls.parser.parse_snippet("expand", "-- this is $1 expanded $2 $3!"), --- }) +ls.add_snippets("all", { + ls.parser.parse_snippet("test", "$1->$2->$3->$0\n"), +}) +ls.add_snippets("go", { + ls.parser.parse_snippet("main", "package main\n\nfunc main() {\n\t$0\n}"), + ls.parser.parse_snippet("e", "if err != nil {\n\t$1\n}\n$0"), + ls.parser.parse_snippet("ep", "if err != nil {\n\tpanic(err)\n}\n$0"), + ls.parser.parse_snippet("eif", "if err := $1; err != nil {\n\tpanic(err)\n}\n$0"), + ls.parser.parse_snippet("pf", "fmt.Printf($0)"), + ls.parser.parse_snippet("pl", "fmt.Println($0)"), +}) |