feat(nvim): rustfmt config
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
5443f5f067
commit
56c6370a73
|
@ -22,6 +22,14 @@ local goimports = function()
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local rustfmt = function()
|
||||||
|
return {
|
||||||
|
exe = "rustfmt",
|
||||||
|
args = { "--edition", "2021" },
|
||||||
|
stdin = true,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
require("formatter").setup({
|
require("formatter").setup({
|
||||||
log_level = vim.log.levels.INFO,
|
log_level = vim.log.levels.INFO,
|
||||||
filetype = {
|
filetype = {
|
||||||
|
@ -29,6 +37,7 @@ require("formatter").setup({
|
||||||
typescript = { prettier },
|
typescript = { prettier },
|
||||||
typescriptreact = { prettier },
|
typescriptreact = { prettier },
|
||||||
go = { goimports },
|
go = { goimports },
|
||||||
|
rust = { rustfmt },
|
||||||
|
|
||||||
-- https://github.com/JohnnyMorganz/StyLua
|
-- https://github.com/JohnnyMorganz/StyLua
|
||||||
-- cargo install stylua --features lua54
|
-- cargo install stylua --features lua54
|
||||||
|
@ -43,7 +52,7 @@ vim.api.nvim_exec2(
|
||||||
[[
|
[[
|
||||||
augroup FormatAutogroup
|
augroup FormatAutogroup
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd BufWritePost *.js,*.ts,*.tsx,*.go,*.lua silent FormatWrite
|
autocmd BufWritePost *.js,*.ts,*.tsx,*.go,*.lua,*.rs silent FormatWrite
|
||||||
augroup END
|
augroup END
|
||||||
]],
|
]],
|
||||||
{ output = true }
|
{ output = true }
|
||||||
|
|
Loading…
Reference in New Issue