aboutsummaryrefslogtreecommitdiffstats
path: root/lua/config/autocmds.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/config/autocmds.lua')
-rw-r--r--lua/config/autocmds.lua55
1 files changed, 44 insertions, 11 deletions
diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua
index 86d3e1d..24ff236 100644
--- a/lua/config/autocmds.lua
+++ b/lua/config/autocmds.lua
@@ -38,17 +38,6 @@ vim.api.nvim_create_autocmd({ "BufWritePre" }, {
end,
})
-if vim.fn.has "persistent_undo" then
- local target_path = vim.fn.expand "~/.cache/undodir"
- -- crear el directorio y cualquier directorio padre
- -- si la ubicación no existe.
- if not vim.fn.isdirectory(target_path) then
- vim.fn.mkdir(target_path, "p", 0700)
- end
-
- vim.o.undodir = target_path
- vim.o.undofile = true
-end
-- Función para alternar el ajuste de línea
function ToggleWrap()
local wrap = vim.wo.wrap
@@ -84,3 +73,47 @@ vim.api.nvim_create_autocmd("BufEnter", {
end
end,
})
+
+-- 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
+--
+local function augroup(name)
+ return vim.api.nvim_create_augroup("my_lazyvim_" .. name, { clear = true })
+end
+
+-- Set filetype for .env and .env.* files
+vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
+ group = augroup("env_filetype"),
+ pattern = { "*.env", ".env.*" },
+ callback = function()
+ vim.opt_local.filetype = "sh"
+ end,
+})
+
+-- Set filetype for .hurl files
+vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
+ group = augroup("hurl_filetype"),
+ pattern = { "*.hurl" },
+ callback = function()
+ vim.opt_local.filetype = "hurl"
+ end,
+})
+
+-- Set filetype for .toml files
+vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
+ group = augroup("toml_filetype"),
+ pattern = { "*.tomg-config*" },
+ callback = function()
+ vim.opt_local.filetype = "toml"
+ end,
+})
+
+-- Set filetype for .ejs files
+vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
+ group = augroup("ejs_filetype"),
+ pattern = { "*.ejs", "*.ejs.t" },
+ callback = function()
+ vim.opt_local.filetype = "embedded_template"
+ end,
+})