diff options
| author | Elvis Claros Castro <elvis@claros.ar> | 2026-06-27 22:48:15 -0300 |
|---|---|---|
| committer | Elvis Claros Castro <elvis@claros.ar> | 2026-06-27 22:48:15 -0300 |
| commit | a0bd84df02ce235123dfc939327e8bd33dffdd7e (patch) | |
| tree | 3a1f3095863502f01a112275a839d81ce832de1c /init.lua | |
| parent | 2895ac732dce0eece5ab2586f5d4d76ee0fab710 (diff) | |
| download | nvim-conf-a0bd84df02ce235123dfc939327e8bd33dffdd7e.tar.gz nvim-conf-a0bd84df02ce235123dfc939327e8bd33dffdd7e.zip | |
Remplazando y eliminando plugins a favor de cosas nativas.
Diffstat (limited to 'init.lua')
| -rw-r--r-- | init.lua | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -1,8 +1,21 @@ require "config" require "pi.globals" -vim.api.nvim_create_autocmd({ "BufReadPost" }, { - pattern = { "*" }, - callback = function() - vim.api.nvim_exec2('silent! normal! g`"zv', {}) + +-- Restaurar la última posición del cursor al abrir un archivo (reemplaza vim-lastplace) +vim.api.nvim_create_autocmd("BufReadPost", { + group = vim.api.nvim_create_augroup("last_place", { clear = true }), + callback = function(args) + local exclude_ft = { "gitcommit", "gitrebase", "svn", "hgcommit" } + local buf = args.buf + if vim.tbl_contains(exclude_ft, vim.bo[buf].filetype) or vim.b[buf].last_place_done then + return + end + vim.b[buf].last_place_done = true + local mark = vim.api.nvim_buf_get_mark(buf, '"') + local lcount = vim.api.nvim_buf_line_count(buf) + if mark[1] > 0 and mark[1] <= lcount then + pcall(vim.api.nvim_win_set_cursor, 0, mark) + vim.api.nvim_exec2("silent! normal! zv", {}) + end end, }) |