nvim: Change formatter config
This commit is contained in:
parent
de6447fe19
commit
067c6aa2ee
@ -6,23 +6,110 @@ return {
|
|||||||
"BufNewFile"
|
"BufNewFile"
|
||||||
},
|
},
|
||||||
init = function()
|
init = function()
|
||||||
vim.cmd([[
|
----------------
|
||||||
let g:neoformat_enabled_python = ['autopep8']
|
-- Formatters
|
||||||
let g:neoformat_enabled_cpp = ['clangformat']
|
----------------
|
||||||
let g:neoformat_enabled_c = ['clangformat']
|
|
||||||
let g:neoformat_enable_lua = ['luaformatter']
|
|
||||||
let g:neoformat_enabled_cmake = ['cmakeformat']
|
|
||||||
|
|
||||||
let g:neoformat_markdown_mdformat = {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
\ 'exe': 'mdformat',
|
pattern = "python",
|
||||||
\ 'args': ['--wrap=79', '--number'],
|
callback = function()
|
||||||
\ 'replace': 1,
|
vim.g.neoformat_python_autopep8 = {
|
||||||
\ }
|
exe = 'autopep8',
|
||||||
let g:neoformat_enabled_markdown = ['mdformat']
|
args = {'--max-line-length', '79', '--experimental'},
|
||||||
|
-- replace = 1
|
||||||
|
}
|
||||||
|
vim.g.neoformat_enabled_python = {
|
||||||
|
'autopep8'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
let g:neoformat_enabled_latex = ['latexindent']
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
let g:latexindent_opt="-m -l -g=/dev/null"
|
pattern = {
|
||||||
]])
|
"cpp",
|
||||||
|
"c"
|
||||||
|
},
|
||||||
|
callback = function()
|
||||||
|
vim.g.neoformat_enabled_cpp = {
|
||||||
|
'clangformat'
|
||||||
|
}
|
||||||
|
vim.g.neoformat_enabled_c = {
|
||||||
|
'clangformat'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "lua",
|
||||||
|
callback = function()
|
||||||
|
vim.g.neoformat_enable_lua = {
|
||||||
|
'luaformatter'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "cmake",
|
||||||
|
callback = function()
|
||||||
|
vim.g.neoformat_enabled_cmake = {
|
||||||
|
'cmake-format'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Commented out rust formatter
|
||||||
|
-- vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
-- pattern = "rust",
|
||||||
|
-- callback = function()
|
||||||
|
-- vim.g.neoformat_enabled_rust = {'rustfmt'}
|
||||||
|
-- end
|
||||||
|
-- })
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "markdown",
|
||||||
|
callback = function()
|
||||||
|
vim.g.neoformat_markdown_mdformat = {
|
||||||
|
exe = 'mdformat',
|
||||||
|
args = {
|
||||||
|
'--wrap=79',
|
||||||
|
'--number'
|
||||||
|
},
|
||||||
|
replace = 1
|
||||||
|
}
|
||||||
|
vim.g.neoformat_enabled_markdown = {
|
||||||
|
'mdformat'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "tex",
|
||||||
|
callback = function()
|
||||||
|
vim.g.neoformat_tex_texfmt = {
|
||||||
|
exe = "tex-fmt",
|
||||||
|
args = {
|
||||||
|
"--stdin",
|
||||||
|
"--tabsize",
|
||||||
|
"4"
|
||||||
|
},
|
||||||
|
stdin = 1
|
||||||
|
}
|
||||||
|
vim.g.neoformat_enabled_tex = {
|
||||||
|
"texfmt"
|
||||||
|
}
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
----------------
|
||||||
|
-- Other
|
||||||
|
----------------
|
||||||
|
|
||||||
|
-- vim.cmd([[
|
||||||
|
-- augroup Neoformat
|
||||||
|
-- autocmd!
|
||||||
|
-- autocmd BufWritePre * undojoin | Neoformat
|
||||||
|
-- augroup END
|
||||||
|
-- ]])
|
||||||
|
|
||||||
vim.api.nvim_set_keymap('n', '<M-L>', '<cmd>Neoformat<cr>', {
|
vim.api.nvim_set_keymap('n', '<M-L>', '<cmd>Neoformat<cr>', {
|
||||||
noremap = true,
|
noremap = true,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user