summaryrefslogtreecommitdiff
path: root/lua/plugins
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2023-12-26 21:59:20 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2023-12-26 21:59:20 -0600
commit29f31de8d3879383ce45dbe4598feca0792b86cf (patch)
tree75abb6176c327f664a78db1b49090adf7b0586fc /lua/plugins
parent6be7eadac14b7366b45cc9cec4d322e9205477f7 (diff)
feat: add go support
Diffstat (limited to 'lua/plugins')
-rw-r--r--lua/plugins/gopher.lua38
1 files changed, 38 insertions, 0 deletions
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('<leader>gsa', ':GoTagAdd<Space>', '[s]truct tag [a]dd')
+ nmap('<leader>gsr', ':GoTagRm<Space>', '[s]truct tag [r]m')
+ nmap('<leader>gii', ':GoImpl<Space>', '[i]mplement [i]nterface')
+ nmap('<leader>gie', '<CMD>GoIfErr<CR>', 'generate [i]f [e]rr')
+ nmap('<leader>gta', ':GoTestAdd<Space>', '[t]est [a]dd')
+ nmap('<leader>gts', '<CMD>GoTestsAll<CR>', '[t]est[s] add all')
+ nmap('<leader>gte', '<CMD>GoTestsExp<CR>', '[t]ests add [e]xported')
+ end,
+}