From f3e265ca124a1215f0683059bbb8dc9f08390d3c Mon Sep 17 00:00:00 2001 From: Kevin James Lausen Date: Tue, 31 May 2022 18:48:54 -0400 Subject: [PATCH] Added cursor position file persistance, with a lua-embedded auto-command. --- lua/user/options.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/user/options.lua b/lua/user/options.lua index 50aa80c..3465c53 100644 --- a/lua/user/options.lua +++ b/lua/user/options.lua @@ -58,3 +58,15 @@ local options = { -- vim.cmd "set whichwrap+=<,>,[,],h,l" Want to find out what it does, before blindly enabling it. vim.cmd [[set iskeyword+=-]] -- Will treat words with a dash as part of a single word. --vim.cmd [[set formatoptions-=cro]] -- TODO: this doesn't seem to work + +-- Embedded Vim Auto-command, that adds file cursor location persistance. +vim.cmd +[[ + augroup line_return + au! + au BufReadPost * + \ if line("'\"") > 0 && line("'\"") <= line("$") | + \ execute 'normal! g`"zvzz' | + \ endif + augroup END +]]