diff options
Diffstat (limited to 'after')
-rw-r--r-- | after/ftplugin/sh.lua | 3 | ||||
-rw-r--r-- | after/plugin/luasnip.lua | 12 |
2 files changed, 9 insertions, 6 deletions
diff --git a/after/ftplugin/sh.lua b/after/ftplugin/sh.lua new file mode 100644 index 0000000..2cb8493 --- /dev/null +++ b/after/ftplugin/sh.lua @@ -0,0 +1,3 @@ +local map = vim.keymap.set + +map("n", ",v", [[<cmd>s/\(\s*\)\(.\+\)/\1"$(\2)"/<cr>]]) diff --git a/after/plugin/luasnip.lua b/after/plugin/luasnip.lua index 3a64f9a..c7ee31b 100644 --- a/after/plugin/luasnip.lua +++ b/after/plugin/luasnip.lua @@ -25,14 +25,14 @@ ls.config.set_config({ history = true, }) -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("e", "if err != nil {\n\tfmt.Println(err)$1\n}\n$0"), + ls.parser.parse_snippet("ee", "if err != nil {\n\tfmt.Println(err)$1\n\tos.Exit(${2:1})\n}\n$0"), + ls.parser.parse_snippet("eif", "if err := $1; err != nil {\n\tfmt.Println(err)$2\n}\n$0"), ls.parser.parse_snippet("pf", "fmt.Printf($0)"), ls.parser.parse_snippet("pl", "fmt.Println($0)"), }) +ls.add_snippets("sh", { + ls.parser.parse_snippet("!", "#!/bin/sh\n$0"), +}) |