nvim: Change formatter config
This commit is contained in:
parent
de6447fe19
commit
067c6aa2ee
@ -6,23 +6,110 @@ return {
|
||||
"BufNewFile"
|
||||
},
|
||||
init = function()
|
||||
vim.cmd([[
|
||||
let g:neoformat_enabled_python = ['autopep8']
|
||||
let g:neoformat_enabled_cpp = ['clangformat']
|
||||
let g:neoformat_enabled_c = ['clangformat']
|
||||
let g:neoformat_enable_lua = ['luaformatter']
|
||||
let g:neoformat_enabled_cmake = ['cmakeformat']
|
||||
----------------
|
||||
-- Formatters
|
||||
----------------
|
||||
|
||||
let g:neoformat_markdown_mdformat = {
|
||||
\ 'exe': 'mdformat',
|
||||
\ 'args': ['--wrap=79', '--number'],
|
||||
\ 'replace': 1,
|
||||
\ }
|
||||
let g:neoformat_enabled_markdown = ['mdformat']
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "python",
|
||||
callback = function()
|
||||
vim.g.neoformat_python_autopep8 = {
|
||||
exe = 'autopep8',
|
||||
args = {'--max-line-length', '79', '--experimental'},
|
||||
-- replace = 1
|
||||
}
|
||||
vim.g.neoformat_enabled_python = {
|
||||
'autopep8'
|
||||
}
|
||||
end
|
||||
})
|
||||
|
||||
let g:neoformat_enabled_latex = ['latexindent']
|
||||
let g:latexindent_opt="-m -l -g=/dev/null"
|
||||
]])
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
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>', {
|
||||
noremap = true,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user