Interact with this post using Mastodon or
Automatically save your position in vim on closing
Published on
If you spend quite some times writing in your preferred text editor, you know how cumbersome it is to look where you were the last time you access a document.
These days are over with this simple code to be added to your config file (the format here is in lua):
vim.cmd [[ augroup save_cursor_position
autocmd!
autocmd BufReadPost * call setpos(".", getpos("'\""))
augroup END
]]
You may appreciate to be able to catch-up on your work where you left it. This small piece of code will save the cursor position automatically for you on document closing. So when you reopen them, you will be placed exactly where you were at closing time.
Thanks for your read. Hope it's been useful to you.
✄ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈
More food for thoughts? Check other posts about: #(Neo)vim