From e5019733ebeb244df4dd92248a433c754e49dd9b Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Fri, 26 Jan 2024 23:24:31 +0100 Subject: nvim: jump to latest position on load --- nvim/nvim/init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nvim/nvim/init.lua b/nvim/nvim/init.lua index 4632a11..7bdec4a 100644 --- a/nvim/nvim/init.lua +++ b/nvim/nvim/init.lua @@ -45,6 +45,14 @@ vim.cmd.highlight("ExtraWhitespace", "ctermbg=red", "guibg=red") -- HighLight search vim.opt.hlsearch = true +-- Jump to latest position +vim.api.nvim_create_autocmd({ "BufReadPost" }, { + pattern = { "*" }, + callback = function() + vim.api.nvim_exec('silent! normal! g`"', false) + end, +}) + -- Whitespace local extraWhitespace = vim.api.nvim_create_augroup('whitespace', { clear = false }) vim.api.nvim_create_autocmd({"WinNew", "TabNew", "BufEnter", "InsertLeave"}, { -- cgit v1.2.3