summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2024-01-26 23:24:31 +0100
committerEkaitz Zarraga <ekaitz@elenq.tech>2024-01-26 23:24:31 +0100
commite5019733ebeb244df4dd92248a433c754e49dd9b (patch)
tree3298904fea82043a5a5eaf67f9f60fbb0e7e5665
parent4487a629a745dec429b106d68fd39ef368396469 (diff)
nvim: jump to latest position on load
-rw-r--r--nvim/nvim/init.lua8
1 files changed, 8 insertions, 0 deletions
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"}, {