resession.nvim icon indicating copy to clipboard operation
resession.nvim copied to clipboard

bug: g; and <C-o> do not jump after restoring session

Open Kamilcuk opened this issue 1 year ago • 1 comments

Did you check the docs and existing issues?

  • [X] I have read the docs
  • [X] I have searched the existing issues

Neovim version (nvim -v)

0.10.0 and nightly

Operating system/version

Almalinux with NIX

Describe the bug

:jumps are not restored. The current item > in :changes is always set to the first item.

What is the severity of this bug?

breaking (some functionality is broken)

Steps To Reproduce

  1. Open a file.
  2. Edit the file. Jump with { } a little.
  3. Confirm there is something in :jumps and :changes:.
  4. :lua require'resession'.save(vim.fn.getcwd(), {dir="dirsession"})
  5. Close nvim.
  6. Open nvim.
  7. :lua require'resession'.load(vim.fn.getcwd(), {dir="dirsession"})
  8. Notice :jumps are missing.
  9. Notice that in :changes: the current > is set as the first item, not after-the-last item as it should be.

Expected Behavior

I am in the process of moving from vim-workspace to resession. My expected behavior is that session saves changes and jumps. I couldn't find documentation about it. Is it expected?

Thanks for making resession, it's great!

Directory structure

repro.lua test.txt

Repro

-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  {
        "stevearc/resession.nvim",
        config = function()
            require("resession").setup({
              -- add any needed settings here
            })
        end,
  },
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Did you check the bug with a clean config?

  • [X] I have confirmed that the bug reproduces with nvim -u repro.lua using the repro.lua file above.

Kamilcuk avatar Jun 14 '24 16:06 Kamilcuk

As far as I'm aware, there's no API for getting or setting jumps, so I don't think there's any way for resession to save and restore that state.

stevearc avatar Jun 16 '24 02:06 stevearc