fixed lua formatting and added kiro-cli install
This commit is contained in:
1 parent
2929d9d70b
commit
137a5e7ea0
5 files changed
+48
-13
No files matched your search
@@ -19,6 +19,27 @@
|
||||
--
|
||||
local formatter_util = require("formatter.util")
|
||||
|
||||
local lua_format_executable = function()
|
||||
local executable = vim.fn.exepath("lua-format")
|
||||
if executable ~= "" then
|
||||
return executable
|
||||
end
|
||||
|
||||
local native_executable =
|
||||
vim.fs.joinpath(
|
||||
vim.fs.dirname(vim.fn.stdpath("data")),
|
||||
"nvim2",
|
||||
"mason",
|
||||
"bin",
|
||||
"lua-format"
|
||||
)
|
||||
if vim.fn.executable(native_executable) ~= 0 then
|
||||
return native_executable
|
||||
end
|
||||
|
||||
return "lua-format"
|
||||
end
|
||||
|
||||
require("formatter").setup {
|
||||
logging = true,
|
||||
log_level = vim.log.levels.WARN,
|
||||
@@ -45,16 +66,15 @@ require("formatter").setup {
|
||||
javascriptreact = {require("formatter.filetypes.javascriptreact").prettier},
|
||||
json = {require("formatter.filetypes.json").prettier},
|
||||
lua = {
|
||||
require("formatter.filetypes.lua").luafmt,
|
||||
function()
|
||||
return {
|
||||
exe = "luafmt",
|
||||
exe = lua_format_executable(),
|
||||
args = {
|
||||
"--stdin",
|
||||
"-l",
|
||||
"80",
|
||||
"-i",
|
||||
"2"
|
||||
"--column-limit=80",
|
||||
"--indent-width=2",
|
||||
formatter_util.escape_path(
|
||||
formatter_util.get_current_buffer_file_path()
|
||||
)
|
||||
},
|
||||
stdin = true
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user