droped none-ls
This commit is contained in:
1 parent
c3d41436a1
commit
847238c1bc
17 files changed
+590
-604
No files matched your search
+61
-57
@@ -1,63 +1,67 @@
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
enabled = false,
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
local conform = require("conform")
|
||||
'stevearc/conform.nvim',
|
||||
enabled = true,
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
config = function()
|
||||
local conform = require('conform')
|
||||
|
||||
conform.setup({
|
||||
formatters_by_ft = {
|
||||
cpp = { "clang-format" },
|
||||
c = { "clang-format" },
|
||||
javascript = { "prettier" },
|
||||
typescript = { "prettier" },
|
||||
javascriptreact = { "prettier", "biome" },
|
||||
typescriptreact = { "prettier" },
|
||||
css = { "prettier" },
|
||||
html = { "prettier" },
|
||||
json = { "prettier" },
|
||||
markdown = { "markdownlint", "prettier" },
|
||||
lua = { "stylua" },
|
||||
python = { "isort", "black" },
|
||||
php = { "php-cs-fixer" },
|
||||
java = { "google-java-formatter", "trivy" },
|
||||
graphql = { "prettier" },
|
||||
},
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable with a global or buffer-local variable
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
return
|
||||
end
|
||||
return {
|
||||
lsp_fallback = true,
|
||||
async = false,
|
||||
timeout_ms = 500,
|
||||
}
|
||||
end,
|
||||
})
|
||||
conform.setup({
|
||||
formatters_by_ft = {
|
||||
cpp = { 'clang-format' },
|
||||
c = { 'clang-format' },
|
||||
javascript = { 'prettier' },
|
||||
typescript = { 'prettier' },
|
||||
javascriptreact = { 'prettier' },
|
||||
typescriptreact = { 'prettier' },
|
||||
css = { 'prettier' },
|
||||
html = { 'prettier' },
|
||||
json = { 'prettier' },
|
||||
yaml = { 'prettier' },
|
||||
markdown = { 'prettier' },
|
||||
lua = { 'stylua' },
|
||||
python = { 'isort', 'black' },
|
||||
php = { 'php-cs-fixer' },
|
||||
java = { 'google-java-formatter' },
|
||||
graphql = { 'prettier' },
|
||||
liquid = { 'prettier' },
|
||||
bash = { 'shfmt' },
|
||||
sh = { 'shfmt' },
|
||||
},
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable with a global or buffer-local variable
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
return
|
||||
end
|
||||
return {
|
||||
lsp_fallback = true,
|
||||
async = false,
|
||||
timeout_ms = 500,
|
||||
}
|
||||
end,
|
||||
})
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "<leader>cf", function()
|
||||
conform.format({
|
||||
lsp_fallback = true,
|
||||
async = true,
|
||||
timeout_ms = 1000,
|
||||
})
|
||||
end, { desc = "Format file or range (in visual mode)" })
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>cff', function()
|
||||
conform.format({
|
||||
lsp_fallback = true,
|
||||
async = true,
|
||||
timeout_ms = 1000,
|
||||
})
|
||||
end, { desc = 'Format file or range (in visual mode)' })
|
||||
|
||||
vim.keymap.set({ "n" }, "<leader>cfb", function()
|
||||
vim.b.disable_autoformat = not vim.b.disable_autoformat
|
||||
vim.notify(
|
||||
"Buffer auto-format on-save: " .. (vim.b.disable_autoformat and "OFF" or "ON"),
|
||||
vim.log.levels.INFO
|
||||
)
|
||||
end, { desc = "Toggle auto-format on-save for buffer." })
|
||||
vim.keymap.set({ 'n' }, '<leader>cfb', function()
|
||||
vim.b.disable_autoformat = not vim.b.disable_autoformat
|
||||
vim.notify(
|
||||
'Buffer auto-format on-save: ' .. (vim.b.disable_autoformat and 'OFF' or 'ON'),
|
||||
vim.log.levels.INFO
|
||||
)
|
||||
end, { desc = 'Toggle auto-format on-save for buffer.' })
|
||||
|
||||
vim.keymap.set({ "n" }, "<leader>ftg", function()
|
||||
vim.g.disable_autoformat = not vim.g.disable_autoformat
|
||||
vim.notify(
|
||||
"Global auto-format on-save: " .. (vim.g.disable_autoformat and "OFF" or "ON"),
|
||||
vim.log.levels.INFO
|
||||
)
|
||||
end, { desc = "Toggle auto-format on-save globally." })
|
||||
end,
|
||||
vim.keymap.set({ 'n' }, '<leader>cft', function()
|
||||
vim.g.disable_autoformat = not vim.g.disable_autoformat
|
||||
vim.notify(
|
||||
'Global auto-format on-save: ' .. (vim.g.disable_autoformat and 'OFF' or 'ON'),
|
||||
vim.log.levels.INFO
|
||||
)
|
||||
end, { desc = 'Toggle auto-format on-save globally.' })
|
||||
end,
|
||||
}
|
||||
Reference in new issue
Block a user