diff --git a/lua/lsp/go.lua b/lua/lsp/go.lua index 52f4616..4b7eef4 100644 --- a/lua/lsp/go.lua +++ b/lua/lsp/go.lua @@ -7,5 +7,12 @@ return { G.cmd [[resize 10]] G.cmd [[startinsert]] end, {}) + G.api.nvim_create_user_command('Rgin', function() + G.cmd [[set splitbelow]] + G.cmd [[sp]] + G.cmd [[term go run ./main.go]] + G.cmd [[resize 10]] + G.cmd [[startinsert]] + end, {}) end } diff --git a/snippets/go.json b/snippets/go.json index a15ef67..471e898 100644 --- a/snippets/go.json +++ b/snippets/go.json @@ -2,5 +2,13 @@ "class": { "prefix": "class", "body": "type $1 struct{$2}\n$0" + }, + "err": { + "prefix": "err", + "body": [ + "if err != nil {", + " panic(err)$1", + "}" + ] } }