vim split window editing => separate window editing?

50 views
Skip to first unread message

Linda W

unread,
Feb 2, 2013, 2:11:33 PM2/2/13
to Vim Users
If vim can split a window and edit the same file in multiple places,
shouldn't
it be possible to have those windows be "disconnected" and really be
separate windows -- and still edit the same file?

I don't think there's is a way to currently do that in vim (???)...
but would it be that hard to change vim to allow such? -- one instance
of vim with multiple windows open onto the same set of buffers (or same
file?)...

How would it be more difficult than running with split windows?

RFE??





stosss

unread,
Feb 2, 2013, 2:15:24 PM2/2/13
to vim...@googlegroups.com
You can open the same file in separate tabs and view different
sections of the file in each tab. and when you :write to one it writes
all of them.

Marc Weber

unread,
Feb 2, 2013, 3:23:15 PM2/2/13
to vim_use
Excerpts from Linda W's message of Sat Feb 02 20:11:33 +0100 2013:
> If vim can split a window and edit the same file in multiple places,
> shouldn't
> it be possible to have those windows be "disconnected" and really be
> separate windows -- and still edit the same file?
Always talk about why you're missing it.

a) making a copy is cheap
:enew then copy paste buf contents

b) opening a second vim instance is cheap, too.

So why bother about such complex confusing setup you're talking about?

Marc Weber

Benjamin R. Haskell

unread,
Feb 2, 2013, 2:34:00 PM2/2/13
to vim_use
I'm not sure I see what's complex or confusing about it. I can't speak
for Linda, but it seems like any of the same reasons to open the same
file in multiple buffers would apply:

1. wanting to see two parts of the same file at once

2. wanting to have two different views of the same file (different
folding, different syntax highlighting, etc.)

She just seems to want it as a separate window, instead of being crammed
into the same Gvim application window.

But, I don't suspect the request will be fulfilled. It'd be too
complicated to implement in terminal Vim. And Gvim is structured such
that there's a single top-level application window. I haven't looked,
but I don't think there's a nice way to handle multiple detachable
windows without rewriting (much/most of) the GUI code.

--
Best,
Ben

stosss

unread,
Feb 2, 2013, 2:40:14 PM2/2/13
to vim...@googlegroups.com
Marc, the time stamp on your computer is in the future.
> --
> --
> 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
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
"In the days of ancient Rome when the republic was still a republic,
Lucius Cassius, one of the city's most venerated consuls, famously
coined the phrase cui bono.

It means As a benefit to whom?, and Lucius Cassius, inquisitive and
analytical by nature, was always asking the question... whether he was
investigating a crime or unraveling political corruption." - Simon
Black

Like I have always said, "Follow the flow of the money it always
reveals the truth."

Christian Brabandt

unread,
Feb 2, 2013, 2:48:30 PM2/2/13
to Vim Users
Hi Linda!
You can achieve something like this with the client-server feature and
two separate gvim instances.

regards,
Christian
--
Bei den Ursachen unbekannter wichtiger Begebenheiten raten wir immer
auf angenehme oder unangenehme, selten auf wahrscheinliche und
nat�rliche.
-- Jean Paul

Linda W

unread,
Feb 2, 2013, 2:49:14 PM2/2/13
to vim...@googlegroups.com


Benjamin R. Haskell wrote:
> On Sat, 2 Feb 2013, Marc Weber wrote:
>
>> Excerpts from Linda W's message of Sat Feb 02 20:11:33 +0100 2013:
>>
>> a) making a copy is cheap
>> :enew then copy paste buf contents
----
If I change contents in one file, it doesn't update in the other.
I don't want to have to merge 'N' copies.

>>
>> So why bother about such complex confusing setup you're talking about?
----
What would be confusing is trying to merge all those copies
you suggest I make.

>
> She just seems to want it as a separate window, instead of being
> crammed into the same Gvim application window.
---
Yep. Many applications have the ability to detach parts of the app...
>
> But, I don't suspect the request will be fulfilled. It'd be too
> complicated to implement in terminal Vim. And Gvim is structured such
> that there's a single top-level application window. I haven't looked,
> but I don't think there's a nice way to handle multiple detachable
> windows without rewriting (much/most of) the GUI code.
---
Really? I thought there was an ability to tear off menus at some point?
Or am I hallucinating that? ;-)



Benjamin R. Haskell

unread,
Feb 2, 2013, 2:56:09 PM2/2/13
to vim...@googlegroups.com
On Sat, 2 Feb 2013, Linda W wrote:

> Benjamin R. Haskell wrote:
>> She just seems to want it as a separate window, instead of being
>> crammed into the same Gvim application window.
> ---
> Yep. Many applications have the ability to detach parts of the app...
>>
>> But, I don't suspect the request will be fulfilled. It'd be too
>> complicated to implement in terminal Vim. And Gvim is structured
>> such that there's a single top-level application window. I haven't
>> looked, but I don't think there's a nice way to handle multiple
>> detachable windows without rewriting (much/most of) the GUI code.
> ---
> Really? I thought there was an ability to tear off menus at some point?
> Or am I hallucinating that? ;-)

I believe the tear-off menus are a built-in feature of GTK+. (Where you
need only specify 'true' for some "This menu can be torn off" property.)
IIRC, letting other things be "tear off" isn't as simple.

I could be wrong. I thankfully haven't had to do much GTK programming
in a while. Googling "GTK tear off windows" finds GtkHandleBox, so it
/might/ be as simple as turning the (vim) tabs into handle boxes.

--
Best,
Ben

Marc Weber

unread,
Feb 2, 2013, 5:30:57 PM2/2/13
to vim_use
Well - opening the same file multiple time is no that bad, because you
can make vim
- safe the buf if you leave insert mode
- reload the buf it has changed
Its not perfect. If you need assistance with it I'll write a new
plugin.

If you use google there is a chance to find some somewhat working
collaborative editing implementations for Vim.

Eg try googling for "collaborative editing vim github"
(I haven't tested those), there may be more implementations.

Next option: use emacs: It can do it. Evil implements most important Vim
modal editing commands just fine.

I hope that this reply is more helpful than my first one.

Marc Weber

ping

unread,
Feb 2, 2013, 10:32:12 PM2/2/13
to vim...@googlegroups.com, Marc Weber
On 2/2/2013 5:30 PM, Marc Weber wrote:
> Next option: use emacs: It can do it. Evil implements most important Vim
> modal editing commands just fine.
that's not an "eamcs-only" feature.

try nrrwrgn:
http://www.vim.org/scripts/script.php?script_id=3075

one of my most favorite plugins...

Marc Weber

unread,
Feb 3, 2013, 3:29:59 AM2/3/13
to vim_use
Hi Linda

[1]
> it be possible to have those windows be "disconnected" and really be
> separate windows
(first mail)
Please clarify what you mean by "window". In Vim terminology a window is
a rectangular region which can display a buffer. Muliple windows create
a layout. See :h window.

in OS terminology a window is something with a [x] at the top right,
something you can resize, close, minimize, move to other deskopts etc.
thus something like gvim, firefox, open office, etc.

[2]
> What would be confusing is trying to merge all those copies
> you suggest I make.
(later mail)

See comments about what narrow region plugin does (bottom)
Its a little bit confusing, so try again explaining what you mean by
- window
- merge
- disconnected?
(eg why disconnect if you want to merge later)

So please try again explaining your workflow, what you want to do.

What does emacs provide (just try it):

emacsclient --daemon

then any terminal:
emacsclient -c (new window)
emacsclient -c (new second window, but internal state is shared in
the daemon running)

Thus you have two separate OS windows which "merge" automatically -
as long as everything is running as same user on the same machine.

This feel like collaborative editing (eg titatnpad etherpad or
google document like) - but requires all emacs windows to run on the
same computer and as the same user (?)

For that reason I suggested looking at collaborative editing plugins
if they exist.


http://www.vim.org/scripts/script.php?script_id=3075
NrrwRgn (A Narrow Region Plugin)
description:

This is a script emulates Emacs Narrowing feature, by opening a selected
range in a new scratch buffer.

In the scratch buffer simply save it and the changes will be copied
into the original file.
This is only a very simple help. You should probably read the help,
that is provided with the plugin. See :h NarrowRegion

Can "copying back to the original buffer" be called "merging"?
Depends on what you're looking for. I agree its useful.


Maybe try all of those solutions - to get a better understanding what
works and what not - and then come back and ask more specific questions.

Marc Weber

v...@tim.thechases.com

unread,
Feb 3, 2013, 7:45:53 AM2/3/13
to vim...@googlegroups.com, marco-...@gmx.de
On Sun, 03 Feb 2013 09:29:59 +0100, Marc Weber wrote:
> > it be possible to have those windows be "disconnected" and really
> > be separate windows
> (first mail)
> Please clarify what you mean by "window". In Vim terminology a
> window is a rectangular region which can display a buffer. Muliple
> windows create a layout. See :h window.
>
> in OS terminology a window is something with a [x] at the top right,
> something you can resize, close, minimize, move to other deskopts
> etc. thus something like gvim, firefox, open office, etc.

From my understanding, Linda would like a second OS-window (and she
is already familiar with vim-windows), something that would only be
available in a gvim. Additionally, such multiple-OS-windows can be
done via an in-proc (one executable running, multiple OS-windows
showing from that one proc) or out-of-proc (multiple executables
running; such as using --remote commands).

-tim



Reply all
Reply to author
Forward
0 new messages