Skip to content

Instantly share code, notes, and snippets.

@SamLiu79
Created September 17, 2021 06:24
Show Gist options
  • Save SamLiu79/7b02a7cebd28a79e5d7c7f59182d3c5a to your computer and use it in GitHub Desktop.
Save SamLiu79/7b02a7cebd28a79e5d7c7f59182d3c5a to your computer and use it in GitHub Desktop.
local formatter = require('formatter')
formatter.setup({
filetype = {
lua = {
-- luafmt
function()
return {
exe = 'stylua',
args = {
'--column-width',
'80',
'--color',
'Never',
'--indent-type',
'Spaces',
'--line-endings',
'Unix',
'--quote-style',
'AutoPreferSingle',
'-',
},
stdin = true,
}
end,
},
yaml = {
function()
return {
exe = 'prettier',
args = {"--stdin-filepath", '--tab-width=2', vim.fn.fnameescape(vim.api.nvim_buf_get_name(0)) },
stdin = true,
}
end,
},
--[[ python = {
-- prettier
function()
return {
exe = 'black',
args = { '-', '-l', '88' },
stdin = true,
}
end,
}, ]]
sh = {
-- Shell Script Formatter
function()
return {
exe = 'shfmt',
args = { '-i', 2 },
stdin = true,
}
end,
},
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment