neovim

Personal neovim configuration files
git clone git://gtms.dev/neovim
Log | Files | Refs

go.lua (794B)


      1 vim.bo.makeprg = [[go run %]]
      2 
      3 vim.lsp.start(require 'tms.lsp'.make_opts('gopls'))
      4 
      5 -- vim.cmd [[command! -buffer -nargs=? Godoc lua require('tms.ft.go.doc').godoc(vim.fn.expand('<args>'), vim.fn.expand('<cword>'))]]
      6 vim.api.nvim_create_autocmd('BufWritePre',
      7   {
      8     callback = require 'tms.ft.go'.org_imports,
      9     buffer = 0,
     10     desc = 'Go Organize Imports',
     11   }
     12 )
     13 
     14 vim.keymap.set('n', '<leader>ao', require 'tms.ft.go'.org_imports, { buffer = true, desc = 'Go Organize Imports' })
     15 vim.keymap.set('n', '<leader>ar', ':make<cr>', { buffer = true })
     16 vim.keymap.set('n', '<leader>at', ':GoTest<cr>', { buffer = true })
     17 
     18 vim.api.nvim_buf_create_user_command(0, 'GoTest', function()
     19   local tmp = vim.bo.makeprg
     20   vim.bo.makeprg = 'go test ./...'
     21   vim.cmd.make()
     22   vim.bo.makeprg = tmp
     23 end, {})