Modify behaviour of Enter
-
Good day,
Is it possible to modify the behaviour of Enter: thus when enter is hit, the current line goes down instead up and current cursor goes up instead of down?
Regards,
. -
@Ivan-M
Wouldn’t the caret just stay in the same place in your hypothetical scenario?
-
@Alan-Kilborn No, the caret must go upwards I presume.
-
@Ivan-M ,
So it sounds like you want to be typing bottom-up instead of top-down? That’s got to be an interesting use-case.
I thought maybe you could record a macro and assign it to the ENTER key… but shortcut mapper wisely won’t let you redefine the un-altered ENTER key – however, you can assign menu commands or macros to any of the combinations of Alt / Shift / Ctrl and the ENTER together. In fact, some of those keystrokes are already assigned.
And then I discovered, I think
Ctrl+Alt+Enter
, which is Edit > Line Operations > Insert Blank Line Above Current might actually do what you have described, if I’ve understood your description. Essentially, the cursor stays on the same line, but the line you were on gets pushed lower on the screen (to a higher line number)So if I type
First Line [ENTER] Second Line [Ctrl+Alt+ENTER]
, I end up with the following, with the cursor on line #2:
Though while I was typing this, you say “no, the caret must go upwards”. So I am not sure if you really want the cursor on line#2 when you are done, or on line #1, or somewhere else that I haven’t understood.
-
In case my mixing normal ENTER and Ctrl+Alt+ENTER was confusing, here’s another example:
Start with a blank document
Type1 [Ctrl+Alt+ENTER] 2 [Ctrl+Alt+ENTER] 3 [Ctrl+Alt+ENTER]
Your cursor will still be on a (blank) line#1, with the lines typed in reverse order:
-
Sounds like a success story.
I’ve heard of RTL (right to left) instead of LTR.
I guess we’ve now discovered BTT (bottom to top).Notepad++ offers something for everyone!
-
@PeterJones Howdy, so I didn’t understand your talk about macros as I’m a general user to notepad…But I think you got it right. If I’m typing on the first line, and when hit Enter, the contents of that line should be on the second line, and caret (current input?) must be in the first line.
I’ve tried the suggestion to use Ctrl+Alt+Enter which does exactly as I was looking for. Just hitting Enter would be better, but I’ll try to use that 3xkeys combination to see how it goes…
@Alan-Kilborn Yes, it’s new for me also. But I discovered that my notes are going upwards > whatever I enter today I want to be at the top of the <blabla>.txt file, and whatever is from yesterday, it’s somewhere down there…
But thanks lads! And have a great weekend.
-
@Ivan-M said in Modify behaviour of Enter:
@PeterJones Howdy, so I didn’t understand your talk about macros as I’m a general user to notepad…
I learned macros as a general user to Notepad++. You just have to use Macro > Start Recording, do some stuff, then Macro > Stop Recording, and Macro > Save Current Recorded Macro… it’s not that hard.
But, as we’ve discovered, it’s also not required for your current problem.
I’ve tried the suggestion to use Ctrl+Alt+Enter which does exactly as I was looking for. Just hitting Enter would be better, but I’ll try to use that 3xkeys combination to see how it goes…
You can actually redefine the keyboard combo to something other than Ctrl+Alt+Enter. If you still want it ENTER-like, but don’t want two modifiers, the
Alt+Enter
combo isn’t used in a default Notepad++ installation. So you could go to Settings > Shortcut Mapper, make sure you’re on the Main menu tab in the dialog, typeENTER
in the Filter at the bottom, click onInsert Blank Line Above Current
and Modify to edit its shortcut, then chooseAlt+Enter
instead ofCtrl+Alt+Enter
Just hitting Enter would be better
ENTER is one of the few keys you cannot really modify in Notepad++, because it’s deemed too universal. I don’t know of any text editor that allows you to redefine the ENTER key. And people accidentally editing the meaning of ENTER would be too much of a risk, and I wouldn’t want to have to support all the complaints from people who make that mistake. (And annoying the few people who want to always use BTT entry would be a price I’d be willing to pay to make sure that no one accidentally screwed up ENTER on their copy. Though, since I’m not the developer, I couldn’t decide to make it user-configurable anyway.)
-
Hello, @sabuzaki, @peterjones, @alan-kilborn and All,
If you are the only user of Notepad++ software, you could try the method below. I tested it with N++
v8.4.8.
, without any problem !
By default :
-
If you select the
Settings > Shortcut Mapper...
menu option and choose theScintilla commands
tab :- The Scintilla
SCI_NEWLINE
action ( line9
) is triggered by an hit on theEnter
key or theShift + Enter
shortcut
- The Scintilla
`
-
If you select the
Settings > Shortcut Mapper...
menu option and choose theMain menu
tab :- The
Insert Blank Line Above Current
( line50
) is trigerred by theCtrl + Alt + Enter
shortcut
- The
`
@sabuzaki, in order to get your specific behaviour, the best is to directly modify the default
shortcuts.xml
configuration file ! So :
-
Stop any instance of Notepad++
-
In the address bar of Windows Explorer, type
%AppData%\Notepad++
and valid with theEnter
key -
Select the
shortcuts.xml
file and with the sequenceCtrl + C
andCtrl + V
create a copy of this file, which is namedshortcuts - Copy.xml
-
Rename the
shortcuts.xml
file asshortcuts.SVG
-
Rename the
shortcuts - Copy.xml
file asshortcuts.xml
-
Open the
shortcuts.xml
withNotepad.exe
of Microsoft -
Near the beginning, replace the line :
<InternalCommands />
by the three lines :
<InternalCommands> <Shortcut id="42057" Ctrl="no" Alt="no" Shift="no" Key="13" /> </InternalCommands>
AND, near the end, replace the line :
</ScintillaKeys />
by the three lines :
<ScintillaKeys> <ScintKey ScintID="2329" menuCmdID="0" Ctrl="no" Alt="no" Shift="yes" Key="13" /> </ScintillaKeys>
-
Save the modifications and exit
-
Start Notepad++
=> From now on :
-
Any hit on the
Enter
key would create a new line right above the current line -
Any hit on the
Shift + Enter
shortcut would, as usual, split the current line at caret position
To revert the changes and get the default shortcuts :
-
Stop any instance of Notepad++
-
In the address bar of Windows Explorer, type
%AppData%\Notepad++
and valid with theEnter
key -
Delete or rename the present
shortcuts.xml
file -
Rename the
shortcuts.SVG
file asshortcuts.xml
-
Restart Notepad++
Best Regards,
guy038
-
-
@Sabuzaki said in Modify behaviour of Enter:
I discovered that my notes are going upwards > whatever I enter today I want to be at the top of the <blabla>.txt file, and whatever is from yesterday, it’s somewhere down there…
I suppose this makes some sense, in a limited fashion.
I keep notes in .txt files as well. Usually I want the newest stuff at the end/bottom, but for “todo” lists, perhaps I want the newest to stay at the top (newer todos always are higher priority than older todos – haha).
Your goal would make sense if such a list were only single line items, but my todos tend to span a few lines, in which case your idea for how it should be would not work (unless one has the mental acuity to type multiple-lines of related text in reverse order; not likely).
Here’s an (obfuscated) example of my recent todos, just so what I’ve said above is illustrated structurally/visually:
bpyuoc zande/gsettxtq eskh: bfs bbmcgyrfz_bhk_rooe[( bvnayyqt ms LafiGeygqpcHdan?ny avtpyt zvklbb;xrzjdxwme}[ hkyumlx. vvxvtvy oqgy sm hpatvoq gz Fyoosuxim yzx mdvbd cxrbf://pmm!mskoug!tzq/ztljjz.d=ybqtgbpw+tbglwgxhfgz+mwncnxa&pyo=4L1GOUJ_ceWB700GO410&yw=bdcbnvyq+puaxcxixkdd+&ubr=ucdfkm.2!70f46p8n224h0!2066q9i4&dthiymxy=wtpipx&tv=GTU-0 evrizg aseil/lwynrbez ytbk cag tribhhdez_llk_rfmh'[ hxnzdxth ql AhiwJefgyklMlls.gg utg: xolky://frfxtgnrntfnx?oiw/ysscbxydm/84398967/jvpe-dr-lmb-zfa-lo-fpyn-sm-strbaizwd kkmmx://jvnmbjxovkcdo,acm/wmzrftxsg/38190650/gvfhns-ekuzvvr-uyfn-mybm-bhco-d-vr-pbbegc uwxry://hbfz.gcscau.xrl/sdlgrorxe/alrlrz-yaz/6737-Vrxdgn/080713!kbob illcf://fdn?ebccdknipqth!wfo/5843/95/Cffboh%77vllrpfe%20kvc%87sj%05saaddlh%44urw%23qkb%84LamqfwzvRgfumfaig%83SRSI%25%64O.bldo