stevearc / resession.nvim

A replacement for mksession with a better API
MIT License
175 stars 13 forks source link

fix: cwd not set upon loading first buffer #20

Closed Subjective closed 10 months ago

Subjective commented 10 months ago

Problem: Normally, <c-g> and :w will output a message with the current buffer's filename relative the the cwd. However, when the buffer is restored from a session, the message (as well as the default statusline) show the filename relative the home directory instead. This doesn't seem to happen in tab-scoped sessions where each tab has its own cwd.

Before saving session (cwd set to ~/Documents):

image

After restoring session:

image

In the "after" screenshot, the cwd is set correctly, but the filename is displayed as if it were set to the home directory.

Solution: This PR resolves the issue by setting global options upon loading the first buffer. It also uses the lua api to set the cwd instead of vim.cmd.

stevearc commented 10 months ago

Thanks for the PR!