nvim/ftplugin/go.lua
Jeremie Fraeys 02e26b00b7
Some checks are pending
Check Lua Formatting in MyRepo / Stylua Check (push) Waiting to run
chore(nvim): reinitialize with working config
2026-02-07 21:06:45 -05:00

35 lines
961 B
Lua

-- Set buffer-local options for Go files
vim.bo.expandtab = true -- Use spaces instead of tabs
vim.opt_local.shiftwidth = 4 -- Indent width
vim.opt_local.tabstop = 4 -- Tab width
vim.opt_local.softtabstop = 4 -- Soft tab width for alignment
vim.bo.commentstring = '// %s' -- Comment format for Go
vim.opt_local.comments = 's1:/*,mb:*,ex:*/,://'
-- Define a buffer-local key mapping to trigger Go debugging
vim.keymap.set('n', '<leader>dd', function()
require('dap-go').debug_test()
end, { buffer = 0, desc = 'Debug Go Test' }) -- Buffer-local key mapping
-- Load nvim-dap-go and set up configurations
require('dap-go').setup()
-- Go DAP configuration
local dap = require('dap')
-- Define Go DAP configurations
dap.configurations.go = {
{
type = 'go',
name = 'Launch File',
request = 'launch',
program = '${file}',
},
{
type = 'go',
name = 'Launch Package',
request = 'launch',
program = '${workspaceFolder}',
},
}