1

Re: Move Between Windows

I use VS 2005 in the standard "Tabbed documents" Window layout.  There are usually 3 or 4 vertical tab groups across two physical monitors.  On a nontrivial solution there can be 5 or 6 tabs in each tab group.

As I get better with ViEmu it is more and more of an annoyance to have to mouse-click the various windows to move focus.  Are there key combinations to move from window to window?  In the vim manual I just discovered CTRL-W followed by the navigation keys hjkl, which would be ideal.  gt and gT are buffer related, and don't correspond to the windows.  The VS built-in Ctrl-Tab and Ctrl-Shift-Tab are suboptimal too.

Once I'm in a tab group, are there keystrokes to cycle through the files *just in that tab group*?

Thanks.

Last edited by gandalf (2009-03-26 22:12:27)

2

Re: Move Between Windows

I understand your wanting to get this. Unfortunately, VS is very poor on the programmability of their windows / tab groups model. It remains a pending job to improve ViEmu in this regard, because the work required is very large. It would also make probably most sense to add support once ViEmu is scriptable.

So, unfortunately, there is no easy answer now to your requests.

Another ViEmu user got so frustrated when trying to achieve something similar that he commisioned someone to develop his wanted feature. Here are the details, and his source code:

  http://codewinpos.wiki.sourceforge.net/
  http://www.codeproject.com/KB/macros/CodeWinPos.aspx

Something similar will be needed to add this kind of support to ViEmu.

I'm sorry this is not very helpful.

Best regards,

  -- Jon

3

Re: Move Between Windows

(off topic comment)
about codewinpos, i've just install it 2 days ago. i don't have dual screen or wide screen so i think is not useful for me.

i had an idea to group .cpp/.c/.h together (or all files with same name), and i ended up with codewinpos which is not what i want
what i want is:
tabs: [a.cpp/.h] d.cpp c.h [d.c/.h]
see the filename is stripped and group together so we can see more files listed, and switching between them won't slide the tab bar (part of the tab bar is hidden if it's too long)

well, this is off topic from viemu. but i don't know where to discuss about this idea though.

4

Re: Move Between Windows

I'm working on a plugin that lets you do something like this. I've done the prototype so I know it's possible, I just need to find the time to finish it. Once it's done I'll post here since perhaps other vimmers will like it.

5

Re: Move Between Windows

There is a free & open source add-in called VSTabs that does something like that:

  http://www.zero-one-zero.com/vs/

I don't really know whether it supports the latest versions of Visual Studio.

Tomlu, anything you provide would be most welcome, I'm sure.

Regards,

  - Jon

6

Re: Move Between Windows

cool! it took me days and i really couldn't find it
http://www.visualstudiogallery.com/Results.aspx?query=vstabs

0 results for 'vstabs'

looks like ms is not "open". i hope someone build a open directory for vs macros/plugins

it's not working for my vs2008, but thanks
glad to see someone still working one similar project

Last edited by mOo (2009-03-31 04:15:44)

7

Re: Move Between Windows

found another one
http://www.tabsstudio.com/
actually working, but replace the built-in tabs which is in small font, no configure options yet, and seems not free it tell me it's "unregistered". not sure if it's a freeware or shareware whatever

8

Re: Move Between Windows

Thanks foo for posting about this!

VS's windows/tabs model seems to be lacking to many people out there. I hope they implement something better in a future version (I'm not sure how the VS2010 model is, haven't checked yet).

- Jon

9

Re: Move Between Windows

ctrl-Tab toggles through tabs in VS

10

Re: Move Between Windows

infinitey99, the problem is that Ctrl-Tab only works in history order, which can be confusing, and there is no way to access the visual order of the tabs through VS extensibility, to have nicer :tabn/:tabp, or to access the list of visible windows/tabgroups/tabs, to emulate vim's super-useful <Ctrl-W>hjkl.

  - Jon

11

Re: Move Between Windows

I now have a working addin that allows you to activate the previous/next tab. I was going to pretty much offer full Vim window management emulation, but had to scale back my functionality after losing a battle to Visual Studio extensibility.

I'll clean it up and release it to the public in the next few weeks.

12

Re: Move Between Windows

Tomas, that's great! I'd love to see it. I can totally understand what you mean with "losing a battle to Visual Studio extensibility".

How have you reach the order of tabs in a given tab group? I have ideas on how the other parts could be tackled, but scanning all extensibility APIs never resulted in something I could use to get the ordering of tabs.

13

Re: Move Between Windows

You can't without writing some really dodgy code:

1. Find all EnvDTE.Windows that have EnvDTE.Documents. These will be the code windows.

2. Sort them on their Left window coordinate. Since all windows in the same tab have the same Left coordinate, we wind up with one stack of windows per tab. We still don't have the z order.

3. Create corresponding stacks of Win32 hwnd handles. These can be found by using FindWindowEx, going from the main hwnd, down to the MDIClient, down to EzMdiContainers (one per tab), and then each code window is a DockingView. Since these are Win32 windows, we can easily find the z order in the process.

4. Match the EnvDTE.Window stacks up to the Win32 stacks by window caption. This is the dodgiest step, since if you have multiple windows with the same name in the same tab, there's no way to distinguish between them. Apart from that, it should be bulletproof.

Once done, you'll have one list of EnvDTE.Windows per tab, sorted in z order. Et voila.

14

Re: Move Between Windows

Tomas, is the z-order you refer to equivalent to the left-to-right order of tabs in a tab group? If so, you are a genius, I had thought about the hackish walking of EnvDTE.Windows & grouping by tab group, but I never thought tab order would be accessible.

In any case, congratulations on some really serious VS hacking!

  - Jon

15

Re: Move Between Windows

Don't forget split windows and horizontal tab groups...  ;-)

Last edited by gandalf (2009-04-28 22:05:24)

16

Re: Move Between Windows

> Tomas, is the z-order you refer to equivalent to the left-to-right order of tabs in a tab group?

No, it's the z order in the Win32 sense, i.e. the depth sort order of the windows. The tab order is inaccessible as far as I can tell. But at least knowing which tab is on top allows you to switch between different tab groups.

> Don't forget split windows and horizontal tab groups...  ;-)

Horizontal tab groups? I didn't think there were any. I'd have to look into what happens with a split.

17

Re: Move Between Windows

Ah ok, I know about Win32 z-order, and I had assumed that tab-order was totally unavailable, but your explanation made me wish for the best...

Horizontal and vertical tab groups are very similar, you should be able to make your logic work fine for both cases.

Splits are always done horizontally. A single CodeWindow can be split in two IVsTextView views, which both show potentially different parts of always the same buffer. If you're getting the coords of the code window, splits shouldn't affect your logic.

18

Re: Move Between Windows

I really hate having to move my hands away from the keyboard in order to click a mouse so that focus returns back to the window.  So...here's one hackish solution:

1. switch tabs as normal (ctrl-tab).
2. toggle a bookmark (ctrl-k ctrl-k), not necessary if a bookmark already exists on the page.
3. go to the next book mark in document (Edit->Bookmarks->Next Bookmark In Document), naturally I assigned this command (Edit.NextBookmarkInDocument) a keyboard shorcut (for me it was ctrl-k ctrl-o).

Sloppy yes, but you can always delete the bookmark after you have move focus to the window.  I just came up with this solution right now so I'll see if I like it or not, but I'll have to do until someone comes up with a better solution.

19

Re: Move Between Windows

arcanereinz wrote:

So...here's one hackish solution:

Excellent!

20

Re: Move Between Windows

Arcanereinz, thanks! I'm not totally positive I understand how that is useful related to the rest of things mentioned on the rest of the thread above... but I hope the tip is useful to other people.

Since I will be getting ViEmu/VS2010 ready over the next months, I hope to review this area, and I hope Microsoft has exposed a bit more of functionality in this regard!

21

Re: Move Between Windows

I hope so too, good luck in solving this problem.

22

Re: Move Between Windows

Thanks Arcanereinz!

23

Re: Move Between Windows

Jon_Symnum wrote:

Arcanereinz, thanks! I'm not totally positive I understand how that is useful related to the rest of things mentioned on the rest of the thread above... but I hope the tip is useful to other people.

Since I will be getting ViEmu/VS2010 ready over the next months, I hope to review this area, and I hope Microsoft has exposed a bit more of functionality in this regard!

Hi John -- Can you tell us where you landed on this?  Would be very useful for me! smile.

Thanks in advance - Michael