diff options
| author | Elvis Claros Castro <elvis@claros.ar> | 2024-12-09 10:44:18 -0300 |
|---|---|---|
| committer | Elvis Claros Castro <elvis@claros.ar> | 2024-12-09 10:44:18 -0300 |
| commit | e00fc002a6441fa3741d1f705337efbbd8850744 (patch) | |
| tree | f6891a9119ee065db574aae73395af973100a008 /lua/config/autocmds.lua | |
| parent | 546d06a2314d0b4b5360346243bcfc0bda3fff30 (diff) | |
| download | nvim-conf-e00fc002a6441fa3741d1f705337efbbd8850744.tar.gz nvim-conf-e00fc002a6441fa3741d1f705337efbbd8850744.zip | |
Cambios varios.
Diffstat (limited to 'lua/config/autocmds.lua')
| -rw-r--r-- | lua/config/autocmds.lua | 55 |
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, +}) |