feat: restore cursor position from last time

pull/2743/head
groveer 2 months ago
parent 2e54fce028
commit 41adc6ce76

@ -67,3 +67,19 @@ vim.api.nvim_create_autocmd({ "UIEnter", "BufReadPost", "BufNewFile" }, {
end
end,
})
-- restore cursor position
autocmd("BufReadPost", {
pattern = "*",
callback = function()
local line = vim.fn.line "'\""
if
line > 1
and line <= vim.fn.line "$"
and vim.bo.filetype ~= "commit"
and vim.fn.index({ "xxd", "gitrebase" }, vim.bo.filetype) == -1
then
vim.cmd 'normal! g`"'
end
end,
})

Loading…
Cancel
Save