• Login
Community
  • Login

Modify behaviour of Enter

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
10 Posts 4 Posters 2.1k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    Sabuzaki
    last edited by Jan 20, 2023, 8:07 PM

    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,
    .

    A P 2 Replies Last reply Jan 20, 2023, 8:13 PM Reply Quote 0
    • A
      Alan Kilborn @Sabuzaki
      last edited by Jan 20, 2023, 8:13 PM

      @Ivan-M

      Wouldn’t the caret just stay in the same place in your hypothetical scenario?

      S 1 Reply Last reply Jan 20, 2023, 8:21 PM Reply Quote 0
      • S
        Sabuzaki @Alan Kilborn
        last edited by Jan 20, 2023, 8:21 PM

        @Alan-Kilborn No, the caret must go upwards I presume.

        1 Reply Last reply Reply Quote 0
        • P
          PeterJones @Sabuzaki
          last edited by PeterJones Jan 20, 2023, 8:23 PM Jan 20, 2023, 8:23 PM

          @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:
          23d2d82c-47cd-4bce-b378-f46eef470ec1-image.png

          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.

          P S 2 Replies Last reply Jan 20, 2023, 8:29 PM Reply Quote 1
          • P
            PeterJones @PeterJones
            last edited by Jan 20, 2023, 8:29 PM

            In case my mixing normal ENTER and Ctrl+Alt+ENTER was confusing, here’s another example:

            Start with a blank document
            Type 1 [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:
            e04db791-3805-4566-bcb2-857de09822ee-image.png

            A 1 Reply Last reply Jan 20, 2023, 8:31 PM Reply Quote 3
            • A
              Alan Kilborn @PeterJones
              last edited by Jan 20, 2023, 8:31 PM

              @PeterJones

              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!

              1 Reply Last reply Reply Quote 1
              • S
                Sabuzaki @PeterJones
                last edited by Jan 20, 2023, 8:43 PM

                @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.

                P A 2 Replies Last reply Jan 20, 2023, 8:52 PM Reply Quote 0
                • P
                  PeterJones @Sabuzaki
                  last edited by PeterJones Jan 20, 2023, 8:54 PM Jan 20, 2023, 8:52 PM

                  @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, type ENTER in the Filter at the bottom, click on Insert Blank Line Above Current and Modify to edit its shortcut, then choose Alt+Enter instead of Ctrl+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.)

                  1 Reply Last reply Reply Quote 3
                  • G
                    guy038
                    last edited by guy038 Jan 20, 2023, 11:28 PM Jan 20, 2023, 11:20 PM

                    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 the Scintilla commands tab :

                      • The Scintilla SCI_NEWLINE action ( line 9 ) is triggered by an hit on the Enter key or the Shift + Enter shortcut

                    `

                    • If you select the Settings > Shortcut Mapper... menu option and choose the Main menu tab :

                      • The Insert Blank Line Above Current ( line 50 ) is trigerred by the Ctrl + Alt + Enter shortcut

                    `

                    @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 the Enter key

                    • Select the shortcuts.xml file and with the sequence Ctrl + C and Ctrl + V create a copy of this file, which is named shortcuts - Copy.xml

                    • Rename the shortcuts.xml file as shortcuts.SVG

                    • Rename the shortcuts - Copy.xml file as shortcuts.xml

                    • Open the shortcuts.xml with Notepad.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 the Enter key

                    • Delete or rename the present shortcuts.xml file

                    • Rename the shortcuts.SVG file as shortcuts.xml

                    • Restart Notepad++

                    Best Regards,

                    guy038

                    1 Reply Last reply Reply Quote 1
                    • A
                      Alan Kilborn @Sabuzaki
                      last edited by Jan 21, 2023, 11:36 AM

                      @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
                      
                      1 Reply Last reply Reply Quote 1
                      10 out of 10
                      • First post
                        10/10
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors