11

In sublimetext I often use the key combination CTRL+A, CTRL+SHIFT+L, END to frequently highlight all rows and continue editing each line with common text. (See pic)

What would the key combination be for this in notepad++ or can you not do this at all in notepad++?

enter image description here

5
  • What do you mean with: "start mass editing lines"? Settings > Shorcut Mapper ... allows to view/modify/create shortcut.
    – Toto
    Apr 23, 2019 at 15:38
  • I will get the cursor on every line, at the end of each line. You can get this in notepad++ with CTRL+ALT+Move Mouse to where you want across multiple lines, but I want to be able to do this with keyboard shortcuts across the entire document. I often have too many rows to scroll down.
    – TEEKAY
    Apr 23, 2019 at 16:52
  • Could you explain what you are trying to do? May be there are some other ways to do the job.
    – Toto
    Apr 23, 2019 at 17:07
  • I've added a pic of what I'm trying to accomplish.
    – TEEKAY
    Apr 23, 2019 at 17:42
  • If you want to append common text to the end of each line, have you considered using a Regex search/replace?
    – Doug Deden
    Apr 23, 2019 at 18:16

10 Answers 10

9

I'm afraid there is no such behaviour in Notepad++, but you can do Find/Replace, here is a way to go:

  • Ctrl+H
  • Find what: $
  • Replace with: whatever you want at the end of each line
  • check Wrap around
  • check Regular expression
  • Replace all
7
  • 2
    Appreciate the digging. Not what I wanted to hear but it's a good workaround. It's really the only feature keeping me away from notepad++ for my daily stuff right now.
    – TEEKAY
    Apr 23, 2019 at 19:44
  • 1
    If only the arrow keys and end/home keys worked with multi-select, as it does in every other program I've used. :-( Then the Click, Shift-Alt-Click (or Shift-Alt, Click-Drag) method, followed by "end", or "cursor-left" tricks world work, as they do everywhere else. I agree it is frustrating. Jan 3, 2021 at 19:36
  • I have written a proper solution in answer below - superuser.com/a/1776670/194248
    – Vladan
    Mar 31, 2023 at 11:23
  • @Vladan: In which way your answer is better than mine?
    – Toto
    Mar 31, 2023 at 12:04
  • @Toto In essence, the difference is truly vast. TEEKAY has illustrated it brilliantly, even with images. I kindly ask you to attempt what he has demonstrated in the screenshots, and you'll see how much more efficient and productive it is compared to the traditional RegEx Search-Replace.
    – Vladan
    Apr 4, 2023 at 20:11
9

Notepad++ don't has one option/shortcut to easily get multiple carets at the end of several lines. But you can do some of these tricks:

Remember you need to enable always the Multi-Editing on Settings/Preferences/Editing/Enable Multi-Editing checkbox.

You have 2 options:

Option 1 - Without any extra plugin

  • CTRL+click on each line (it doesn't matter in which part of the line you click) you want to add one caret to the end.
  • When you placed a cursor on each line you want to edit, press END key to move all carets to the end of the line they were placed.

Option 2 - Using BetterMultiselection Plugin

  • Install the BetterMultiSelection Plugin within the Plugins Admin window (on Plugins menu)
  • After the restart of Notepad++ you need to enable the BetterMultiSelection plugin on the plugins menu.
  • Do a column selection with ALT+mouse
  • Press END key.
  • Voila ;-)
3
  • Nice, I wasn't aware of that. +1
    – Toto
    Jan 14, 2021 at 17:55
  • Actually, this isn't what was requested, since the idea is that when you create a selection, a caret should be placed at the end of each line, rather than at the end of the entire selection.
    – Vladan
    Mar 31, 2023 at 11:10
  • The requested feature is a function that originates from the Sublime Text days (see Splitting the Selection into Lines), which VSCode also adopted as the command "insertCursorAtEndOfEachLineSelected".
    – Vladan
    Mar 31, 2023 at 11:10
1

This answer is a bit late, but I hope to be useful...

You could achieve this by Ctrl+Click (with Multi-Editing enabled) at the end of each line you want to manipulate. Then just type whatever you'd like to append. Not so sophisticated, but works for small number of lines.

1

This will give us the much-loved function originating from the Sublime Text days as Splitting the Selection into Lines which VSCode also adopted as the command "insertCursorAtEndOfEachLineSelected".

You must install the Notepad++ plugin LuaScript. Then, insert this code into startup.lua.

npp.AddShortcut("Insert Cursor At End Of Selected Lines", "Ctrl+Shift+L", function ()
    local cursors = {}

    editor:BeginUndoAction()
    for i = 0, editor.Selections - 1 do
        local firstLine, lastLine = editor:LineFromPosition(editor.SelectionNStart[i]), editor:LineFromPosition(editor.SelectionNEnd[i])
        for line = firstLine, lastLine do
            cursors[#cursors + 1] = editor.LineEndPosition[line]
        end
    end

    editor:ClearSelections()
    for _, cursor in ipairs(cursors) do
        editor:AddSelection(cursor, cursor)
    end
    
    editor:EndUndoAction()
end)

1
  • At last, the right solution. Yeees! Apr 4, 2023 at 20:17
0

You can do this with the column mode. This functionality is enabled by default. To switch to column mode, there are two ways to do it: Alt + Shift + Arrow keys or: Alt + Mouse dragging To use the keyboard, you need to use the Alt + Shift + Arrow keys. By using the keyboard you have more control over which words or characters you want to work with.

2
  • 3
    This is working only if the lines have the same length.
    – Toto
    Feb 21, 2020 at 16:43
  • This will not simply move the multicursor to where you want it. It instead extends the full selection. Everything selected will then be deleted/replaced with whatever you type next. Jan 3, 2021 at 19:39
0

If you align all the text to the right, you can then use Alt + Click.

Guide on how to align all the text to the right: https://stackoverflow.com/questions/47012492/how-to-align-text-to-the-right-with-notepad

0

If you want to add stuff at the end of every line in Notepad++. An alternative is to use Macro.

  1. Set your cursor at the beginning of the first line
  2. Go to Macro menu and press start recording
  3. press END and type in what text you want to add
  4. press right arrow key so you come to next line
  5. Go to macro menu and stop recording.

you can now use that macro on a single line or on all lines. Enjoy.

0

In March 2024 there's a simple, easy way. (Windows) While holding the ALT key, if I left-click and drag my mouse down, then every line I cross with the mouse, a cursor will be placed there.

2
  • 1
    That doesn't work when lines don't have same length.
    – Toto
    Mar 12 at 20:08
  • I'm on version 8.6.4 and it works for me regardless of the length of the lines.
    – NiceStats
    Apr 1 at 14:20
0

Since Notepad++ 8.6.x, multi-editing has been updated. The manual is still a bit unclear, but what @TEEKAY asked for (and what a lot of replies here do not seem to answer), is now definitely possible with only key strokes!

The keyboard-only way to do this, would be to:

Option 1 (for a very long file)

  • Disable word-wrap (if you have any long lines; would have been a problem with Sublime also)
  • Go to the end of any line in the file End
  • Select the line-ending Shift+RightArrow
  • Select from the menu: Edit | Multi-select All | Match Case Only (you can do this with keys; you could even assign a short-cut to it)

This will enable Multi-editing on all line-endings in the file (it searches whatever is selected in the file and adds a editing point for it). Your cursors now will be on the start of all lines, except the first one.

  • Go up one line to also include the first line or fix that one separately UpArrow (this is one of the places where word wrap could land you in trouble)
  • Go to the ends of the lines End
  • Do what it was you wanted to do to the end of all lines

Option 2. If your file isn't ridiculously long, you could probably easier do:

  • Go to the start of the first line you want edited
  • Press Alt+Shift+DownArrow until you are at the last one you need to edit (or the end of the file).

You will now have started multi-editing all these lines. And again:

  • Go to the ends of the lines End
  • Do what it was you wanted to do to the end of all lines
-1

Here is how we select from line 10 to line 20

Right Click , select Begin/End select for line 10

Right Click , select Begin/End select for line 20

Now click delete and it will remove the lines selected.

3
  • 1
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jun 15, 2022 at 15:16
  • This doesn't answer the question, reread it.
    – Toto
    Jun 15, 2022 at 15:47
  • Hello @Toto, Yes I agree, I have misread the question.
    – Sri
    Jun 15, 2022 at 15:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .