From 29f31de8d3879383ce45dbe4598feca0792b86cf Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Tue, 26 Dec 2023 21:59:20 -0600 Subject: feat: add go support --- lua/plugins/gopher.lua | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lua/plugins/gopher.lua diff --git a/lua/plugins/gopher.lua b/lua/plugins/gopher.lua new file mode 100644 index 0000000..ade6eaf --- /dev/null +++ b/lua/plugins/gopher.lua @@ -0,0 +1,38 @@ +return { + 'olexsmir/gopher.nvim', + enabled = true, + ft = "go", + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-treesitter/nvim-treesitter', + -- DAP capabilities + 'mfussenegger/nvim-dap', + }, + config = function(_, opts) + -- Some dependencies need to be installed with GoInstallDeps: + -- gomodifytags + -- impl + -- gotests + -- iferr + -- I just installed them with mason, it would be easier to install + -- them here with mason, but my config is already a mess + + require('gopher').setup(opts) + require('gopher.dap').setup() + + local nmap = function(keys, func, desc) + if desc then + desc = 'GO: ' .. desc + end + vim.keymap.set('n', keys, func, { desc = desc }) + end + + nmap('gsa', ':GoTagAdd', '[s]truct tag [a]dd') + nmap('gsr', ':GoTagRm', '[s]truct tag [r]m') + nmap('gii', ':GoImpl', '[i]mplement [i]nterface') + nmap('gie', 'GoIfErr', 'generate [i]f [e]rr') + nmap('gta', ':GoTestAdd', '[t]est [a]dd') + nmap('gts', 'GoTestsAll', '[t]est[s] add all') + nmap('gte', 'GoTestsExp', '[t]ests add [e]xported') + end, +} -- cgit v1.2.3-70-g09d2