This commit is contained in:
2025-01-01 22:23:49 -05:00
parent 0135da50e8
commit 4ba713bbd4
2 changed files with 41 additions and 30 deletions

View File

@@ -1,30 +1,42 @@
return {
"stevearc/conform.nvim",
dependencies = {
"tpope/vim-sleuth",
},
event = { "BufWritePre" },
cmd = { "ConformInfo" },
keys = {
{
"<leader>f",
function()
require("conform").format({ async = true, lsp_fallback = true })
end,
mode = "",
},
},
opts = {
notify_on_error = false,
format_on_save = function(bufnr)
local disable_filetypes = { c = true, cpp = true }
return {
timeout_ms = 500,
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
}
end,
formatters_by_ft = {
lua = { "stylua" },
},
},
"stevearc/conform.nvim",
dependencies = {
"tpope/vim-sleuth",
},
event = { "BufWritePre" },
cmd = { "ConformInfo" },
keys = {
{
"<leader>f",
function()
require("conform").format { async = true, lsp_fallback = true }
end,
mode = "",
},
},
opts = {
notify_on_error = false,
format_on_save = function(bufnr)
local disable_filetypes = { c = true, cpp = true }
return {
timeout_ms = 500,
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
}
end,
formatters_by_ft = {
lua = { "stylua" },
},
hooks = {
pre_format = function(lines, _)
-- Strip comments
local no_comments = {}
for _, line in ipairs(lines) do
if not line:match "%s*//" and not line:match "%s*/%*.*%*/" then
table.insert(no_comments, line)
end
end
return no_comments
end,
},
},
}

View File

@@ -49,5 +49,4 @@ function clip() {
cat $1 | clip.exe
}
# Motd logic
clear; cal; cat ~/.motd
fastfetch