vim: add plugin 'mhartington/formatter.nvim'

This commit is contained in:
Fernando Schauenburg 2024-02-19 01:58:57 +01:00
parent 98c8837469
commit a15e582567
2 changed files with 33 additions and 0 deletions

View file

@ -10,6 +10,7 @@
"dial.nvim": { "branch": "master", "commit": "27eb570085db2ef44bff4f620d3806039184651c" },
"dressing.nvim": { "branch": "master", "commit": "6f212262061a2120e42da0d1e87326e8a41c0478" },
"fidget.nvim": { "branch": "legacy", "commit": "2f7c08f45639a64a5c0abcf67321d52c3f499ae6" },
"formatter.nvim": { "branch": "master", "commit": "cb4778b8432f1ae86dae4634c0b611cb269a4c2f" },
"git-messenger.vim": { "branch": "master", "commit": "8a61bdfa351d4df9a9118ee1d3f45edbed617072" },
"gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
"indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" },

View file

@ -0,0 +1,32 @@
local M = { 'mhartington/formatter.nvim' }
M.cmd = {
'Format',
'FormatLock',
'FormatWrite',
'FormatWriteLock',
}
M.keys = {
{ '<leader>F', '<cmd>Format<cr>', desc = '󰉼 Format file' },
}
M.opts = function( --[[plugin]] _, opts)
local ft = require('formatter.filetypes')
return vim.tbl_deep_extend('force', opts or {}, {
filetype = {
c = { ft.c.clangformat },
cmake = { ft.cmake.cmakeformat },
cpp = { ft.cpp.clangformat },
cs = { ft.cs.clangformat },
json = { ft.cs.prettier },
lua = { ft.lua.stylua },
markdown = { ft.markdown.prettier },
python = {}, -- TODO: pick one
sh = { ft.sh.shfmt },
zsh = { ft.zsh.beautysh },
}
})
end
return M