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

sessionoptions: allow exclude nofile buffers from save #12242

Open
przepompownia opened this issue May 3, 2020 · 9 comments
Open

sessionoptions: allow exclude nofile buffers from save #12242

przepompownia opened this issue May 3, 2020 · 9 comments
Labels
enhancement feature request
Milestone

Comments

@przepompownia
Copy link
Contributor

Actual behaviour

Currently (neovim-0.5.0+ubuntu1+git202005022020-d13c164-00e710e) mksession does not allow exclude nofile buffers (NERDTree windows for example) using sessionoptions.

Expected behaviour

Nothing more than the title says.

@przepompownia przepompownia added the enhancement feature request label May 3, 2020
@justinmk
Copy link
Member

justinmk commented May 6, 2020

I suppose there is a vim patch for this? That would be worth mentioning. PR welcome https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-Vim

@justinmk justinmk added the vim-patch See https://neovim.io/doc/user/dev_vimpatch.html label May 6, 2020
@justinmk justinmk added this to the todo milestone May 6, 2020
@przepompownia
Copy link
Contributor Author

I did not see any equivalent in Vim (8.2.0510-1). I am not familiar with C and so unable to make any reasonable patch.

@justinmk
Copy link
Member

justinmk commented May 8, 2020

is this feature in Vim or not?

@przepompownia
Copy link
Contributor Author

Not.

@justinmk justinmk removed the vim-patch See https://neovim.io/doc/user/dev_vimpatch.html label May 9, 2020
@justinmk justinmk modified the milestones: todo, unplanned May 9, 2020
@Zeioth

This comment was marked as spam.

Zeioth added a commit to NormalNvim/NormalNvim that referenced this issue Oct 29, 2023
…everting to old behavior until the neovim bug is fixed upstream: neovim/neovim#12242
Zeioth added a commit to NormalNvim/NormalNvim that referenced this issue Oct 29, 2023
@Zeioth
Copy link

Zeioth commented Feb 14, 2024

At least change it to bug so people know it needs to be fixed; This issue is preventing any Neovim session with a nofile buftype from saving correctly.

@sarmong
Copy link
Sponsor Contributor

sarmong commented May 23, 2024

blank option is apparently already checking for nofile buffers. Is there a need for another option?

if (wp->w_buffer->b_fname == NULL
// When 'buftype' is "nofile" can't restore the window contents.
|| (!wp->w_buffer->terminal && bt_nofilename(wp->w_buffer))) {
return ssop_flags & SSOP_BLANK;
}

@przepompownia
Copy link
Contributor Author

przepompownia commented May 24, 2024

After executing

local bufname = 'nofileBuffer'
local buf = vim.fn.bufadd(bufname)
vim.bo[buf].buflisted = true
vim.cmd([[set sessionoptions-=blank]])
vim.cmd.mksession({bang = true})

Session.vim contains

badd +0 nofileBuffer

blank seems to affect only windows.

Four years after this issue was created I use a custom command that cleans environment before mksession. It seems that we need something more flexible than adding the next parameter for such particular case. From the perspective of my needs this issue can be closed.

@sarmong
Copy link
Sponsor Contributor

sarmong commented May 24, 2024

Apparently, it also checks for buflisted. With your code above, if you set buflisted to false, the buffer is not saved to session file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature request
Projects
None yet
Development

No branches or pull requests

4 participants