29

Microsoft OneNote has a handy shortcut (Ctrl+A) that I use all the time to select an entire line.  And if you click it a second time it selects the entire document.

I really would like to use Ctrl+A as shortcut in Notepad++ to select the current line, but its default is to select the entire document.  Is there a way to make it select only the entire current line?

1
  • 1
    Just to add, Microsoft OneNote can also select entire document with Ctrl + A shortcut. Just keep pressing Ctrl and press A multiple times, it expands selection from line to section to entire document. Sep 5 '18 at 16:20
34

Press Home then Shift+End.

End then Shift+Home can also be used. If you need to select the line from the very beginning instead of the first indented character, press Home twice.

You can also record this as a macro and then set a shortcut to that macro. However Ctrl+A is used as select all in almost all text editors and textboxes, thus changing it could make things more confusing. Use another shortcut instead

If you just want to copy/cut/delete the lines, there are already shortcuts for you:

  • Line delete Ctrl+Shift+L
  • Line cut Ctrl+L
  • Line copy Ctrl+Shift+T (changed to Ctrl+Shift+X in newer Notepad++)

There are also other actions without default shortcuts like line transpose, line join, line duplicate... Just select Settings > Shortcut mapper > Scintilla commands, select SCI_LINETRANSPOSE / SCI_LINEDUPLICATE / SCI_LINESJOIN... and assign them.

If Ctrl+Shift+T doesn't work for you then it's because the shortcut has been assigned to 2 different features, causing a conflict as PryrtCJ answered below. In newer Notepad++ line copy has been changed to Ctrl+Shift+X, and a shortcut conflict warning has also been added, making life a bit easier

enter image description here

See Lists of default mouse and keyboard shortcuts for Notepad++ and some plugins

If you're using a mouse, single click the line number on the left or triple click in the line also do the trick.

6
  • 6
    I can confirm that CTRL+Shift+T *** DOES NOT WORK!!! *** Windows 10, NPP 6.8.6. My results are that NPP is trying to create a new file for some reason. I'm not sure why. Possibly related to a plugin? Hope this helps somebody. I've seen this "solution" on 3 different website. At least for me, it does NOT work. Dec 23 '15 at 21:39
  • 1
    Ctrl-Shift-T did not work for me either. Win7, NPP 6.8.3. Single-clicking the line number and then Ctrl-C was the fastest way for me.
    – dvdhns
    Feb 18 '16 at 22:40
  • @CodeSlayer2010 did you try opening the Scintilla commands like I said? Maybe your shortcuts have been modified somehow or you're using a different language, hence different shortcut. Just change SCI_LINECOPY to whatever you want.
    – phuclv
    Feb 19 '16 at 4:43
  • @dvdhns while typing how is that faster than a single shortcut when you needs to move your hand to find the mouse then press shortcut?
    – phuclv
    Feb 19 '16 at 4:45
  • @LưuVĩnhPhúc: Thanks for your reply. I did not try that because I didn't want to go through the effort of remapping my keys. But, it does sound like the scintilla commands could be a good place to check to see if something else may have altered them. Apr 15 '16 at 16:03
7

For those for whom the accepted answer doesn't work: I just answered a similar concern in the Notepad++ Community. Basically, there are two commands associated with Ctrl+Shift+T shortcut simultaneously, and the other appears to be taking preference.

If you would prefer Ctrl+Shift+T to reference SCI_LINECOPY, find the conflicting command (for example, Shortcut Mapper >> Main menu >> Restore Recent Closed File, which is what's causing the conflict in my copy of NPP), select Modify, then change the dropdown letter from T to NONE and hit OK. Assuming there are no more conflicts, the shortcut will revert to SCI_LINECOPY.

Hope this helps.

2
  • Good Input, Can you please explain the significance of SCI commands than the ones on main menu? Jul 15 '16 at 11:49
  • Sorry, I'm not an expert at the Scintilla commands. I just found two actions mapped to the same keyboard shortcut, and figured out which one to disable so the shortcut would do what I want it to. :-)
    – PeterCJ
    Aug 23 '16 at 19:59
7

In NPP7.5.1 SCI_LINECOPY is assigned to Shift+Ctrl+X

So you can use Shift+Ctrl+X to copy current line to the clipboard

0

I think you can make it via Macro.

  1. Go to Macro > Start recording
  2. Hold Shift and tap Down to mark for example 10 lines . And delete them.
  3. Go to Macro > Stop Recording. Now your macro is recorded, you can save it for using in the future .
  4. Go to Macro > Save Current Recording Macro... . And save it with a name .
  5. Move cursor to line that you want to delete lines after that.Then go to Macro > Run A Macro Multiple Times... . And select your macro and run it N times that you want.

Reference: https://stackoverflow.com/questions/19161262/select-range-of-lines-in-notepad

4
  • 4
    Q: How can I select a line using the keyboard?  A: Here's a way to delete 10 lines.  You'll need to click the mouse a few times whenever you use it.     What? Jul 30 '15 at 5:31
  • @G-Man Since you can assign a shortcut to macros this solution is perfectly viable. The Macro should probably contain the operations from the answer provided by LưuVĩnhPhúc, though.
    – JC2k8
    Jul 30 '15 at 6:54
  • i think my solution fit Macondo question,you can do nearly everything with Marco
    – CuongDC
    Jul 30 '15 at 7:39
  • 1. He wants to delete the current line, not 10 lines. 2. Pressing down 10 times just make the selection to some position on the 10th line. It doesn't select the whole 10 lines
    – phuclv
    Apr 16 '16 at 3:20
0

Just click 3 times to a word or line

1
  • 3
    clicking isn't a keyboard shortcut. And even if the mouse can be used then just a single click on the left of the line number is enough. No need for a triple click
    – phuclv
    May 9 '19 at 14:47
0

Press Shift+Home if the cursor is at the end of the line. Press Shift+End, if the cursor is at the beginning of the line.

OR press Home key to get to the start of the line, and then press Shift+End.

OR press End key to get to the end of the line, and then press Shift+Home.

1
  • 1
    isn't that the same as what I answered above?
    – phuclv
    Jan 6 '20 at 9:36
-1

Shift + End -- selects the entire line after the cursor.

3
  • That is not what it is asked.
    – Toto
    Feb 27 '18 at 14:00
  • 1
    It's OK for selecting an entire line, if the cursor is already at the start of the line. Consider to add the key Home in front of the shortcut in your answer.
    – MarianD
    May 9 '19 at 0:11
  • 1
    this is no different than my answer 3 years before, and it's also less correct
    – phuclv
    Aug 1 '19 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.