0
Completed

Add a new command, similar to prevView/nextView but this command just shows/selects the previously selected tab.

Nicolay77 12 years ago updated by Jon Skinner 12 years ago 7

So I can switch easily between two tabs without using the mouse.


It should work nice with all layouts too, even if the two views (current and pre-current) are of the same file in different sections.

Answer

Answer
Completed
Control+Tab does this

The various ways to switch between tabs are listed in the Goto/Switch File menu
lastView seems to be a good name for the command.
+1
Oh, I see.  Switch between two views, but not prev/next.  Seems very reasonable!  when I first read this I thought it was silly because you can use ctrl/super + 1..9 to select a tab.

But I agree, I think a "last view" is useful.  Actually, if goto-anything sorted by history instead of open tabs, it could perform this task (in which case you could press ctrl/super + p, enter to go to previous view).  Not as good as a command that could actually open the last view, but close enough for horseshoes.
Answer
Completed
Control+Tab does this

The various ways to switch between tabs are listed in the Goto/Switch File menu
Ctrl+Tab should imo cycle through the tabs in the order they appear in the window, and Ctrl+Shift+Tab goes backwards.

What Nicolay is asking for (and I totally agree with) is a history-based command that goes to the *previously-viewed* tab or file, like the Back button of a browser.

I'm totally used to this in Visual Studio and it feels odd not having the ability to navigate historically to what I was just looking at 5 seconds ago. What made it really great in VS is that it would even work *within* a file, so if you navigate to a function (by going to its definition) it would add that navigation to the history stack as well.

Ctrl+Tab does something different.


I have to be totally aware of the status of the Ctrl key, when I press it, when I release it, and I have to consciously release it and press it again to do what I want with the 'lastView' proposed command.


The way I want it, suppose I map it to ctrl+d (or something similar near ctrl+v and ctrl+c), then I can keep Ctrl pressed, and press d any number of times, and the focus only switches between two views, not a thousand views or whatever that's in the view history.


That way I can work without worrying about 'did I release the Ctrl key in the wrong moment?  did I messed up the view history?'


Just my 0.5 cents.

I agree, and in the meantime, I would like to offer up a plugin-based solution.  It builds on my existing plugin, MarkAndMove, and adds a couple commands that accomplish this task.

I've bound ctrl+tab to "mark_and_move_window_toggle" and ctrl+shift+tab to "mark_and_move_window_mark" (see Example.sublime-keymap).  Now, when I press ctrl+tab, I can choose another open tab to bind to the current view, and subsequent ctrl+tab will toggle between the two windows.  If I want to re-bind different windows, I use ctrl+shift+tab, which is bound to "mark_and_move_window_select".

If you close the bound view, it will not reopen the file (too hard for now), it let's you select another.  Please send feature requests to MarkAndMove/issues.
Ok this is totally fsck0red. Ctrl+Tab does actually cycle back through the history, but you have to keep holding Ctrl down for it to work, which means you can't bind it to the back button of a mouse and have it work in any sensible manner.

It's also totally backward in that adding the Shift key makes it go forward. Some people may be familiar with this, but I recommend binding the historical back (currently Ctrl+Tab) to Super+[ and forward (currently Ctrl+Shift+Tab) to Super+], and (most importantly) get rid of the resetting that happens when you let go of the modifier key.

Use something else to "reset" the stack, such as manually navigating to a new document.
Ctrl+Tab works exactly like Alt+Tab does (or Cmd+Tab on OS X)