summary refs log tree commit diff
path: root/.vim/after/ftplugin/go.lua
blob: 94eaa0ee7eb5d0850d009e5504e6a8acd6af62b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- vim.opt.shiftwidth = 4

vim.keymap.set('n', '<leader>i', function()
  local iface = vim.fn.input('Impl: ')
  if not iface or iface == '' then
    return
  end
  require('misc').word_under_cursor(function(word)
    vim.cmd('normal ][o')
    local args = {
      'impl',
      '-dir',
      vim.fn.expand('%:h:p'),
      '"' .. string.lower(word:sub(0, 1)) .. ' *' .. word .. '"',
      iface,
    }
    vim.cmd('r!' .. table.concat(args, ' '))
  end)
end)