How to jump to the other end of selection?
-
Hello,
if I select some text then I can extend the selection only one one end (where the insertion mark is). But what if I see that I’d like to extend the selection on its other end? Is it possible to move the cursor to the other end and keep the selection so that it gets extended there when I press e.g. Shift+Arrow?
Thank you!
-
@fml2 ,
If I understand you correctly, you want something like the following:
- have text like
abcdefghijklmnopqrstuvwxyz - select
nopq(shift and arrow keys, or what have you) - move the caret back to the
n - select backward (shift and left arrow, for example) so you get
jklmalso selected in the same single selection
Fortunately, even though Notepad++ cannot have default keyboard shortcuts on all of them, the underlying Scintilla library that Notepad++ uses for handling text selections and similar editing features has a lot of commands. I didn’t even think this one really existed, but when I searched their docs for
swap, I found SCI_SWAPMAINANCHORCARET which does the magic of swapping the anchor (beginning of selection) and caret (end of selection), so you can actually do this.Go to Settings > Shortcut Mapper, and go to the Scintilla commands tab in that dialog. In the Filter: box, type
SWAP, which will show youSCI_SWAPMAINANCHORCARET. Click on it, Modify, and assign a shortcut (for sake of my example, I am usingCtrl+Alt+Shift+Spacebar, which doesn’t conflict with anything else). Once you Apply and OK to close the dialogs, that shortcut will perform that action.Click between the
mandnin the alphabet.Shift+RightArrowto selectnopq. UseCtrl+Alt+Shift+Spacebar, and notice that the selection stays the same, but the caret bar/symbol swaps to being before thenrather than after theq.Shift+LeftArrowfour times to extend the selection to the left, so it’s now gotjklmnopq, with the caret before thej. You can keep on using the new shortcut to swap, and go on extending to either end, to slowly add more and more of the alphabet, if you want. But if you were to Copy at this point, the clipboard would contain thejklmnopqas a single normal selection.It’s amazing how many hidden gems Notepad++ provides, either on its own or through the Scintilla library it uses. I personally never would have thought this sequence was a need I had, but it’s really cool that it’s available for those who do want it.
- have text like
-
thank you for the description! A did it and it works like a charm! It is indeed amazing what’s possible with Notepad++! Likewise it’s also amazing what a friendly and helpful community it has!