diff --git a/lua/autocmds.lua b/lua/autocmds.lua index d799ae8..7b78f3c 100644 --- a/lua/autocmds.lua +++ b/lua/autocmds.lua @@ -70,16 +70,6 @@ function Toggleln() end end ----- trim whitespace on save -autocmd("BufWritePre", { - pattern = "*", - callback = function() - vim.cmd([[:%s/\s\+$//e]]) - end, - once = false, - group = _group, -}) - -- change tmux title autocmd("BufReadPost", { pattern = "*", @@ -150,6 +140,3 @@ autocmd('BufUnload', { vim.opt.cmdheight = 1 end, }) - --- syntax fix -vim.cmd("syntax sync fromstart") diff --git a/lua/lsp_settings.lua b/lua/lsp_settings.lua index e41b539..d63a12b 100644 --- a/lua/lsp_settings.lua +++ b/lua/lsp_settings.lua @@ -15,6 +15,7 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer local on_attach = function(client, bufnr) + vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]] -- Enable completion triggered by vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') if client.server_capabilities.colorProvider then diff --git a/lua/plugins.lua b/lua/plugins.lua index f2e0c16..624a697 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -30,20 +30,19 @@ return require('packer').startup({ function(use) use 'ray-x/guihua.lua' - use { - 'ray-x/go.nvim', - ft = { "go" }, + use 'ctrlpvim/ctrlp.vim' + + use({ + 'fatih/vim-go', config = function() - require("go").setup({ - max_line_len = 120, - tag_transform = false, - test_dir = '', - comment_placeholder = '  ', - lsp_cfg = true, -- false: use your own lspconfig - dap_debug = true, - }) + vim.g.go_fmt_command = "gofumpt" + vim.g.go_highlight_types = 1 + vim.g.go_highlight_fields = 1 + vim.g.go_highlight_functions = 1 + vim.g.go_highlight_function_calls = 1 + vim.g.go_auto_type_info = 1 end - } + }) -- obsession use 'tpope/vim-obsession'