Goto last line of previous edit session, when re-open a file?

Is there a way to have kakoune to goto last line of previous edit session, when re-open a file?
ASFAIK vim/neovim can do that.

You might want to look at the kakoune-state-save plugin.

Well, I’ve tried, but it does not work. I’m on macOS and zsh.

How can you tell it doesn’t work? Are there any error messages displayed on the status line? Is there anything in the *debug* buffer? Does anything get written to ~/.local/share/kak/state-save?

No there were no errors in *debug*. I opened a file, saved selection in the middle with Z, waited for about a minute, then quit kakoune. Opened that file again, cursor was at beginning of file, then I pressed z to restore selection, but there were no selections available. Also I noticed that no directory was created at ~/.local/share/kak/state-save, so I created it manually and started over again, but there was no success.

:echo %opt{state_save_path}
/Users/vbauer/.local/share//kak/state-save/
if it helps.

The plugin doesn’t deal with saved selections like Z, but it should store the cursor position to a file in that directory when Kakoune exits.

Inside state-save.kak there’s a bunch of commented-out lines in various places that mention echo -debug. If you uncomment those lines, restart Kakoune, and check *debug* you should get a much better idea what’s going on.