Add VHDL formatter
This commit is contained in:
92
lua/formatterconfiguration.lua
Normal file
92
lua/formatterconfiguration.lua
Normal file
@@ -0,0 +1,92 @@
|
||||
-- Utilities for creating configurations
|
||||
local util = require("formatter.util")
|
||||
|
||||
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
|
||||
require("formatter").setup({
|
||||
-- Enable or disable logging
|
||||
logging = true,
|
||||
-- Set the log level
|
||||
log_level = vim.log.levels.WARN,
|
||||
-- All formatter configurations are opt-in
|
||||
filetype = {
|
||||
-- Formatter configurations for filetype "lua" go here
|
||||
-- and will be executed in order
|
||||
lua = {
|
||||
require("formatter.filetypes.lua").stylua,
|
||||
},
|
||||
|
||||
c = {
|
||||
require("formatter.filetypes.c").astyle,
|
||||
},
|
||||
|
||||
cpp = {
|
||||
require("formatter.filetypes.cpp").astyle,
|
||||
},
|
||||
|
||||
html = {
|
||||
require("formatter.filetypes.html").htmlbeautifier,
|
||||
},
|
||||
|
||||
latex = {
|
||||
require("formatter.filetypes.latex").latexindent,
|
||||
},
|
||||
|
||||
markdown = {
|
||||
require("formatter.filetypes.markdown").prettier,
|
||||
},
|
||||
|
||||
tex = {
|
||||
require("formatter.filetypes.latex").latexindent,
|
||||
},
|
||||
|
||||
rust = {
|
||||
require("formatter.filetypes.rust").rustfmt,
|
||||
},
|
||||
|
||||
haskell = {
|
||||
function()
|
||||
-- Full specification of configurations is down below and in Vim help
|
||||
-- files
|
||||
return {
|
||||
exe = "fourmolu",
|
||||
args = {
|
||||
util.escape_path(util.get_current_buffer_file_path()),
|
||||
},
|
||||
stdin = true,
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
vhdl = {
|
||||
function()
|
||||
-- Full specification of configurations is down below and in Vim help
|
||||
-- files
|
||||
return {
|
||||
exe = "vhdlfmt",
|
||||
args = {
|
||||
util.escape_path(util.get_current_buffer_file_path()),
|
||||
},
|
||||
stdin = true,
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- Use the special "*" filetype for defining formatter configurations on
|
||||
-- any filetype
|
||||
["*"] = {
|
||||
-- "formatter.filetypes.any" defines default configurations for any
|
||||
-- filetype
|
||||
require("formatter.filetypes.any").remove_trailing_whitespace,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Formatter autocommands
|
||||
vim.cmd([[
|
||||
augroup FormatAutogroup
|
||||
autocmd!
|
||||
autocmd BufWritePost * FormatWrite
|
||||
augroup END
|
||||
|
||||
autocmd BufWritePost *.v lua vim.lsp.buf.format({ async = false })
|
||||
]])
|
||||
Reference in New Issue
Block a user