This is the command invoked repeatedly to make the changes:
:%s/^\(.*\)|\%(\*\(\d\+\)\)\?$\n\1|\%(\*\(\d\+\)\)\?$/\=submatch(1)..'|*'..(max([str2nr(submatch(2)),1])+max([str2nr(submatch(3)),1]))/g
`nvim_(get|set)_option_value` pick the current buffer / window by default for buffer-local/window-local (but not global-local) options. So specifying `buf = 0` or `win = 0` in opts is unnecessary for those options. This PR removes those to reduce code clutter.
Extend the capabilities of is_os to detect more platforms such as
freebsd and openbsd. Also remove `iswin()` helper function as it can be
replaced by `is_os("win")`.
This is essentially a convenience wrapper around the `pending()`
function, similar to `skip_fragile()` but more general-purpose.
Also remove `pending_win32` function as it can be replaced by
`skip(iswin())`.
Problem:
If there are floating windows when `:mksession` runs, the session cannot
be properly restored.
Solution:
Change `:mksession` to skip floating windows. This matches Vim's
treatment of popup windows.
An alternative approach could have `:mksession` save floating windows
that can be _properly_ restored (rather than skip them entirely, which
is what this PR does). While that would seemingly be a more complete
fix, that could present additional issues since floating windows are
ordinarily created by plugins, and they may no longer be properly under
a plugin's control when restored.
closes#18432
Remove the command('qall!') from mksession_spec.lua because it prevents
helpers.rmdir() from retrying.
Allow extra trailing spaces when matching terminal lines.
Problem: After restoring a session buffer order can be quite different.
Solution: Create buffers first. (Evgeni Chasnovski, closesvim/vim#9520)
26ebf1f036
---------------
As in Vim, this basically reverts 8.1.0829 providing different solution
(see vim/vim#9520).
Regarding Neovim, this basically reverts changes from #15062. Test about
restoring same terminals was a bit too restrictive with using actual
buffer ids, which changed with this patch (now they should be in the
same order as at `mksession` call), so I tweaked it.
Problem: When 'hidden' is set session creates extra buffers.
Solution: Move :badd commands to the end. (Jason Franklin)
d39e275b57
Adjust some tests in ex_cmds/mksession_spec.lua:
- 'restores same :terminal buf in splits': Buffers aren't always :badded
in the same order as they're :edited, :balted, etc, so the order of
buffers in the buffer list may change slightly now that :badd happens
afterwards.
- 'restores buffers with tab-local CWD': This is explained in a comment.
Problem: When session-restore creates a terminal buffer with command
like `:edit term://.//16450:/bin/bash`, the buffer gets
a different name (depends on PID). Thus the later call to
`bufexists('term://.//16450:/bin/bash)` will return false.
Solution: Force the buffer name with :file. This as least ensures
the same buffer will show in multiple windows correctly, as
expected when saving the session. But it still has problems:
1. the PID in the buffer name is bogus
2. redundant :terminal buffers still hang around
fix#5250
This makes it possible to restore the working directory of :terminal
buffers when reading those buffers from a session file.
Fixes#11288
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
Use unique filenames to avoid test conflicts.
Use read_file() instead of io.popen(), to ensures the file is closed.
Use helpers.rmdir(), it is far more robust than lfs.
closes#7911
The ':tcd' command is the first tab-specific command written to the file
and it is wrapped inside an 'if has('nvim')' block to keep the session
file compatible with Vim.
Closes#6678