From 639aa33b90efeae4ea92e2309f27f7afe36a0ac0 Mon Sep 17 00:00:00 2001 From: Adrien Waksberg Date: Wed, 6 Nov 2024 11:52:18 +0100 Subject: [PATCH] feat: add open file to last selected line --- lua/options.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lua/options.lua b/lua/options.lua index 738f20b..cd3e913 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -4,3 +4,12 @@ require "nvchad.options" -- local o = vim.o -- o.cursorlineopt ='both' -- to enable cursorline! + +vim.api.nvim_create_autocmd("BufReadPost", { + pattern = { "*" }, + callback = function() + if vim.fn.line "'\"" > 1 and vim.fn.line "'\"" <= vim.fn.line "$" then + vim.api.nvim_exec2("normal! g'\"", {}) + end + end, +})