Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save all named buffers when saving a workspace #201

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

domsekotill
Copy link

Removes the restriction when saving a workspace that named buffers are
readable files. Not all named buffers correspond to readable files;
for example URLs (downloaded by netrw) and terminal buffers in neovim.

This happens to address the closed issue
#110

Removes the restriction when saving a workspace that named buffers are
readable files.  Not all named buffers correspond to readable files;
for example URLs (downloaded by netrw) and terminal buffers in neovim.

This happens to address the closed issue
vim-ctrlspace#110
@cometsong
Copy link
Member

Great to have other bufs saved!
Have you tested this with multiple tabs and multiple terminal/url windows, etc?

@domsekotill
Copy link
Author

Actually I've found some problems with terminal buffers. The process ID is used to uniquely name each buffer but obviously will not be the same on session restore. It's resulting in terminal buffers being duplicated if they were visible when the session was stored. I have a couple of fixes on the way to solve it. Note that this is also partially an oversight in :mksession!

@cometsong
Copy link
Member

Other things to check on are any details e.g. ssh sessions, current pwd's of the terminals, etc....
If any ol' terminal session is all that's needed e.g. for pane layouts, then it's simple, but there are itsy-bitsies to watch for.
Agree on the pros and cons of Vim's mksession, which has had series of changes in patches and versions. :|

Terminal buffer names include a process ID value which cannot be
duplicated if the buffer is re-created new.  To handle this a mapping
is created by the session script of old names to new.
Found when the first window in a new tab shows a terminal buffer.
Instead of "tabedit <name>", `:mksession` outputs a bare "tabnew"
followed by "edit <name>".
@domsekotill
Copy link
Author

The terminal buffer name encodes the starting working directory and the command line to run. I don't think vim has any way of recording all the environment variables at the time a terminal was created but some can be explicitly overridden on the command line, which will be preserved.

@cometsong
Copy link
Member

Hmmm... I just tried to use your latest modified workspaces setup and it reloads the workspace with file buffers named after the terminal sessions. It names them as I loaded them, i.e. with the +cmd such as ssh server or cd dir.

If this works on your end, perhaps some vimrc settings are diff between us?
I so hope it's that simple, as I'll use this terminal reload immediately.

My vim version is 8.0, patches: 1-1802

@domsekotill
Copy link
Author

Ah - I was unaware vim-8 had added an immature, optional terminal feature; I was using neovim. There must be some significant differences between the two implementations. I'm going to have to compile vim from source and experiment to see how it works.

@Konfekt
Copy link
Collaborator

Konfekt commented Apr 13, 2022

Hello @domsekotill , any progress on this? @jyscao, would skipping terminal buffers be an option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement: feature dev new requests, or significant changes to existing ones priority: 2 - low status: awaiting user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants