Switching to tabs to the right or left of the current tab in Notepad++

58

19

How can I switch to the document to the left or right of the current document in Notepad++?

For example, if I have documents A, B, and C open, and I'm currently editing B, I would like a shortcut to be able to:

  1. switch to document A, like. . . (Alt-LeftArrow or Ctrl-Pageup)

OR

  1. switch to document C, like. . . (Alt-RightArrow or Ctrl-PageDown).

All I've found is a way to switch to next or previous documents based on the "history" of when the document was last opened, for example:

(Ctrl-Tab and Ctrl-Shift-Tab)

The examples I have found are useful, but not what I want.

Is what I am asking for possible?

Christopher Swiedler

Posted 2010-05-03T16:43:47.463

Reputation:

3

Possible duplicate of How can I switch tabs in Notepad++ via Ctrl+PgUp/Down?

– Burgi – 2016-12-05T17:28:52.600

1This one is the better duplicate candidate. – DavidPostill – 2016-12-06T10:41:11.697

This has been default behaviour in Notepad++ since 6.4.5 (2013-08-09 https://notepad-plus-plus.org/download/v6.4.5.html). There's nothing in the patch notes, but I just downloaded a whole bunch of old versions and this is the first one that displays this behaviour out-of-the-box.

– lukescammell – 2016-12-06T13:50:31.650

4I can't believe this only had one upvote. ++. – ripper234 – 2010-10-19T10:44:17.400

Answers

66

Update

The functionality is included by default in Notepad++ v6.4.5 and later. 6.4.5 was released August 9th 2013. Note the current version is 7.5.8 released July 23rd 2018.

If you are using a version of Notepad++ older than v6.4.5, the rest of this answer still applies.

Natively

You can do this natively in Notepad++, but in order to replicate the behaviour of Firefox, you need to disable the document switcher and MRU behaviour.

Disable MRU functionality

  1. Navigate to Settings > Preferences... > MISC..
    • Where it says Document Switcher (Ctrl+TAB) uncheck the first check box Enable.
    • Hit the Close button.

Create the Ctrl+PGUP/PGDN shortcuts

  1. Navigate to Settings > Shortcut Mapper....
    • Make sure you are on the Main menu tab.
    • Scroll to the bottom and you should see in entries 192 Switch to previous document and 193 Switch to next document.
    • By default these should be mapped to Ctrl+Shift+Tab and Ctrl+Tab respectively.
    • Double click anywhere on the 192 line and change it to Ctrl+Page up.
    • Double click anywhere on the 193 line and change it to Ctrl+Page down.
    • Hit the Close button.

That's it!

Please note that you will no longer have access to the Ctrl+Tab/Shift+Tab MRU behaviour now. If, like me, you cannot live without this read on.

Another (better) option

Notepad++ defaults to using the back and forward buttons on a mouse to switch to the adjacent left and right tabs, so if you are a fan of AutoHotkey, you can use this little script:

#IfWinActive, ahk_class Notepad++
; Switch to the adjacent tab to the left
^PgUp::
    Send, {XButton1}
    Return
; Switch to the adjacent tab to the right
^PgDn::
    Send, {XButton2}
    Return

This won't interfere with other programs and enables to you have your cake and eat it! You can navigate left and right through adjacent the tabs using Ctrl+PgUp and Ctrl+PgDn and you can still switch to your last used tab using the built-in document switcher functionality using Ctrl+Tab and Ctrl+Shift+Tab - just like Firefox :)

lukescammell

Posted 2010-05-03T16:43:47.463

Reputation: 761

1Tabbing through multiple tabs using Ctrl + PgUp and PgDown works in version 6.6.9 – Underverse – 2015-10-06T02:23:06.787

I was going to answer with an AutoHotKey script but looks like you beat me to it. :) – user7783780 – 2016-11-15T13:02:56.930

1This is just what I've been wanting for a long time.. to be able to use Ctrl+PgDown AND/OR Ctrl+Tab to move to the next Tab (and the complementary inverse)...
I haven't tried it yet, but I will tomorrow... I'll be using Autoit3 (the parent of AutoHotKey, as I understand.. AutoHotKey forked off from Autoit me-thinks, if my memory is up to par :)
– Peter.O – 2010-08-06T10:17:19.040

Wow, where's the +100 button? – David Harkness – 2012-02-21T03:41:54.560

Unfortunately, if holding ctrl and pressing pgup multiple times, the subsequent presses have no effect. This is different from what I'm used to in other apps, eg Firefox. – Mads Skjern – 2012-11-29T22:44:23.237

11

Settings -> Preferences -> MISC, Document switcher (Ctrl-TAB). Uncheck the "Enable" checkbox. Documents will then be navigated to in the order they appear in the tabs.

You can also assign different keyboard shortcuts to next/previous document if you prefer.

mdma

Posted 2010-05-03T16:43:47.463

Reputation: 326

3Disabling the Most Recent Use (MRU) behavior under settings should do what you want. – Greg Bray – 2010-05-04T02:12:10.337

6

Using AutoHotkey, if the mouse back and forward buttons are already mapped by the user for a different purpose, lukescammell's solution can be modified to use Browser_Back and Browser_Forward instead:

#IfWinActive, ahk_class Notepad++
; Switch to the adjacent tab to the left
^PgUp::
    Send, {Browser_Back}
    Return
; Switch to the adjacent tab to the right
^PgDn::
    Send, {Browser_Forward}
    Return

These are extra media buttons found on some multimedia keyboards for going back and forward in a Web browser.

Gnubie

Posted 2010-05-03T16:43:47.463

Reputation: 2 371

I was going to answer with an AutoHotKey script but looks like you beat me to it. :) – user7783780 – 2016-11-15T13:03:12.960

5

Nowadays, this is the default behaviour, so if you are able to upgrade to the latest version of Notepad++, you should.

The new shortcuts 141 (Next Tab) and 142 (Previous Tab), which didn't exist until at least version 6.4.3, are now mapped to Ctrl+PgDn and Ctrl+PgUp.

This also circumvents the MRU dialog, so it's a double win.

László van den Hoek

Posted 2010-05-03T16:43:47.463

Reputation: 151

1

Settings > Shortcut Mapper enter image description here

Edit the shortcut and restart: use Alt + 1/2/3 to switch to Tab 1/2/3

hustljian

Posted 2010-05-03T16:43:47.463

Reputation: 111

interesting.... – user7783780 – 2016-11-15T13:03:29.573

-1

Short answer:

Ctrl + page up/down

Ali Karaca

Posted 2010-05-03T16:43:47.463

Reputation: 99