How can I undock a file panel from a split window?

37 views
Skip to first unread message

L A Walsh

unread,
Jun 9, 2021, 2:36:10 PM6/9/21
to Vim Users
If I use split, I can create a separate panel that
is a view on a file.

How can I undock it?

Bram Moolenaar

unread,
Jun 10, 2021, 12:44:24 PM6/10/21
to vim...@googlegroups.com, L A Walsh

> If I use split, I can create a separate panel that
> is a view on a file.
>
> How can I undock it?

That is not supported, Vim only works with one toplevel window.

--
Why I like vim:
> I like VIM because, when I ask a question in this newsgroup, I get a
> one-line answer. With xemacs, I get a 1Kb lisp script with bugs in it ;-)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Charles Campbell

unread,
Jun 10, 2021, 7:56:56 PM6/10/21
to vim...@googlegroups.com
Its not exactly what you're asking for, but I wrote something called
"Detach" which will detach a tab into its own process. ctrl-w T will
move a window into a new tab. The :Detach command will cause the
currently visible tab and all its windows to be brought up in a separate
gvim. Detaching a tab yields two independent instances of vim/gvim: they
do not share variables, vim functions, etc. If you're interested, you
may get it from http://www.drchip.org/astronaut/vim.index.html#DETACH .

Regards,
Chip Campbell

rwmit...@gmail.com

unread,
Jun 11, 2021, 8:29:23 AM6/11/21
to vim_use
That link returns a 404 for me.  I was able to backup to just
```http://www.drchip.org``` 
but now that is hanging. (no error, just not returning)

Tony Mechelynck

unread,
Jun 11, 2021, 10:29:27 AM6/11/21
to vim_use
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
The correct URL is http://www.drchip.org/astronaut/vim/index.html#DETACH
It differs from the one Dr. Chip gave by one slash replacing a dot.
It sends you to a link to a .vba.gz (a gzipped |vimball|) which IIUC
contains the software and help for the :Detach command.

Best regards,
Tony.

rwmit...@gmail.com

unread,
Jun 11, 2021, 11:47:15 AM6/11/21
to vim_use

I tried it. I'm using MacVim.  I edited the plugin replacing 'gvim' with 'mvim'.

It closes the current tab (good), opens a new macvim window (good) that is empty (bad).

I'm guessing the purpose of creating a new tmpname is to hold the contents of the current buffer without forcing it to be saved first, except the current buffer isn't getting written?
On Thursday, June 10, 2021 at 7:56:56 PM UTC-4 Charles Campbell wrote:

rwmit...@gmail.com

unread,
Jun 11, 2021, 12:07:13 PM6/11/21
to vim_use
Ultimately I added:

  let curfile = @%

and added that to:

  call system("mvim ".curfile." -S ".shellescape(sessionfile).' -c "set lines='.h.' columns='.w.'"'.' -c "winpos '.x.' '.y.'"')

and it seems to work for me.  I'm assuming mvim is lacking something gvim automatically does.

L A Walsh

unread,
Jun 15, 2021, 11:37:58 PM6/15/21
to vim...@googlegroups.com, Bram Moolenaar
On 2021/06/10 09:44, Bram Moolenaar wrote:
>> If I use split, I can create a separate panel that
>> is a view on a file.
>>
>> How can I undock it?
>>
>
> That is not supported, Vim only works with one toplevel window.
>
----

Why can't it allow undocking like other GUI apps? I'm not wanting
it to be a separate instance of vim -- since I want it to be a
different view on the same file -- so it's not like something that
would need interprocess communication -- but really just another GUI
window like browsers (like firefox or palemoon), like, I think,
Visual Studio, or Thunderbird. Seems like its not an uncommon feature,
and certainly would fit well with the idea of being able to undock
separate windows or tabs from the main window, no?
I.e. might it not be supportable?


rwmit...@gmail.com

unread,
Jun 16, 2021, 6:45:31 AM6/16/21
to vim_use
I suspect it isn't supportable due to decisions early on and the evolution of the code over many years.  Making the change properly would require changes throughout the code.  If Bram says it can't be done, I believe him.

Campbell has a very  straightforward approach of accomplishing the same end result by saving the contents of the current buffer, and then starting a new instance of gvim with that buffer. (I don't use gvim, so I hope I got that right.  I did get it work to my satisfaction with MacVim).

Is there a reason Campbell's solution does not work for you?  Ultimately, isn't the end result the most important part?

Christian Brabandt

unread,
Jun 16, 2021, 7:13:18 AM6/16/21
to vim...@googlegroups.com

On Di, 15 Jun 2021, L A Walsh wrote:

> > That is not supported, Vim only works with one toplevel window.
> ----
>
> Why can't it allow undocking like other GUI apps? I'm not wanting
> it to be a separate instance of vim -- since I want it to be a
> different view on the same file -- so it's not like something that
> would need interprocess communication -- but really just another GUI
> window like browsers (like firefox or palemoon), like, I think,
> Visual Studio, or Thunderbird. Seems like its not an uncommon feature,
> and certainly would fit well with the idea of being able to undock
> separate windows or tabs from the main window, no?
> I.e. might it not be supportable?

It has simply not been implemented.

Best,
Christian
--
Wie man sein Kind nicht nennen sollte:
Ute Rus

L A Walsh

unread,
Jun 28, 2021, 10:06:44 PM6/28/21
to vim...@googlegroups.com
On 2021/06/16 03:45, rwmit...@gmail.com wrote:
>
> Campbell has a very straightforward approach of accomplishing the
> same end result by saving the contents of the current buffer, and then
> starting a new instance of gvim with that buffer. (I don't use gvim,
> so I hope I got that right. I did get it work to my satisfaction with
> MacVim).
>
> Is there a reason Campbell's solution does not work for you?
> Ultimately, isn't the end result the most important part?
----
Because starting a separate copy of Vim isn't what I asked for. I
want separate,
windows onto the same file -- one vim, but with splits I can
undock/detach and
move around as separate windows (but still on the same buffer in the
same copy
of vim).

I.e. if I split gvim into 4 panels, on the same file, and focus
at the same area, I can type in 1 window and see results in the other
panels.
Now I just want to detach one or more of those panels -- they will still
be on
the same file using the same copy of vim -- just that they can be moved
around
separately from each other.

Does that explain why/how Campbell's solution isn't solving the same
problem?

Tony Mechelynck

unread,
Jun 29, 2021, 12:07:21 AM6/29/21
to vim_use
Well, one copy of Vim means one panel and that's that, so the answer
is: you can't.

Best regards,
Tony.

L A Walsh

unread,
Jun 29, 2021, 4:56:21 AM6/29/21
to vim...@googlegroups.com
On 2021/06/28 21:07, Tony Mechelynck wrote:
>
> Well, one copy of Vim means one panel and that's that,
but I can use split and get 4 panels open in 1 copy of vim.
Already I can do multiple panels with 1 vim, just not disconnected.



rwmit...@gmail.com

unread,
Jun 29, 2021, 6:05:41 AM6/29/21
to vim_use
The source code is available - you're free to use to make what ever changes make you happy.

Christian Brabandt

unread,
Jun 29, 2021, 7:04:45 AM6/29/21
to vim...@googlegroups.com

On Di, 29 Jun 2021, L A Walsh wrote:

> but I can use split and get 4 panels open in 1 copy of vim.
> Already I can do multiple panels with 1 vim, just not disconnected.

Correct. Note, Vim is open source, so you can contribute and give
something back.

Best,
Christian
--
Tatsächlich weicht in Wahrheit die Realität häufig von der Wirklichkeit ab.

L A Walsh

unread,
Jun 30, 2021, 12:17:08 PM6/30/21
to vim...@googlegroups.com
On 2021/06/29 03:05, rwmit...@gmail.com wrote:
> The source code is available - you're free to use to make what ever
> changes make you happy.
----
How many people do you think would be capable of making such changes?

At least I know programming, unlike some poor soul on a list who
was telling me that his 'Object Class' should act like a language native
array because his documentation said so. I asked how he told
the language-translator that his Object should be treated as though
it was derived from the native array implementation. He said his
documentation should be all that was necessary.

So if I write that gvim already has this feature because my .vim
file's documentation says so, do ya suppose it will automatically
appear? :-)


As far as me making changes in vim, it would be easier for me to
write a module plugin for the linux kernel that I could load &
unload. Does vim have such a compiled plugin system with which
the windowing API can be called to provide the necessary support?
If so, then maybe your statement is reasonable. But if I have to
know all the internals about what I am adding to, then it seems
that modular extensibility wasn't part of the core design either.

Lack of that would seem to make your statement a bit unrealistic
in a reasonable timeframe.

FWIW, that vim can runtime-load language extensions makes it much
ahead of most sw projects.




rwmit...@gmail.com

unread,
Jun 30, 2021, 12:49:10 PM6/30/21
to vim_use
On Wednesday, June 30, 2021 at 12:17:08 PM UTC-4 v...@tlinx.org wrote:
On 2021/06/29 03:05, rwmit...@gmail.com wrote:
> The source code is available - you're free to use to make what ever
> changes make you happy.
----
How many people do you think would be capable of making such changes?

Certainly not me, which is why I suggested a reasonable work-around
until you said you wanted multiple windows editing the same file with
live updates across all of them.

Having said that, I'm using MacVim and with whatever settings/plugins
I have, it automatically updates the buffer when the file changes externally,
but not until bringing it back into focus (which would be a fail for your use).

I tend to use each MacVim window as a session with related files and
sometimes want to break off a file into a new session.  I wouldn't have
looked/found a solution until you brought it up.  For me, it works great,
so I thank you for bringing the subject up.
Reply all
Reply to author
Forward
0 new messages