added conform
This commit is contained in:
22
after/plugin/conform.lua
Normal file
22
after/plugin/conform.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
local conform = require("conform")
|
||||
conform.setup({
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
c = { "clang_format" },
|
||||
cs = { "csharpier" },
|
||||
javascript = { { "prettierd", "prettier" } },
|
||||
rust = { "rustfmt" },
|
||||
},
|
||||
})
|
||||
|
||||
conform.formatters.clang_format = {
|
||||
args = { "--style", "{IndentWidth: 4, UseTab: Always, TabWidth: 4}" },
|
||||
}
|
||||
|
||||
conform.formatters.rustfmt = {
|
||||
args = { "--edition", "2021" },
|
||||
}
|
||||
|
||||
vim.keymap.set("n", "<leader>f", function()
|
||||
conform.format({ bufnr = vim.lsp.bufnr })
|
||||
end)
|
||||
@@ -72,4 +72,8 @@ return require('packer').startup(function(use)
|
||||
'folke/trouble.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' }
|
||||
}
|
||||
|
||||
use({
|
||||
'stevearc/conform.nvim'
|
||||
})
|
||||
end)
|
||||
|
||||
@@ -24,7 +24,6 @@ vim.keymap.set("i", "<C-c>", "<Esc>")
|
||||
|
||||
vim.keymap.set("n", "Q", "<nop>")
|
||||
vim.keymap.set("n", "<C-f>", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
|
||||
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
|
||||
|
||||
-- vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
|
||||
-- vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
|
||||
|
||||
@@ -114,6 +114,11 @@ _G.packer_plugins = {
|
||||
path = "/home/j409/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||
url = "https://github.com/hrsh7th/cmp-path"
|
||||
},
|
||||
["conform.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/j409/.local/share/nvim/site/pack/packer/start/conform.nvim",
|
||||
url = "https://github.com/stevearc/conform.nvim"
|
||||
},
|
||||
harpoon = {
|
||||
loaded = true,
|
||||
path = "/home/j409/.local/share/nvim/site/pack/packer/start/harpoon",
|
||||
|
||||
Reference in New Issue
Block a user