Quantcast

RFE: enable gvim to open a buffer or tab in a new window

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RFE: enable gvim to open a buffer or tab in a new window

L. A. Walsh
This is likely only pertinent to a GUI version of vim,
like gvim running over X.


More than once I've wanted to be able to tear off a tab
and have gvim open the tab in a new window and
have the new window function like a "tab"
(or a "split") -- except the other "view" (in case of
a split), be in a physically separate window.

Just the other day, I had two files open in tabs
(.cc and .h: a C++ source & header).  Instead of
window switching, I wanted to change my visual
layout for 1 pair of files to see them side-by-side
(and when I was done, close the 2nd display leaving
the 2nd file as a 2nd tab in the 1st window.

If I could tear off & merge tabs it would easily allow
such operations.

Is that something that might be doable?


--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

Christian Brabandt
Hi L!

On Di, 28 Mär 2017, L A Walsh wrote:

> This is likely only pertinent to a GUI version of vim,
> like gvim running over X.
>
>
> More than once I've wanted to be able to tear off a tab
> and have gvim open the tab in a new window and
> have the new window function like a "tab"
> (or a "split") -- except the other "view" (in case of
> a split), be in a physically separate window.
>
> Just the other day, I had two files open in tabs
> (.cc and .h: a C++ source & header).  Instead of
> window switching, I wanted to change my visual
> layout for 1 pair of files to see them side-by-side
> (and when I was done, close the 2nd display leaving
> the 2nd file as a 2nd tab in the 1st window.
>
> If I could tear off & merge tabs it would easily allow
> such operations.

You mean like tear off a tab and make it a new application window (e.g.
before there was only one gvim window and afterwards you have 2 windows
as seen from the operating system)?

That is not currently possible. However it should be possible to script
a plugin, that calls v:progpath with the current window and restores the
view using :mkview and :loadview. However I don't know, if something
like this exists

Best,
Christian
--
Armut, Keuschheit und Gehorsam... unerträglich sind sie alle.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

L. A. Walsh
Christian Brabandt wrote:

> Hi L!
>
> On Di, 28 Mär 2017, L A Walsh wrote:
>
>  
>> If I could tear off & merge tabs it would easily allow
>> such operations.
>>    
>
> You mean like tear off a tab and make it a new application window (e.g.
> before there was only one gvim window and afterwards you have 2 windows
> as seen from the operating system)?
>  
-----
Perhaps, though like w/firefox, I can send a tab or drag a tab to another
window -- and it is still only 1 application (who knows how many
threads, though)...
> That is not currently possible. However it should be possible to script
> a plugin, that calls v:progpath with the current window and restores the
> view using :mkview and :loadview. However I don't know, if something
> like this exists
>  
----
    I'm not sure you are understanding that I really only want there
to be 1 application controlling both windows.
    In the same way as when I split a window, if I change
something in 1 split, I can see the edits in another split.

    In this case, I'm just wanting a it to bring up a new
window.  Sorta like in explorer, if I want I can right click
on a folder and say "open folder in new window".  It's still
only 1 copy of explorer, but I can have it open multiple windows
on different folders -- if I change something in one of those
windows, I see the change reflected in other windows (usually,
it's a MS-product).  ;-)

-Linda


> Best,
> Christian
>  

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

Paul-4
In reply to this post by L. A. Walsh
On Tuesday, 28 March, 2017 at 13:08:03 BST, L A Walsh wrote:
>Just the other day, I had two files open in tabs (.cc and .h: a C++ source &
>header).  Instead of window switching, I wanted to change my visual layout for
>1 pair of files to see them side-by-side (and when I was done, close the 2nd
>display leaving the 2nd file as a 2nd tab in the 1st window.

Why not just :vsplit the other file into the current tab, and :quit it when done?

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

Charles E Campbell Jr
In reply to this post by L. A. Walsh
L A Walsh wrote:

> This is likely only pertinent to a GUI version of vim,
> like gvim running over X.
>
>
> More than once I've wanted to be able to tear off a tab
> and have gvim open the tab in a new window and
> have the new window function like a "tab"
> (or a "split") -- except the other "view" (in case of
> a split), be in a physically separate window.
>
> Just the other day, I had two files open in tabs
> (.cc and .h: a C++ source & header).  Instead of
> window switching, I wanted to change my visual
> layout for 1 pair of files to see them side-by-side
> (and when I was done, close the 2nd display leaving
> the 2nd file as a 2nd tab in the 1st window.
>
> If I could tear off & merge tabs it would easily allow
> such operations.
>
> Is that something that might be doable?
>
>
See if http://www.drchip.org/astronaut/vim/index.html#DETACH 's
detach.vim will do what you want.

Regards,
Chip Campbell

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

L. A. Walsh
In reply to this post by Paul-4
Paul wrote:

> On Tuesday, 28 March, 2017 at 13:08:03 BST, L A Walsh wrote:
>> Just the other day, I had two files open in tabs (.cc and .h: a C++
>> source &
>> header).  Instead of window switching, I wanted to change my visual
>> layout for
>> 1 pair of files to see them side-by-side (and when I was done, close
>> the 2nd
>> display leaving the 2nd file as a 2nd tab in the 1st window.
>
> Why not just :vsplit the other file into the current tab, and :quit it
> when done?
---
    If vsplit could split the file into another window, that'd be great!

But I want to be able to arrange the windows side-by-side -- maybe 1
on each side or, rarely, maybe 2 on each side (one above another).

Trying to simulate all of this in 1 window is near impossible,
but being able to view multiple files at the same time in
some side-by-side or one-on-top seems like a fairly basic
desire.  Right now, I have 10 different copies of gvim running,
each with 2 files (c++ source & header) and another 4 copies
with other work/projects in them.  At times I have 6-8 gvim's
open on my desktop each w/different files that I move between
to analyze call paths between different modules.

In this case, sometimes I want to view the header & c++ source
side-by-side in two windows and when done, I'd like to move
the header-file-window back into a tab of the source-file-window.

When I have to make code changes in multiple windows, it is
a hassle that I don't have the same history list in common
so I can repeat commands in each window instead of having to type
them, afresh, in each window.

People who do development get larger screens and multiple screens
so they can have multiple files and projects open at the same
time.

Does that help understand my use case?

Thanks!
Linda

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

Jacky Liu

> ---
>     If vsplit could split the file into another window, that'd be great!
>
> But I want to be able to arrange the windows side-by-side -- maybe 1
> on each side or, rarely, maybe 2 on each side (one above another).
>
> Trying to simulate all of this in 1 window is near impossible,
> but being able to view multiple files at the same time in
> some side-by-side or one-on-top seems like a fairly basic
> desire.  Right now, I have 10 different copies of gvim running,
> each with 2 files (c++ source & header) and another 4 copies
> with other work/projects in them.  At times I have 6-8 gvim's
> open on my desktop each w/different files that I move between
> to analyze call paths between different modules.
>
> In this case, sometimes I want to view the header & c++ source
> side-by-side in two windows and when done, I'd like to move
> the header-file-window back into a tab of the source-file-window.
>
> When I have to make code changes in multiple windows, it is
> a hassle that I don't have the same history list in common
> so I can repeat commands in each window instead of having to type
> them, afresh, in each window.
>
> People who do development get larger screens and multiple screens
> so they can have multiple files and projects open at the same
> time.
>
> Does that help understand my use case?
>
> Thanks!
> Linda

How many windows do you need ? I've got 16 here in one frame.

Remember window size can be controlled by auto commands, i.e. automatically increase size when the cursor moves into it.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.

Screenshot from 2017-04-06 13-43-33.png (617K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

Jacky Liu
In reply to this post by L. A. Walsh
> ---

>     If vsplit could split the file into another window, that'd be great!
>
> But I want to be able to arrange the windows side-by-side -- maybe 1
> on each side or, rarely, maybe 2 on each side (one above another).
>
> Trying to simulate all of this in 1 window is near impossible,
> but being able to view multiple files at the same time in
> some side-by-side or one-on-top seems like a fairly basic
> desire.  Right now, I have 10 different copies of gvim running,
> each with 2 files (c++ source & header) and another 4 copies
> with other work/projects in them.  At times I have 6-8 gvim's
> open on my desktop each w/different files that I move between
> to analyze call paths between different modules.
>
> In this case, sometimes I want to view the header & c++ source
> side-by-side in two windows and when done, I'd like to move
> the header-file-window back into a tab of the source-file-window.
>
> When I have to make code changes in multiple windows, it is
> a hassle that I don't have the same history list in common
> so I can repeat commands in each window instead of having to type
> them, afresh, in each window.
>
> People who do development get larger screens and multiple screens
> so they can have multiple files and projects open at the same
> time.
>
> Does that help understand my use case?
>
> Thanks!
> Linda

How many windows do you need ? I've got 16 here in one frame.

Remember window size can be controlled by auto commands, i.e. automatically increase size when the cursor moves into it.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.

Screenshot from 2017-04-06 13-57-19.png (528K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

Ben Fritz
In reply to this post by L. A. Walsh
On Wednesday, April 5, 2017 at 8:58:51 PM UTC-5, L. A. Walsh wrote:

> Paul wrote:
> > On Tuesday, 28 March, 2017 at 13:08:03 BST, L A Walsh wrote:
> >> Just the other day, I had two files open in tabs (.cc and .h: a C++
> >> source &
> >> header).  Instead of window switching, I wanted to change my visual
> >> layout for
> >> 1 pair of files to see them side-by-side (and when I was done, close
> >> the 2nd
> >> display leaving the 2nd file as a 2nd tab in the 1st window.
> >
> > Why not just :vsplit the other file into the current tab, and :quit it
> > when done?
> ---
>     If vsplit could split the file into another window, that'd be great!
>
> But I want to be able to arrange the windows side-by-side -- maybe 1
> on each side or, rarely, maybe 2 on each side (one above another).
>
> Trying to simulate all of this in 1 window is near impossible,
> but being able to view multiple files at the same time in
> some side-by-side or one-on-top seems like a fairly basic
> desire.  Right now, I have 10 different copies of gvim running,
> each with 2 files (c++ source & header) and another 4 copies
> with other work/projects in them.  At times I have 6-8 gvim's
> open on my desktop each w/different files that I move between
> to analyze call paths between different modules.
>
> In this case, sometimes I want to view the header & c++ source
> side-by-side in two windows and when done, I'd like to move
> the header-file-window back into a tab of the source-file-window.
>
> When I have to make code changes in multiple windows, it is
> a hassle that I don't have the same history list in common
> so I can repeat commands in each window instead of having to type
> them, afresh, in each window.
>
> People who do development get larger screens and multiple screens
> so they can have multiple files and projects open at the same
> time.
>
> Does that help understand my use case?
>
> Thanks!
> Linda
I'm not quite sure I understand why you need another top-level application window. From your description I think you may want to open a new tab on the first file with ":tab sp" and then ":vsp other_file" to get both files in one tab page (and you'll still have both files in the previous tab pages as well). When you're done, ":tabclose" and you're back to where you started.

I can see a need for multiple top-level application windows if you're asking about putting files up on a second monitor, I guess. But just splitting a view of two files at a time is easy to do in a new tab page with split windows on one monitor.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

Jacky Liu
In reply to this post by L. A. Walsh
Yes, I second with Ben. If you want side by side view it's also doable, see 8 windows shown side by side, stacked, with .c on the left and .h on the right in the screenshot.

I've mapped switching windows inside a tab page to keys IKJL, window sizes are controlled by auto commands, adding a new window is done by pressing "+", it can't be any faster, although in your case I would prefer using different tab pages.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.

Screenshot from 2017-04-07 00-40-01.png (453K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

L. A. Walsh
In reply to this post by Ben Fritz
Ben Fritz wrote:
> I'm not quite sure I understand why you need another top-level
> application window.
----
    Because it makes editing easier.  I want to be able to
rearrange the windows with a mouse -- drag them.  I want to be able
to drag a tab from one window to another.  These are all simple actions
that have existed for over a decade in browsers.

    Creating "auto-commands" to resize windows as I enter them is
not something I can do just by dragging.  I'd have to write custom
scripts to handle windows in various ways.  Having to write
custom scripts to create custom windows is not something I want to
spend my time doing when I could just press a key to open a tab
in a new window.
   
> From your description I think you may want to open a new tab on the
> first file with ":tab sp" and then ":vsp other_file" to get both files
> in one tab page (and you'll still have both files in the previous tab
> pages as well). When you're done, ":tabclose" and you're back to where
> you started.
----
    Tab sp/vsp/what?  I don't want to try to type & split -- I want
to use a mouse.  That's a more logical action for what I'm talking about.
How would I tell it to open a tab upward and to the right of the main
window above a TTY window?

    I don't want to be constrained on how I open windows or their
geometry.  I want to be able to stagger them -- diagonally or
side-by-side or over each other.  Managing 10-12 files using a
keyboard-only is way too much typing -- that I can't do as fast
as moving something with a mouse.

    Due to nerve damage I don't type as fast as I used to.  This
is an ease-of-use issue -- I don't want to control windows with
a keyboard.  I want to control windows and their position w/a
mouse and reserve typing for content in the windows.  That's the
bottom line -- I want to control window positions and visibility
with a mouse -- not a keyboard.

    Using a keyboard to navigate around a desktop is a royal pain.
That's what a mouse is for.

    As I asked above in opening a new vim-view above a tty window.
How do you intersperse output from different applications with
vim if vim is all 1 window?

    As I mentioned starting out -- this is a GUI issue -- where
one uses a mouse to control window positions. I want vim to be
able to use the window manager to manage windows so I can
have windows of other applications interspersed.

    You can't do that when vim is one large block covering most
of the screen.


--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

Jacky Liu
On Friday, April 7, 2017 at 1:46:51 AM UTC+8, L. A. Walsh wrote:

> Ben Fritz wrote:
> > I'm not quite sure I understand why you need another top-level
> > application window.
> ----
>     Because it makes editing easier.  I want to be able to
> rearrange the windows with a mouse -- drag them.  I want to be able
> to drag a tab from one window to another.  These are all simple actions
> that have existed for over a decade in browsers.
>
>     Creating "auto-commands" to resize windows as I enter them is
> not something I can do just by dragging.  I'd have to write custom
> scripts to handle windows in various ways.  Having to write
> custom scripts to create custom windows is not something I want to
> spend my time doing when I could just press a key to open a tab
> in a new window.
>    
> > From your description I think you may want to open a new tab on the
> > first file with ":tab sp" and then ":vsp other_file" to get both files
> > in one tab page (and you'll still have both files in the previous tab
> > pages as well). When you're done, ":tabclose" and you're back to where
> > you started.
> ----
>     Tab sp/vsp/what?  I don't want to try to type & split -- I want
> to use a mouse.  That's a more logical action for what I'm talking about.
> How would I tell it to open a tab upward and to the right of the main
> window above a TTY window?
>
>     I don't want to be constrained on how I open windows or their
> geometry.  I want to be able to stagger them -- diagonally or
> side-by-side or over each other.  Managing 10-12 files using a
> keyboard-only is way too much typing -- that I can't do as fast
> as moving something with a mouse.
>
>     Due to nerve damage I don't type as fast as I used to.  This
> is an ease-of-use issue -- I don't want to control windows with
> a keyboard.  I want to control windows and their position w/a
> mouse and reserve typing for content in the windows.  That's the
> bottom line -- I want to control window positions and visibility
> with a mouse -- not a keyboard.
>
>     Using a keyboard to navigate around a desktop is a royal pain.
> That's what a mouse is for.
>
>     As I asked above in opening a new vim-view above a tty window.
> How do you intersperse output from different applications with
> vim if vim is all 1 window?
>
>     As I mentioned starting out -- this is a GUI issue -- where
> one uses a mouse to control window positions. I want vim to be
> able to use the window manager to manage windows so I can
> have windows of other applications interspersed.
>
>     You can't do that when vim is one large block covering most
> of the screen.


Just in case, you know that the split columns and lines in Gvim can be dragged by mouse right? And this is still not what you want ?

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

L. A. Walsh
Jacky Liu wrote:
> Just in case, you know that the split columns and lines in Gvim can be
> dragged by mouse right? And this is still not what you want ?
Thanks Jacky, but no.  I _do_ use that to adjust the
split lines after the split, but just now, I was editing
2 files (C++ & header: file.cc + file.h).  They were each
in a tab with line numbering + fdc=1 turned on and each
had 80 columns for the text. (I try to keep my windows
sized @ 80 columns so I know when I enter code, where it
is going to wrap).

I was switching back and forth adding some code, then realized
something was inconsistent, so now I want to see them side by
side.

If I could drag a tab out and have it display itself in a new
window, that'd be great -- 2 windows side-by-side, each
80-text columns wide.

If I used a vertical split, first problem is I have 2 vertical
panes with the same file.  How do I switch?  If I click on the
other tab, it switches to the ".h" file & 1 vertical tab.
So first I need to figure out how to get my 2nd file into
one of the vertical tabs (the other tab would have my .cc file).

Now say I have different files in each vertical column --
but now the vertical columns are 38 columns wide each, right?

Line numbers are taking 3 columns, fdc is taking 1 column,
so splitting the text window (80 columns, but reserving 4
columns for the 2nd vertical pane's numbers+fdc), gives
me 76 text columns so 38 columns each (maybe more if
window decorations take up space).

Then I need to move the split-marker to center --
not the easiest thing to eyeball.

That takes time and alot of work just to get the files displayed
side-by-side.

When I'm done, I need to undo all those window size changes and
put the 2nd file back in its tab.

I wouldn't know how to begin to do that all by keyboard.


The easiest thing I end up doing now is quiting and editing
the files separately (and they both automatically come up
the right size).

Do you see how that can be a major time waste and hassle, vs.
dragging out the tab and either having it auto-spawn a window
if dropped, or into a 2nd window, if I need to have one open
first.

Using only the keyboard, I don't think it would be easy to do
quickly -- if it could be done at all.







--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

Ben Fritz
On Thursday, April 6, 2017 at 6:54:10 PM UTC-5, L. A. Walsh wrote:

> Jacky Liu wrote:
> > Just in case, you know that the split columns and lines in Gvim can be
> > dragged by mouse right? And this is still not what you want ?
> Thanks Jacky, but no.  I _do_ use that to adjust the
> split lines after the split, but just now, I was editing
> 2 files (C++ & header: file.cc + file.h).  They were each
> in a tab with line numbering + fdc=1 turned on and each
> had 80 columns for the text. (I try to keep my windows
> sized @ 80 columns so I know when I enter code, where it
> is going to wrap).
>
> I was switching back and forth adding some code, then realized
> something was inconsistent, so now I want to see them side by
> side.
>
> If I could drag a tab out and have it display itself in a new
> window, that'd be great -- 2 windows side-by-side, each
> 80-text columns wide.
>
So your goal is: two windows, 80 chars wide, with a different file in each. Let's call them file.c and file.h.

> If I used a vertical split, first problem is I have 2 vertical
> panes with the same file. How do I switch?

That's your first problem, you used the wrong command. The ":vsplit" command takes an argument, you don't need to split the same file. You could do this instead, assuming you're in file.c right now:

":vsplit file.h"

Now you have a split view of both files.

That's the basic usage. If you also want to preserve your first view of the file, i.e. if you want to rapidly switch between file.c in its own tab, and file.h in its own tab, and also file.c and file.h together in a view, then do this instead:

":tab split | vsplit file.h"

Or more succinctly since you don't like typing:

":tab sp | vsp file.h"

or even:

":tab sp | vsp %:r.h"

This last form is useful for long file names, like "this_is_a_really_long_filename_i_do_not_want_to_type_or_even_tab_complete.h". The "%:r" expands to the current file name (e.g. "file.c") with the file extension removed (e.g. "file")

Actually since you already have file.h open, it's already loaded in a "buffer". So you could use ":tab sp | vert sb file.h"

Note that tab completion works on all the file names above, especially the buffer version immediately above which will work even if the files are in different directories or something.

> If I click on the
> other tab, it switches to the ".h" file & 1 vertical tab.

Vim is designed for keyboard use. It can be used more powerfully and more efficiently without using the mouse for most things.

Vim tab pages are not the same as tabs in other programs, they are individual workspaces containing one or more windows, they are NOT locked to a file.

> So first I need to figure out how to get my 2nd file into
> one of the vertical tabs (the other tab would have my .cc file).
>

See above.

> Now say I have different files in each vertical column --
> but now the vertical columns are 38 columns wide each, right?
>

Yes they would be, if you started with a 80-character wide window. But the top-level window is easy to resize with the mouse or even by maximizing the window. I almost always use gvim maximized. If you want to keep a floating window instead use the mouse to resize or set the 'columns' option to the desired size.

> Line numbers are taking 3 columns, fdc is taking 1 column,
> so splitting the text window (80 columns, but reserving 4
> columns for the 2nd vertical pane's numbers+fdc), gives
> me 76 text columns so 38 columns each (maybe more if
> window decorations take up space).

If you want to turn off line numbers, etc. to save space, that is easy to do. In one window: ":set nonumber foldcolumn=0". In both: ":windo set nonumber foldcolumn=0".

If you use the suggestion above to set up a separate tab page for the split view, then you can even keep the numbering on in the original tab for easy reference.

>
> Then I need to move the split-marker to center --
> not the easiest thing to eyeball.
>

It should automatically be centered as soon as you create it. If it's not, a typing CTRL-W followed by = will make the window sizes equal. Or ":wincmd =".

> That takes time and a lot of work just to get the files displayed
> side-by-side.
>

":vsp file.h" is not a lot of work or time.

":tab sp | vsp file.h" is barely more.

I can do both of these faster than dragging a tab anywhere with a mouse.

> When I'm done, I need to undo all those window size changes and
> put the 2nd file back in its tab.
>
> I wouldn't know how to begin to do that all by keyboard.
>

By creating a third tab as I detail above, undoing all the window changes and such is as easy as ":tabclose" or ":tabc".

Of course you may still have a maximized application window to deal with, if you don't like that.

>
> The easiest thing I end up doing now is quiting and editing
> the files separately (and they both automatically come up
> the right size).
>

Is maximizing for the split view and then restoring the application window an option? If not is there a reason you need specifically 80-character application windows? Or do you just like that size?

> Do you see how that can be a major time waste and hassle, vs.
> dragging out the tab and either having it auto-spawn a window
> if dropped, or into a 2nd window, if I need to have one open
> first.
>
> Using only the keyboard, I don't think it would be easy to do
> quickly -- if it could be done at all.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

L. A. Walsh
Ben Fritz wrote:
>
> Is maximizing for the split view and then restoring the application window an option? If not is there a reason you need specifically 80-character application windows? Or do you just like that size?
>  
----
    I never use full screen unless I'm not doing work (movies/games).
    80-chars -- many projects require lines to fit in an 80-char
width.  It's a standard in the software world (not so much in the web
world).

    And there's the final 'rub'... I'll try the other commands
you mention -- but I gave 1 example (that can't even be
handled w/80 column widths).  When I'm working on a project
with >50 file-pairs, working to resize any of them manually is a
pain -- thus my comment that it was easier to quite and restart both
files in separate 80 column windows (FYI -- my window columns are
adjusted for the line numbers, automatically, so if a file has
line numbers turned on in the header, a vim-function takes care of
resizing the windows wider to handle the extra columns needed for
the numbering).

    Also, side-by-side is one of the simplest to describe, but
many times, I'll have windows staggered so a quick click can
switch me to a different file.  <<THAT is a major reason why
I don't use full screen.  When I want to take a break or do
something else, I'll minimize my 13-vim edit buffs(6-w/2 tabs, +1),
or if it's a vid or game, just leave them for later.  Also if
full screen I often won't see other application messages hidden
by the full screen window.

    In your case (and Jacky's), using vim full-screen eliminates
even the thought of staggered windows or using the mouse to
arrange them.  Full-screen narrows your view -- both in terms
of limiting it to only the files you've brought up, but also
to not seeing the usefulness of vim having multiple independent
windows as an option.

    Do you use vimperator as well? (a vim-like extension that
used to be maintained for the FF web-browser.  I tried it too,
BTW, but couldn't get used to using the keyboard to navigate
web pages.




--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

Michael Henry-5
Linda,

If you're willing to do some configuring, you can improve your
current workflow using Vim as it stands today, even if it only
approximates your desired layout of multiple top-level
application frames.  Here are some quick suggestions; I'm sure
the list can provide help if you choose to pursue any of them.

- You can create Gvim menus for any of the commands that you've
  seen suggested here, so you can use the mouse instead of the
  keyboard.

- You can resize the top-level Gvim frame via ``:set columns``.
  I do this all the time with two simple commands that take into
  account line numbering and such.  I call them ``:L1`` and
  ``:L2`` which give me one-column or two-column layouts fixed
  at 80 columns.  You can setup a menu that toggles your layout
  based on whether you are looking at a tab with one file or a
  tab with two files.  Along with ``<c-w>=`` to automatically
  balance the file width, you can automate the switching of your
  views.  I suspect you would never have to use the keyboard to
  perform resizing if you analyze your use cases and script up
  solutions for them, then create menus to activate them.

- You may want to take another look at tabs.  In Gvim, you can
  switch between tabs by clicking on the tab, instead of using
  your desktop window manager to switch between Gvim instances.

  There may be a plugin to present you with a menu of tabs to
  choose from as well, or you could script that up if you found
  you had too many tabs to easily see which one is which.

- You might also look into the Project plugin
  (http://www.vim.org/scripts/script.php?script_id=69), which
  gives you a menu of files in your project that you can select
  from.  This can help you reduce the amount of typing to select
  a file.

- I use Derek Wyatt's "fswitch" plugin to switch between
  "companion" files (as he puts it):
  https://github.com/derekwyatt/vim-fswitch

  If you have a .cc file open and you want to open the
  corresponding .h file, fswitch can find it and open it for
  you.  There are other similar plugins to try as well.

- I greatly enjoy fuzzy file finders.  I routinely use CtrlP
  (https://github.com/ctrlpvim/ctrlp.vim.git) and LustyExplorer
  (https://github.com/sjbach/lusty.git) to avoid having to type
  all the characters in a filename.  If you are trying to reduce
  the amount of typing, you may want to consider such a plugin.

- Similarly, if you aren't already using tags, you may want to
  consider installing Exuberant Ctags and generating a ``tags``
  file for your entire project.  I find this feature
  indispensable for navigating through my codebase.  When I want
  to find the definition of a function, I just place my cursor
  on the identifier in my current file and press a key; but in
  Gvim, you can use the mouse to follow the tag as well, saving
  keystrokes.

Michael Henry

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

Jacky Liu
In reply to this post by L. A. Walsh

I wrote a script to implement the side-by-side view with vim. See if it meets your need.

After sourcing it:

1.  To enable the side view, first maximize your Vim window (or drag it large enough. Resizing vim window is system specific, need apps like 'wmctrl' so I didn't do it. You'll have to manually arrange them even if you could fire up a separate frame window anyway)

2.  Use :vsplit twice so you now have 3 vertical windows, use the *left* 2 for side view

3.  Press Ctrl-I/K/J/L in Normal mode to switch windows alongside 4 direction

4.  When inside a window, press \s to toggle the side view status on and off. You would want to turn the left 2 windows on. The status will be shown in the statusline('SView' with green background at the left corner) as well as the column numbers.

5.  Windows with the side view status set will automatically try to resize themselves to 80 columns wide and their height to maximum when you switch windows

6.  Press + to add a new, minimized window below your current window, new window will automatically be set as a side view window. When you're done just use :q to close it

7.  Use :only to close all other windows in the current tab page

8.  Inside a window, use :E to open the default 'netrw' plugin to navigate to your target file.

9.  If you have the file open in another place and want to move it to a side view window, first move to that place, press \\(backslash twice) to save the full path to register @", then move to the side view window and use :edit command then ^R"(ctrl-r and ") to paste the path in the command line

10. If you have the path in another application, say your system file browser and want to move it into your vim, first copy the path to your system clipboard, then use ^R+ to paste it in vim under command/insert mode.

11. Keep in mind if you leave the side view status on with a window, it will always try to resize itself to 80 columns wide even if there's no other side view windows left.


--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.

sideview.vim (4K) Download Attachment
Screenshot from 2017-04-10 05-44-56.png (338K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

Jacky Liu

>
> " Resizing vim window is system specific, need apps like 'wmctrl' ..."


I mean resizing the frame/application window here, not vim window.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

L. A. Walsh
In reply to this post by Jacky Liu
Jacky Liu wrote:
> I wrote a script to implement the side-by-side view with vim. See if it meets your need.
To give you an idea of my desktop (note 7-8 vim windows are
minimize that have 2 files(in two tabs) each) besides the visible
ones.

It isn't like this all of the time, but this proj has more files
than usual.

This shows one meaning of "staggered" -- so I can see the titles
no matter which windows are on top.

The status wins on the upper right are usually covered to some or most
extent, but I do like to peek at them periodically.  Error window is
upper left, and compile and cmd window down right.

The project thing would be neat if it would open them in separate
windows (sigh).

I am showing my desktop to give you an idea of how much I don't use
a grid to layout my windows...but use the Window manager to bring
files forward as needed (or from minimized state)...

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.

desktop2.jpg (710K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: RFE: enable gvim to open a buffer or tab in a new window

L. A. Walsh
In reply to this post by Michael Henry-5
Michael Henry wrote:
> - You can create Gvim menus for any of the commands that you've
>   seen suggested here, so you can use the mouse instead of the
>   keyboard.
>  
But can't arrange the separate files in staggered windows as shown
in a previous post.
> - You may want to take another look at tabs.  In Gvim, you can
>   switch between tabs by clicking on the tab, instead of using
>   your desktop window manager to switch between Gvim instances.
>  
----
    I do that... but generally only have main+header (2 files)/window,
each in a tab.

> - You might also look into the Project plugin
>   (http://www.vim.org/scripts/script.php?script_id=69), which
>   gives you a menu of files in your project that you can select
>   from.  This can help you reduce the amount of typing to select
>   a file.
>  
----
    I'm wanting something like that but at a desktop level w/multiple
windows...
> - I use Derek Wyatt's "fswitch" plugin to switch between
>   "companion" files (as he puts it):
>   https://github.com/derekwyatt/vim-fswitch
>  
----
    Whenever I edit a source (.c/.cc/.cpp, etc or header (.h)),
my gvim is invoked via a function -- and that automatically opens
the "other" member of a pair in a 2nd tab.  So I already use the tab
switching (w/a mouse) to go between tabs to look at base file+header.

>   If you have a .cc file open and you want to open the
>   corresponding .h file, fswitch can find it and open it for
>   you.  There are other similar plugins to try as well.
>
> - I greatly enjoy fuzzy file finders.  I routinely use CtrlP
>   (https://github.com/ctrlpvim/ctrlp.vim.git) and LustyExplorer
>   (https://github.com/sjbach/lusty.git) to avoid having to type
>   all the characters in a filename.  If you are trying to reduce
>   the amount of typing, you may want to consider such a plugin.
>  
---
    In bash, I have file completion, which helps.

> - Similarly, if you aren't already using tags, you may want to
>   consider installing Exuberant Ctags and generating a ``tags``
>   file for your entire project.  I find this feature
>   indispensable for navigating through my codebase.  When I want
>   to find the definition of a function, I just place my cursor
>   on the identifier in my current file and press a key; but in
>   Gvim, you can use the mouse to follow the tag as well, saving
>   keystrokes.
>  
----
    I've tried that a few times, but never found the tags to be
that useful -- required too much thinking to use and that distracted
me from the task.

    Here's another rub -- and why I like the mouse for navigating.
using the keyboard for navigating is too analytical and is more likely
to interfere with the thinking about what I'm doing, which is rather
analytical.  Compared to mouse moving, which doesn't seem to use
my analytical-verbal skills so much and feels more unconscious -- in
so much as I don't have to think about it, so it doesn't cause much
"crosstalk" in my analytical thinking.
> Michael Henry
>  
Thanks for the pointers & suggestions -- appreciate them, even if
they don't solve my immediate problem, I still tend to file things
away to investigate and maybe use in other ways later...

-linda



--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
12
Loading...