dotfiles/.config/nvim/lua/format-lua.lua

42 lines
635 B
Lua
Raw Normal View History

2024-01-31 20:38:23 +01:00
local M = {}
local util = require "formatter.util"
function M.luaformatter()
return {
exe = "luaformatter",
}
end
function M.luafmt()
return {
exe = "luafmt",
args = { "--stdin" },
stdin = true,
}
end
function M.luaformat()
return {
exe = "lua-format",
args = {util.escape_path(util.get_current_buffer_file_path())},
stdin = true
}
end
function M.stylua()
return {
exe = "stylua",
args = {
"--search-parent-directories",
"--stdin-filepath",
util.escape_path(util.get_current_buffer_file_path()),
"--",
"-",
},
stdin = true,
}
end
return M