feat(lsp): added opts.autoformat to be able to disable autoformat by default. Fixes #65
This commit is contained in:
2 files changed
+5
-2
No files matched your search
@@ -6,8 +6,6 @@ local Util = require("lazyvim.util")
|
|||||||
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||||
vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||||
|
|
||||||
-- FIXME: document all keymaps
|
|
||||||
|
|
||||||
-- Move to window using the <ctrl> hjkl keys
|
-- Move to window using the <ctrl> hjkl keys
|
||||||
vim.keymap.set("n", "<C-h>", "<C-w>h", { desc = "Go to left window" })
|
vim.keymap.set("n", "<C-h>", "<C-w>h", { desc = "Go to left window" })
|
||||||
vim.keymap.set("n", "<C-j>", "<C-w>j", { desc = "Go to lower window" })
|
vim.keymap.set("n", "<C-j>", "<C-w>j", { desc = "Go to lower window" })
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ return {
|
|||||||
virtual_text = { spacing = 4, prefix = "●" },
|
virtual_text = { spacing = 4, prefix = "●" },
|
||||||
severity_sort = true,
|
severity_sort = true,
|
||||||
},
|
},
|
||||||
|
-- Automatically format on save
|
||||||
|
autoformat = true,
|
||||||
-- options for vim.lsp.buf.format
|
-- options for vim.lsp.buf.format
|
||||||
-- `bufnr` and `filter` is handled by the LazyVim formatter,
|
-- `bufnr` and `filter` is handled by the LazyVim formatter,
|
||||||
-- but can be also overriden when specified
|
-- but can be also overriden when specified
|
||||||
@@ -64,6 +66,9 @@ return {
|
|||||||
require("lazyvim.util").deprecate("lspconfig.setup_server", "lspconfig.opts.setup[SERVER]")
|
require("lazyvim.util").deprecate("lspconfig.setup_server", "lspconfig.opts.setup[SERVER]")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- setup autoformat
|
||||||
|
require("lazyvim.plugins.lsp.format").autoformat = opts.autoformat
|
||||||
|
|
||||||
-- setup formatting and keymaps
|
-- setup formatting and keymaps
|
||||||
require("lazyvim.util").on_attach(function(client, buffer)
|
require("lazyvim.util").on_attach(function(client, buffer)
|
||||||
require("lazyvim.plugins.lsp.format").on_attach(client, buffer)
|
require("lazyvim.plugins.lsp.format").on_attach(client, buffer)
|
||||||
|
|||||||
Reference in new issue
Block a user