add formatter
This commit is contained in:
parent
ecd2da4118
commit
05b0210dae
2 changed files with 43 additions and 0 deletions
42
config/nvim/lua/core/plugin_config/formatter.lua
Normal file
42
config/nvim/lua/core/plugin_config/formatter.lua
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
-- 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,
|
||||||
|
log_level = vim.log.levels.WARN,
|
||||||
|
filetype = {
|
||||||
|
lua = {
|
||||||
|
require("formatter.filetypes.lua").stylua,
|
||||||
|
function()
|
||||||
|
return {
|
||||||
|
exe = "stylua",
|
||||||
|
args = {
|
||||||
|
"--search-parent-directories",
|
||||||
|
"--stdin-filepath",
|
||||||
|
util.escape_path(util.get_current_buffer_file_path()),
|
||||||
|
"--",
|
||||||
|
"-",
|
||||||
|
},
|
||||||
|
stdin = true,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
},
|
||||||
|
nix = {
|
||||||
|
require("formatter.filetypes.nix").alejandra,
|
||||||
|
function()
|
||||||
|
return {
|
||||||
|
exe = "alejandra",
|
||||||
|
stdin = true,
|
||||||
|
args = {
|
||||||
|
"--quiet"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
},
|
||||||
|
["*"] = {
|
||||||
|
require("formatter.filetypes.any").remove_trailing_whitespace
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,3 +10,4 @@ require("core.plugin_config.precense")
|
||||||
require("core.plugin_config.colorscheme")
|
require("core.plugin_config.colorscheme")
|
||||||
require("core.plugin_config.liveserver")
|
require("core.plugin_config.liveserver")
|
||||||
require("core.plugin_config.color-picker")
|
require("core.plugin_config.color-picker")
|
||||||
|
require("core.plugin_config.formatter")
|
||||||
|
|
Loading…
Reference in a new issue