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"]
|
[submodule "pack/general/start/playground"]
|
||||||
path = pack/general/start/playground
|
path = pack/general/start/playground
|
||||||
url = https://github.com/nvim-treesitter/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,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
---- formatter.nvim ----
|
---- conform.nvim ----
|
||||||
require("formatter").setup({
|
require("conform").setup({
|
||||||
filetype = {
|
format_on_save = {
|
||||||
terraform = {
|
-- These options will be passed to conform.format()
|
||||||
require("formatter.filetypes.terraform").terraformfmt,
|
timeout_ms = 500,
|
||||||
},
|
lsp_format = "fallback",
|
||||||
},
|
|
||||||
["*"] = {
|
|
||||||
-- "formatter.filetypes.any" defines default configurations for any
|
|
||||||
-- filetype
|
|
||||||
require("formatter.filetypes.any").remove_trailing_whitespace,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -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_prev)
|
||||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
|
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
|
||||||
vim.keymap.set("n", "<Leader>q", vim.diagnostic.setloclist)
|
vim.keymap.set("n", "<Leader>q", vim.diagnostic.setloclist)
|
||||||
vim.keymap.set("n", "<F3>", function()
|
-- vim.keymap.segcjk("n", "<F3>", function()
|
||||||
vim.lsp.buf.format({ async = true })
|
-- vim.lsp.buf.format({ async = true })
|
||||||
end)
|
-- end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||||
|
|
@ -416,26 +411,26 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Auto format on save
|
-- -- Auto format on save
|
||||||
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
-- vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||||
callback = function()
|
-- callback = function()
|
||||||
if vim.b.disable_format then
|
-- if vim.b.disable_format then
|
||||||
return
|
-- return
|
||||||
end
|
-- end
|
||||||
local lsp_format = false
|
-- local lsp_format = false
|
||||||
for _, client in pairs(vim.lsp.buf_get_clients()) do
|
-- for _, client in pairs(vim.lsp.get_clients()) do
|
||||||
if client.server_capabilities.documentFormattingProvider then
|
-- if client.server_capabilities.documentFormattingProvider then
|
||||||
lsp_format = true
|
-- lsp_format = true
|
||||||
break
|
-- break
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
if lsp_format then
|
-- if lsp_format then
|
||||||
vim.lsp.buf.format({ async = false })
|
-- vim.lsp.buf.format({ async = false })
|
||||||
else
|
-- else
|
||||||
vim.cmd("Format")
|
-- vim.cmd("Format")
|
||||||
end
|
-- end
|
||||||
end,
|
-- end,
|
||||||
})
|
-- })
|
||||||
|
|
||||||
---- nvim-lint ----
|
---- nvim-lint ----
|
||||||
local lint = require("lint")
|
local lint = require("lint")
|
||||||
|
|
@ -680,7 +675,7 @@ vim.api.nvim_create_autocmd({ "BufEnter" }, {
|
||||||
vim.cmd("packadd crates.nvim")
|
vim.cmd("packadd crates.nvim")
|
||||||
|
|
||||||
local crates = require("crates")
|
local crates = require("crates")
|
||||||
crates.setup()
|
crates.setup({})
|
||||||
vim.keymap.set("n", "<leader>cv", crates.show_versions_popup)
|
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>cf", crates.show_features_popup)
|
||||||
vim.keymap.set("n", "<leader>cd", crates.show_dependencies_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