← 返回首页
Save all named buffers when saving a workspace by domsekotill · Pull Request #201 · vim-ctrlspace/vim-ctrlspace · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Save all named buffers when saving a workspace#201

Open
domsekotill wants to merge 6 commits into
vim-ctrlspace:masterfrom
domsekotill:master
Open

Save all named buffers when saving a workspace#201
domsekotill wants to merge 6 commits into
vim-ctrlspace:masterfrom
domsekotill:master

Conversation

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
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!

Copy link
Copy Markdown
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>".

Copy link
Copy Markdown
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.

Copy link
Copy Markdown
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

Copy link
Copy Markdown
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 commented Apr 13, 2022

Copy link
Copy Markdown
Collaborator

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

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

4 participants

Footer

© 2026 GitHub, Inc.