conform: initial config
This commit is contained in:
parent
0b5e0531b6
commit
2927afe3e2
3 changed files with 34 additions and 35 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -149,3 +149,6 @@
|
|||
[submodule "pack/general/start/playground"]
|
||||
path = pack/general/start/playground
|
||||
url = https://github.com/nvim-treesitter/playground
|
||||
[submodule "pack/general/start/conform.nvim"]
|
||||
path = pack/general/start/conform.nvim
|
||||
url = https://github.com/stevearc/conform.nvim
|
||||
|
|
|
|||
65
init.lua
65
init.lua
|
|
@ -221,17 +221,12 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
|
|||
end,
|
||||
})
|
||||
|
||||
---- formatter.nvim ----
|
||||
require("formatter").setup({
|
||||
filetype = {
|
||||
terraform = {
|
||||
require("formatter.filetypes.terraform").terraformfmt,
|
||||
},
|
||||
},
|
||||
["*"] = {
|
||||
-- "formatter.filetypes.any" defines default configurations for any
|
||||
-- filetype
|
||||
require("formatter.filetypes.any").remove_trailing_whitespace,
|
||||
---- conform.nvim ----
|
||||
require("conform").setup({
|
||||
format_on_save = {
|
||||
-- These options will be passed to conform.format()
|
||||
timeout_ms = 500,
|
||||
lsp_format = "fallback",
|
||||
},
|
||||
})
|
||||
|
||||
|
|
@ -332,9 +327,9 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
|
|||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
|
||||
vim.keymap.set("n", "<Leader>q", vim.diagnostic.setloclist)
|
||||
vim.keymap.set("n", "<F3>", function()
|
||||
vim.lsp.buf.format({ async = true })
|
||||
end)
|
||||
-- vim.keymap.segcjk("n", "<F3>", function()
|
||||
-- vim.lsp.buf.format({ async = true })
|
||||
-- end)
|
||||
end
|
||||
|
||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||
|
|
@ -416,26 +411,26 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
|
|||
end,
|
||||
})
|
||||
|
||||
-- Auto format on save
|
||||
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||
callback = function()
|
||||
if vim.b.disable_format then
|
||||
return
|
||||
end
|
||||
local lsp_format = false
|
||||
for _, client in pairs(vim.lsp.buf_get_clients()) do
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
lsp_format = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if lsp_format then
|
||||
vim.lsp.buf.format({ async = false })
|
||||
else
|
||||
vim.cmd("Format")
|
||||
end
|
||||
end,
|
||||
})
|
||||
-- -- Auto format on save
|
||||
-- vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||
-- callback = function()
|
||||
-- if vim.b.disable_format then
|
||||
-- return
|
||||
-- end
|
||||
-- local lsp_format = false
|
||||
-- for _, client in pairs(vim.lsp.get_clients()) do
|
||||
-- if client.server_capabilities.documentFormattingProvider then
|
||||
-- lsp_format = true
|
||||
-- break
|
||||
-- end
|
||||
-- end
|
||||
-- if lsp_format then
|
||||
-- vim.lsp.buf.format({ async = false })
|
||||
-- else
|
||||
-- vim.cmd("Format")
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
---- nvim-lint ----
|
||||
local lint = require("lint")
|
||||
|
|
@ -680,7 +675,7 @@ vim.api.nvim_create_autocmd({ "BufEnter" }, {
|
|||
vim.cmd("packadd crates.nvim")
|
||||
|
||||
local crates = require("crates")
|
||||
crates.setup()
|
||||
crates.setup({})
|
||||
vim.keymap.set("n", "<leader>cv", crates.show_versions_popup)
|
||||
vim.keymap.set("n", "<leader>cf", crates.show_features_popup)
|
||||
vim.keymap.set("n", "<leader>cd", crates.show_dependencies_popup)
|
||||
|
|
|
|||
1
pack/general/start/conform.nvim
Submodule
1
pack/general/start/conform.nvim
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 9a06e83527407a7600a2fe4e0d10adf432b6215e
|
||||
Loading…
Add table
Reference in a new issue