I'd like to move the current tab into a new (visual/real) window in MacVim.
It's probably difficult, as:
So I am wondering if someone has found a way to achieve this?
The closest I think you can come is using mksession
This will have several drawbacks (like, initially the secondary session will open a few more buffers than ultimately desired). However, it will preserve your mappings, settings, history, window layout (if you had multiple windows inside the current tab, they will all get cloned).
If this idea tickles your fancy, you could look at creating a script that will filter parts out of the session file (which is Yust Another Vim Text Script)
:mksession! $HOME/detach.vim
:tabclose
:silent! !gvim remote --servername Detach -nR +'silent! source H:\detach.vim' +tabonly
:he mksession
):silent!
(try not to talk too much)!gvim remote --servername Detach
; launch a new remote Vim server if it doesn't yet exist, or talk to the existing server named Detach
-nR
TODO Fix This is here to avoid the use of swapfiles (because I found no way to suppress the dreaded ATTENTION
messages[1]). However, this may be unsafe advice depending on your situation, which is why I also include -R
for read-only mode
+'silent! source H:\detach.vim' +tabonly
-- In the remote vim, source the session to clone, and keep only the active tab (that was already closed in step 1.)A little rough around the edges, for sure, but quite close to what you intended, I feel.
If you are comfortable, you can drop the -nR
flags and just click through a few annoying swapfile attention messages (keyboard: Q).
[1] :he ATTENTION
:silent! !start /b gvim ....
in case you have terminal windows sticking around:simalt ~x
sequence is one hacky way to maximize the window (assuming English UI, because x
is the accelerator for Max
imize):se undofile
I don't think this is possible because, when you open a new instance of (g)vim you don't have access to the undo-history of the previous vim instance. All you can do is (in command mode):
:!gvim %
It will open the current file in a new instance of gvim. At least this is all I could think of. I may be wrong
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With