ray-x / lsp_signature.nvim

LSP signature hint as you type
Apache License 2.0
1.98k stars 53 forks source link

How to trigger GoFmt command on save? #297

Closed lightbluepoppy closed 7 months ago

lightbluepoppy commented 7 months ago

Currently, these lines of code is not enough to run GoFmt on save which runs golines which formats long lines of code.


local format_sync_grp = vim.api.nvim_create_augroup("GoFormat", {})
vim.api.nvim_create_autocmd("BufWritePre", {
    pattern = "*.go",
    callback = function()
        require('go.format').goimport()
    end,
    group = format_sync_grp,
})

require('go').setup({
    max_line_len = 80, -- max line length in golines format, Target maximum line length for golines
})

How is it possible to run GoFmt command on save?