TL;DR - How can I enable virtual spaces to move the cursor past the end of a line of text?

Long version - In Notepad++, when trying to select (using the mouse) a long line of text that extends past the right edge of the window, causing it to scroll horizontally, my mouse will sometimes go slightly up or down enough to move the cursor to the adjacent (usually much shorter) line, causing the cursor to snap back to the left where that adjacent line ends; which in turn scrolls the window horizontally back to the left, making it difficult to quickly readjust and finish dragging out my selection.

Some (though woefully few) text editors have an option for "virtual spaces", or cursoring past the EOL, to make it much easier to mouse/arrow around without being restricted to existing text/whitespace.

How can I make this happen in Notepad++ (without hacking the source myself)?

  • 1
    start of line, hold SHIFT + END, have the whole line selected? I know it's not the same as what you wanted, but it's what I do.
    – Rob
    Mar 16, 2012 at 17:50
  • 1
    Not what you ask, but the problem would go away with line wrapping.
    – Eroen
    Mar 16, 2012 at 17:55
  • @Rob: This is generally an issue when I'm trying to select a specific long chunk of a very long line of code, but that line is intermingled with other much shorter lines. I could also use SHIFT + CTRL + RIGHTARROW to quickly select rightward from my starting point one word at a time, Notepad++ is pretty good at detecting word-break characters such as periods, parentheses, etc. when there aren't any actual spaces separating words (such as in a long object reference) e.g. (javascript): someObjectName.subObject.property['index'](parameter)
    – acatalept
    Mar 16, 2012 at 18:00
  • @Eroen: glad you suggested this, I haven't used word-wrap in N++ for a long time, as it used to bring the program to its knees with large files... but it actually works very nicely even for my bigger 20k line files, and even lines up indents on wrapped lines ;)
    – acatalept
    Mar 16, 2012 at 18:05

2 Answers 2


Sort of a hack (sends a window message directly to the Scintilla edit control on startup), but works great:

  1. Install NppExec plugin

  2. Go to Plugins -> NppExec -> Execute

  3. Enter the following code:

    // ensure console stays hidden
    // enable virtual spaces (cursor past end of line) outside column edit mode
    SCI_SENDMSG 2596 3 0
    // SCI_SENDMSG == send message to Scintilla edit control
    // 2596 == the message we're sending is SCI_SETVIRTUALSPACEOPTIONS
    // the default value is 1 (just SCVS_RECTANGULARSELECTION) for
    //   virtual spaces in column select mode only
    // you can find these values by poking around the source code a bit, or
    // see http://www.scintilla.org/ScintillaDoc.html
  4. Click the Save button at the bottom, and give the script a name

  5. Now go to Plugins -> NppExec -> Advanced Options

  6. On the right, under "Execute this script when Notepad++ starts", select the script name you just saved

  7. Click OK, close/reopen Notepad++, and enjoy ;)

  • where are message codes like 2596 documented for other scintilla commands? poking Scintilla.h only? currently at tortoisesvn.googlecode.com/svn/trunk/ext/scintilla/include/… ?
    – n611x007
    Dec 21, 2012 at 8:07
  • What is 0 in SCI_SENDMSG 2596 3 0 ?
    – n611x007
    Dec 21, 2012 at 8:10
  • @naxa: see the Scintilla documentation for the message codes, e.g. scintilla.org/ScintillaDoc.html#SCI_SETVIRTUALSPACEOPTIONS (I believe the 3rd parameter is unused for most of these, but must be set to 0 rather than omitted)
    – acatalept
    Dec 21, 2012 at 16:29
  • "Sort of a hack" - a hack means accessing something that the software was not supposed to do. This looks like a feature to me. Dec 21, 2012 at 16:37
  • 1
    More recent nppExec versions (>0.4.3?) have an experimental-looking feature to look up the function number for you by name, eg. SCI_SENDMSG SCI_POSITIONFROMLINE 83 0 works.
    – n611x007
    Dec 21, 2012 at 20:45

With no admin rights, install NppExec by downloading the dll and installing to npp's plugins o/s directory/folder. Close/reopen npp.

Edit (+2 years): I don't know if this has changed but we now (if not originally) put the NppExec folder into npp's plugins folder - with the dll in the NppExec sub-folder.

Also make sure versions match (remind yourself whether you're on 32bit or 64), and if you have a recent version (2019), you might need the _PA version of NppExec.

Why am I unable to install the NppExec plugin for Notepad++?

  • Something has changed in Notepad++. The Execute is not there anymore. Are there corrections to this?
    – user215779
    Dec 6, 2017 at 13:27

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.