feat(nvim): use formatter.nvim for goimports
This commit is contained in:
parent
711d82fc2b
commit
1893905c4f
|
@ -29,8 +29,7 @@ nnoremap <silent> ds :GoDebugStep<cr>
|
|||
|
||||
" Vim-Go configuration
|
||||
let g:go_gopls_enabled = 0
|
||||
let g:go_fmt_autosave = 1
|
||||
let g:go_fmt_command = "goimports"
|
||||
let g:go_fmt_autosave = 0
|
||||
let g:go_imports_autosave = 0
|
||||
let g:go_textobj_enabled = 0
|
||||
let g:go_auto_sameids = 0
|
||||
|
@ -43,8 +42,6 @@ let g:go_highlight_diagnostic_errors = 0
|
|||
let g:go_highlight_diagnostic_warnings = 0
|
||||
let g:go_highlight_trailing_whitespace_error=0
|
||||
|
||||
let g:go_fmt_command = 'goimports'
|
||||
|
||||
" g:go_statusline_duration doesn't seem to work accurately, but does help
|
||||
" reduce the time the build/test success messages are shown in the status
|
||||
" line.
|
||||
|
|
|
@ -6,12 +6,20 @@ local prettier = function()
|
|||
}
|
||||
end
|
||||
|
||||
local goimports = function()
|
||||
return {
|
||||
exe = "goimports",
|
||||
stdin = true,
|
||||
}
|
||||
end
|
||||
|
||||
require("formatter").setup({
|
||||
log_level = vim.log.levels.INFO,
|
||||
filetype = {
|
||||
javascript = { prettier },
|
||||
typescript = { prettier },
|
||||
typescriptreact = { prettier },
|
||||
go = { goimports },
|
||||
|
||||
-- https://github.com/JohnnyMorganz/StyLua
|
||||
-- cargo install stylua --features lua54
|
||||
|
@ -26,7 +34,7 @@ vim.api.nvim_exec2(
|
|||
[[
|
||||
augroup FormatAutogroup
|
||||
autocmd!
|
||||
autocmd BufWritePost *.js,*.ts,*.tsx,*.lua silent FormatWrite
|
||||
autocmd BufWritePost *.js,*.ts,*.tsx,*.go,*.lua silent FormatWrite
|
||||
augroup END
|
||||
]],
|
||||
{ output = true }
|
||||
|
|
Loading…
Reference in New Issue