From: Georgios Atheridis Date: Mon, 6 Jun 2022 11:54:34 +0000 (+0300) Subject: fixed format bug X-Git-Url: https://git.atheridis.org/?a=commitdiff_plain;h=5804e92736e4d20669ea1313f3f4c74bfc59ddb0;p=configs%2Fneovim.git fixed format bug --- diff --git a/nvim/lua/nvim/lsp/handlers.lua b/nvim/lua/nvim/lsp/handlers.lua index 64d1e5f..53110e7 100644 --- a/nvim/lua/nvim/lsp/handlers.lua +++ b/nvim/lua/nvim/lsp/handlers.lua @@ -82,6 +82,12 @@ local function lsp_keymaps(bufnr) vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", 'lua vim.diagnostic.goto_next({ border = "rounded" })', opts) vim.api.nvim_buf_set_keymap(bufnr, "n", "q", "lua vim.diagnostic.setloclist()", opts) vim.cmd([[ command! Format execute 'lua vim.lsp.buf.formatting()' ]]) + vim.cmd([[ + augroup FormatOnSave + autocmd! + autocmd BufWritePre * :Format + augroup END + ]]) end M.on_attach = function(client, bufnr) diff --git a/nvim/lua/nvim/options.lua b/nvim/lua/nvim/options.lua index 42276bc..a88a855 100644 --- a/nvim/lua/nvim/options.lua +++ b/nvim/lua/nvim/options.lua @@ -51,10 +51,3 @@ vim.cmd([[ autocmd BufWritePre *.html :normal mZgg=G`Z:delmarks Z augroup END ]]) - -vim.cmd([[ - augroup FormatOnSave - autocmd! - autocmd BufWritePre * :Format - augroup END -]])