chore: some improvements

This commit is contained in:
Maurice Grönwoldt 2025-10-16 11:11:00 +02:00
commit d69fb57aa6
No known key found for this signature in database
GPG key ID: FBB005FE74FEF996
10 changed files with 182 additions and 59 deletions

26
lua/config/maps/vue.lua Normal file
View file

@ -0,0 +1,26 @@
-- Function to check if pom.xml exists in current or parent directories
local function is_npm_project()
local uv = vim.loop
local dir = uv.fs_realpath(vim.fn.expand("%:p:h"))
while dir do
if uv.fs_stat(dir .. "/package-lock.json") then
return true
end
local parent_dir = uv.fs_realpath(dir .. "/..")
if parent_dir == dir then
break
end
dir = parent_dir
end
return false
end
-- Create autocommand on FileType java or whatever filetype you want
vim.api.nvim_create_autocmd("FileType", {
pattern = "typescript",
callback = function()
if is_npm_project() then
vim.keymap.set("n", "<leader><F5>", "<CMD>! npm run format<CR>", { desc = "Prettier" })
end
end,
})