remaster
This commit is contained in:
parent
1b949bdb01
commit
a90ea1f671
18 changed files with 1361 additions and 1210 deletions
44
lua/plugins/formatting.lua
Normal file
44
lua/plugins/formatting.lua
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
-- Code formatting
|
||||
return {
|
||||
'stevearc/conform.nvim',
|
||||
event = { 'BufWritePre' },
|
||||
cmd = { 'ConformInfo' },
|
||||
keys = {
|
||||
{
|
||||
'<leader>f',
|
||||
function()
|
||||
require('conform').format { async = true, lsp_format = 'fallback' }
|
||||
end,
|
||||
mode = '',
|
||||
desc = '[F]ormat buffer',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
formatters = {
|
||||
csharpier = {
|
||||
command = 'csharpier',
|
||||
args = { 'format', '$FILENAME' },
|
||||
stdin = false,
|
||||
tmpfile_format = '.cs',
|
||||
},
|
||||
},
|
||||
format_on_save = function(bufnr)
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
local lsp_format_opt
|
||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||
lsp_format_opt = 'never'
|
||||
else
|
||||
lsp_format_opt = 'fallback'
|
||||
end
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_format = lsp_format_opt,
|
||||
}
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
-- cs = { 'csharpier' },
|
||||
},
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue