formatter
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"copilot.vim": { "branch": "release", "commit": "49e0348bfb913fae63ca5ddb987a8bccd193da86" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "3a93300c076109d86c7ce35ec67a8034ae6ba9db" },
|
||||
"formatter.nvim": { "branch": "master", "commit": "cb4778b8432f1ae86dae4634c0b611cb269a4c2f" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "69a2c1675b66e002799f5eef803b87a12f593049" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "4aaacbf5e5e2218fd05eb75703fe9e0f85335803" },
|
||||
"go.nvim": { "branch": "master", "commit": "24d2fa373d55d9900cd4b502a88214dc17e6fab6" },
|
||||
@@ -18,10 +20,12 @@
|
||||
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "566b7036f717f3d676362742630518a47f132fff" },
|
||||
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "3ba1b92b771f33256b4969d696b82c8ae7075364" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e110bc3be1a7309617cecd77bfe4bf86ba1b8134" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
|
||||
"nvim-lint": { "branch": "master", "commit": "b32127ba52f3a1f7dc86773c2ca3f0029afa12c1" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "042aa6b27b8b8d4f4e1bd42de2037c83d676a8a0" },
|
||||
"nvim-tmux-navigation": { "branch": "main", "commit": "d9efffa413a530bdea3783af4fea86be84940283" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "4a4dbe1cb1da34d87fc42a40aaf8e218af4cfe0f" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "19a91a38b02c1c28c14e0ba468d20ae1423c39b2" },
|
||||
|
||||
@@ -40,4 +40,4 @@ vim.o.wrap = true
|
||||
vim.o.linebreak = true
|
||||
vim.o.breakindent = true
|
||||
vim.o.showbreak = "↳ "
|
||||
vim.opt_local.columns = 144
|
||||
-- vim.opt_local.columns = 144
|
||||
|
||||
41
.config/nvim/lua/lilJ/lazy/conform.lua
Normal file
41
.config/nvim/lua/lilJ/lazy/conform.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
return {
|
||||
|
||||
"stevearc/conform.nvim",
|
||||
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
|
||||
config = function()
|
||||
local conform = require("conform")
|
||||
|
||||
conform.setup({
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
javascript = { "prettierd", "prettier" },
|
||||
typescript = { "prettierd", "prettier" },
|
||||
javascriptreact = { "prettierd", "prettier" },
|
||||
typescriptreact = { "prettierd", "prettier" },
|
||||
json = { "prettierd", "prettier" },
|
||||
markdown = { "prettierd", "prettier" },
|
||||
html = { "htmlbeautifier" },
|
||||
css = { "prettierd", "prettier" },
|
||||
python = { "flake8" },
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "ff", function()
|
||||
conform.format({
|
||||
lsp_fallback = true,
|
||||
async = false,
|
||||
timeout_ms = 500,
|
||||
})
|
||||
end, { desc = "Format file or range (in visual mode)" })
|
||||
|
||||
vim.api.nvim_buf_create_user_command(0, "ConformFormat", function()
|
||||
conform.format({
|
||||
lsp_fallback = true,
|
||||
async = false,
|
||||
timeout_ms = 500,
|
||||
})
|
||||
end, {})
|
||||
end,
|
||||
}
|
||||
@@ -10,10 +10,10 @@ return {
|
||||
local lint = require("lint")
|
||||
|
||||
lint.linters_by_ft = {
|
||||
javascript = { "eslint_d" },
|
||||
typescript = { "eslint_d" },
|
||||
javascriptreact = { "eslint_d" },
|
||||
typescriptreact = { "eslint_d" },
|
||||
javascript = { "eslint_d" },
|
||||
javascriptreact = { "eslint" },
|
||||
typescriptreact = { "eslint" },
|
||||
python = { "flake8" },
|
||||
}
|
||||
|
||||
@@ -22,5 +22,9 @@ return {
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_buf_create_user_command(0, "Lint", function()
|
||||
lint.try_lint()
|
||||
end, {})
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -77,28 +77,6 @@ return {
|
||||
group = format_go,
|
||||
})
|
||||
|
||||
local format_auto = vim.api.nvim_create_augroup("FormatAutocmd", {})
|
||||
vim.api.nvim_buf_create_user_command(0, 'Format', function(_)
|
||||
if vim.lsp.buf.format then
|
||||
vim.lsp.buf.format()
|
||||
elseif vim.lsp.buf.formatting then
|
||||
vim.lsp.buf.formatting()
|
||||
end
|
||||
end, {})
|
||||
|
||||
-- NOTE: This is useful for auto-formatting on save, but I don't like it so Imma use Format command insetead
|
||||
--[[ vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = "*",
|
||||
callback = function(_)
|
||||
if vim.lsp.buf.format then
|
||||
vim.lsp.buf.format()
|
||||
elseif vim.lsp.buf.formatting then
|
||||
vim.lsp.buf.formatting()
|
||||
end
|
||||
end,
|
||||
group = format_auto,
|
||||
}) ]]
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = cmp_lsp.default_capabilities(capabilities)
|
||||
|
||||
@@ -108,7 +86,7 @@ return {
|
||||
"cssls",
|
||||
"gopls",
|
||||
"html",
|
||||
"prismals",
|
||||
"java_language_server",
|
||||
"pyright",
|
||||
"tailwindcss",
|
||||
"tsserver",
|
||||
|
||||
Reference in New Issue
Block a user