Turn on cursor beyond EOL + Remove unnecessary spaces when saving
Turbo Pascal, Delphi and many other editors have a very convenient setting, that is “Cursor beyond EOL”. Then a related option: “Remove unneded spaces on save”, which removes unnecesary spaces from each line, BUT not the empty lines at the end of the document.
Is there a similar setting in NPP - or there is a hack to achieve this?
The sticky cursor is very annoying when
- navigating among very lone and very short lines when the cursor initially was toward the end of a long line
- mouse-selecting long lines and the mouse cursor goes below or above the line being selected
- editing indented text with multiple columns
For example, Python or Lua Script could be used to register for file saved message and act on behalf.
Do you know Edit->Blank Operations->Trim Trailing Spaces? Is this what you are looking for?
Don’t get the point about the cursor? Could you elaborate on it?
Did you Google “Notepad++ cursor beyond end of line”? Seems hard to believe that you didn’t, as pretty much that exact phrase occurs in your posting.
Here is the first hit, and it works as I’ve pointed others here before:
There is also a Pythonscript way to accomplish the same thing.
I’m often using Edit->Blank Operations->Trim Trailing Spaces, however due to indentation, lots of tab-filled empty lines are created during edit, so this menu points needs to be used frequently to keep the text clean.
What was I thinking is an option with checkbox
[x] Trim trailing spaces on save,
of course, clear by default.
Yes I googled, and I found the solution you linked, however, again this is a suggestion of having this option out-of-the-box in NPP, which is Settings -> Preferences -> [x] Cursor beyond EOL.
Also, since any plugin may easily crash NPP (for example after a major update), I prefer to keep the plugin list short as possible :-)
I’m sorry to have to tell you this, but you do not have realistic expectations for Notepad++. The two things you suggest will never be implemented (my prediction), simply because they, in effect, already exist. You just don’t want them in the form that they exist. Power users of Notepad++ have long gotten over such desires, because for one they see that they never get implemented, and secondly that it is not that important how the functionality is implemented as long as it is.
Did you try
Shortcut Mapper --> Macros.
As @gstavi pointed out, the
Shortcut Mapper > Macrosshows the shortcut for the
Macro > Trim Trailing And Save(TT&S). There’s no need to tick a setting box to change save-mode: just use the shortcut appropriate to the command you want.
Moreover, if you want to usually use TT&S instead of a normal Save, you can do a shortcut swap (like I do): Using the Shortcut Mapper, set the TT&S shortcut to
Ctrl+S, then (still in the shortcut mapper) go to
Main menu > Saveand change its shortcut to
Alt+Shift+S(which is what TT&S was). This results in your standard
Ctrl+Sdoing a TT&S, and the alternate shortcut (or the Save button on the toolbar) doing a standard Save (without trim).