feat(go): organise imports on save
This commit is contained in:
parent
f1046c2a1f
commit
2893ebee96
4 changed files with 12 additions and 5 deletions
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
|||
.PHONY: backup clean update install_packer package publish
|
||||
.PHONY: backup clean update install_lazy package publish
|
||||
|
||||
backup:
|
||||
@bash ./.helpers/config backup
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
require("options")
|
||||
require("plugins")
|
||||
require("keymappings")
|
||||
require("autocommands")
|
||||
|
|
6
nvim/lua/autocommands.lua
Normal file
6
nvim/lua/autocommands.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
pattern = '*.go',
|
||||
callback = function()
|
||||
vim.lsp.buf.code_action({ context = { only = { 'source.organizeImports' } }, apply = true })
|
||||
end
|
||||
})
|
|
@ -72,8 +72,8 @@ lspconfig.golangci_lint_ls.setup{
|
|||
-- Jsonnet
|
||||
lspconfig.jsonnet_ls.setup{
|
||||
on_attach = custom_attach,
|
||||
cmd = {"jsonnet-language-server", "--lint"},
|
||||
flags = lsp_flags,
|
||||
cmd = {"jsonnet-language-server", "--lint"},
|
||||
flags = lsp_flags,
|
||||
}
|
||||
|
||||
-- Terraform
|
||||
|
@ -82,7 +82,7 @@ lspconfig.terraformls.setup{
|
|||
cmd = {"terraform-ls", "serve", "-log-file="..log_directory.."/terraformls.log"},
|
||||
filetypes = {"terraform", "hcl", "tf"},
|
||||
root_dir = lspconfig.util.root_pattern{".terraform", ".git", "main.tf"},
|
||||
flags = lsp_flags,
|
||||
flags = lsp_flags,
|
||||
}
|
||||
|
||||
-- Python
|
||||
|
@ -90,7 +90,7 @@ lspconfig.pylsp.setup{
|
|||
on_attach = custom_attach,
|
||||
cmd = { "pylsp" },
|
||||
filetypes = { "python" },
|
||||
flags = lsp_flags,
|
||||
flags = lsp_flags,
|
||||
}
|
||||
|
||||
-- Lua
|
||||
|
|
Loading…
Reference in a new issue