6

Is there a way to make Notepad++ auto-complete words on Tab instead of Enter?

Currently, if want to type, say, frame, then Enter to begin a new line, instead the Enter will select the first auto-complete suggestion, like frameElement:

    enter image description here

I do want the auto-complete feature, but I'd rather have a key like Tab do the actual selection, because Enter is frequently purposed toward starting a new line, whereas Tab is rarely used to indent after a word (since indenting is usually done at the start of lines), and so perhaps would be better repurposed toward auto-completion.

0

4 Answers 4

5

This undesired behavior is hard-coded into Scintilla, the text editing component that underlies Notepad++. It can be fixed by removing the following three lines from src/ScintillaBase.cxx:

        case SCI_NEWLINE:
            AutoCompleteCompleted(0, SC_AC_NEWLINE);
            return 0;

With this change, the Enter key no longer commits autocompletion. The Tab key already does that, as noted by user2427906.

It should be possible to download the source code for Notepad++ (which includes Scintilla), make the above change in scintilla\src\ScintillaBase.cxx (the code is slightly different in Notepad++ 6.9, but this shouldn’t be a problem), and then build Notepad++ from the modified source code.

I haven’t tried this because I don’t use Notepad++ nor Windows, but I did the same to Geany—another text editor based on Scintilla—and it seems to work.

0
6

Version 8.2.1 allows choosing any combination of tab and enter:

Notepad++ auto-complete settings

4

The settings for both Tab and Enter are in the Shortcut mapper on the Settings menu. See the Scintilla Commands tab.

However, you cannot change the Tab entry to Enter as Enter is already mapped.

As intimated, this is a function of the embedded Scintilla component not the fault of Notepad++ itself.

enter image description here

enter image description here

11
  • What is the name of the shortcut mapping? I don't see it anywhere.
    – Jon
    Jun 13, 2014 at 20:59
  • I've added appropriate screenshots Jun 13, 2014 at 21:07
  • 1
    Tab is 10 and Enter is 9 Jun 13, 2014 at 21:23
  • 2
    Finally found out how to do it: remove "Enter" in SCI_NEWLINE
    – Deqing
    Jun 14, 2016 at 5:34
  • 1
    There are two components to this problem: the Enter hotkey triggers SCI_NEWLINE, and SCI_NEWLINE commits autocompletion. The accepted answer deals with the latter, while this answer deals with the former. Changing the hotkey for SCI_NEWLINE is a simple change in a menu (I rebound it to Alt-Enter), while preventing SCI_NEWLINE from committing autocompletion requires editing and rebuilding the whole program from source (every time you want to change this). This answer is far superior. Jan 15, 2019 at 23:35
1

In the new version, there is no more appropriate to change the keyboard shortcut.
The effect of Tab is same as than Enter.

I am using notepad++ 6.7.3

1
  • It works for me, I'm using 6.8.6
    – Deqing
    Jun 14, 2016 at 5:33

You must log in to answer this question.

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