feat(kauffinger/lazyvim): new config with my own from kauffinger/lazyvim

This commit is contained in:
2024-02-25 17:37:23 +03:00
commit 33c2bc8397
35 changed files with 1542 additions and 0 deletions

33
lua/config/autocmds.lua Normal file
View File

@@ -0,0 +1,33 @@
-- Autocmds are automatically loaded on the VeryLazy event
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
-- Add any additional autocmds here
-- Define an autocmd group for the blade workaround
local augroup = vim.api.nvim_create_augroup("lsp_blade_workaround", { clear = true })
-- Autocommand to temporarily change 'blade' filetype to 'php' when opening for LSP server activation
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
group = augroup,
pattern = "*.blade.php",
callback = function()
vim.bo.filetype = "php"
end,
})
-- Additional autocommand to switch back to 'blade' after LSP has attached
vim.api.nvim_create_autocmd("LspAttach", {
pattern = "*.blade.php",
callback = function(args)
vim.schedule(function()
-- Check if the attached client is 'intelephense'
for _, client in ipairs(vim.lsp.get_active_clients()) do
if client.name == "intelephense" and client.attached_buffers[args.buf] then
vim.api.nvim_buf_set_option(args.buf, "filetype", "blade")
-- update treesitter parser to blade
vim.api.nvim_buf_set_option(args.buf, "syntax", "blade")
break
end
end
end)
end,
})