add devops and development profile
This commit is contained in:
1 parent
a0d2bcdfb0
commit
ab80f0d763
9 files changed
+128
-140
No files matched your search
+23
-13
@@ -5,6 +5,28 @@
|
||||
do
|
||||
-- [[ Formatting ]]
|
||||
vim.pack.add { gh 'stevearc/conform.nvim' }
|
||||
|
||||
-- Formatters are grouped by profile; see the switches in init.lua
|
||||
local formatters_by_ft = {
|
||||
bash = { 'shfmt' },
|
||||
sh = { 'shfmt' },
|
||||
zsh = { 'shfmt' },
|
||||
lua = { 'stylua' },
|
||||
}
|
||||
|
||||
if vim.g.load_devops then
|
||||
formatters_by_ft.nix = { 'nixfmt' }
|
||||
formatters_by_ft.terraform = { 'terraform_fmt' }
|
||||
formatters_by_ft.yaml = { 'yamlfmt' }
|
||||
end
|
||||
|
||||
if vim.g.load_development then
|
||||
formatters_by_ft.python = { 'black', 'isort' }
|
||||
formatters_by_ft.c = { 'clang-format' }
|
||||
formatters_by_ft.cpp = { 'clang-format' }
|
||||
formatters_by_ft.kotlin = { 'ktfmt' }
|
||||
end
|
||||
|
||||
safe_require('conform', {
|
||||
notify_on_error = true,
|
||||
format_after_save = {
|
||||
@@ -27,19 +49,7 @@ do
|
||||
lsp_format = 'fallback', -- Use external formatters if configured below, otherwise use LSP formatting. Set to `false` to disable LSP formatting entirely.
|
||||
},
|
||||
-- You can also specify external formatters in here.
|
||||
formatters_by_ft = {
|
||||
bash = { 'shfmt' },
|
||||
sh = { 'shfmt' },
|
||||
zsh = { 'shfmt' },
|
||||
python = { 'black', 'isort' },
|
||||
lua = { 'stylua' },
|
||||
c = { 'clang-format' },
|
||||
cpp = { 'clang-format' },
|
||||
kotlin = { 'ktfmt' },
|
||||
--
|
||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
},
|
||||
formatters_by_ft = formatters_by_ft,
|
||||
}, function()
|
||||
vim.keymap.set({ 'n', 'v' }, '<leader>f', function() require('conform').format { async = true } end, { desc = '[F]ormat buffer' })
|
||||
end)
|
||||
|
||||
Reference in new issue
Block a user