tpope / vim-obsession

obsession.vim: continuously updated session files
http://www.vim.org/scripts/script.php?script_id=4472
1.76k stars 70 forks source link

ObsessionStatus() return value not documented; seems only ever to return [$] and [S] #82

Closed phlummox closed 1 week ago

phlummox commented 2 weeks ago

vim version

The default version of vim on Ubuntu 22.04, namely vim 8.2 (2019 Dec 12, compiled Sep 25 2024 05:30:01).

vim-obsession version

Commit fe9d3e1a9a50171e7d316a52e1e56d868e4c1fe5 (1 Dec 2022).

Installed using: mkdir ~/.vim/pack/plugins/start && cd ~/.vim/pack/plugins/start && git clone https://github.com/tpope/vim-obsession.git

configuration

No other plugins installed, no .vimrc file.

expected behaviour

The behaviour of ObsessionStatus() should be documented, and when executed, the command

echo ObsessionStatus()

should show something useful, indicating whether there is no session, an active session, or a paused session.

actual behaviour

When executed, ObsessionStatus() displays [$] for both no sessions and an active session, which seems rather cryptic (the output isn't documented anywhere) and not very useful (I'd have though the two states are fairly different, and deserve distinct values). If a session is paused, ObsessionStatus() displays [S], which is at least different to the other two, although still not documented anywhere.

other comments

It would be helpful if ObsessionStatus() were documented, and could indicate whether no session is active.

Copying @sodapopcan's implementation of ObsessionStatus() into .vimrc, and giving it a different name (e.g. MyObsessionStatus) does provide distinct output values for all three states, so seems more useful and intuitive - no session gives the empty string, an active session returns "tracking", and a paused session returns "paused". Hopefully this will be helpful to anyone else puzzling over the output of ObsessionStatus().

tpope commented 1 week ago

Documented.

When executed, ObsessionStatus() displays [$] for both no sessions and an active session

Not true, if there's no session, there's no status indicator (ObsessionStatus() returns an empty string). You can confirm this by invoking :echo ObsessionStatus() in a freshly launched instance.