Re-bind alt left/right in nano












-1















I'd like to rebind the alt-left and alt-right keybindings in nano, can't seem to get it to work. I'm on ubuntu 16.04



my ~/.nanorc file:



bind M-right nextword main
bind M-left prevword main


version info:



GNU nano, version 2.5.3
(C) 1999..2016 Free Software Foundation, Inc.
Email: nano@nano-editor.org Web: http://www.nano-editor.org/
Compiled options: --disable-libmagic --disable-wrapping-as-root --enable-utf8









share|improve this question




















  • 1





    Taking a quick look at src/global.c where the detaults are loaded, it seemed to me that either "M-Left" (with uppercase L) or "M-←" (with U+2190, that's what's encoded in UTF-8 there) would work, however, they don't (in accordance with the docs as shown in Thomas's answer). I recommend that you file a bug / feature request in nano's bugtracker at savannah.gnu.org/bugs/?group=nano.

    – egmont
    Sep 13 '17 at 22:40













  • So I'm looking at the nano source and I found this: git.savannah.gnu.org/cgit/nano.git/tree/src/… (Line 1147) This doesn't seem to work though :/ bind M-xE2x86x90 nextword main bind M-xE2x86x92 prevword main Anyone know c?

    – Bill Johnston
    Sep 14 '17 at 0:24






  • 1





    The C compiler interprets those x escapes, and it becomes the raw UTF-8 representation of '←' as I've shown above.

    – egmont
    Sep 14 '17 at 7:00






  • 1





    See also savannah.gnu.org/bugs/?51685#comment3.

    – egmont
    Sep 14 '17 at 20:13
















-1















I'd like to rebind the alt-left and alt-right keybindings in nano, can't seem to get it to work. I'm on ubuntu 16.04



my ~/.nanorc file:



bind M-right nextword main
bind M-left prevword main


version info:



GNU nano, version 2.5.3
(C) 1999..2016 Free Software Foundation, Inc.
Email: nano@nano-editor.org Web: http://www.nano-editor.org/
Compiled options: --disable-libmagic --disable-wrapping-as-root --enable-utf8









share|improve this question




















  • 1





    Taking a quick look at src/global.c where the detaults are loaded, it seemed to me that either "M-Left" (with uppercase L) or "M-←" (with U+2190, that's what's encoded in UTF-8 there) would work, however, they don't (in accordance with the docs as shown in Thomas's answer). I recommend that you file a bug / feature request in nano's bugtracker at savannah.gnu.org/bugs/?group=nano.

    – egmont
    Sep 13 '17 at 22:40













  • So I'm looking at the nano source and I found this: git.savannah.gnu.org/cgit/nano.git/tree/src/… (Line 1147) This doesn't seem to work though :/ bind M-xE2x86x90 nextword main bind M-xE2x86x92 prevword main Anyone know c?

    – Bill Johnston
    Sep 14 '17 at 0:24






  • 1





    The C compiler interprets those x escapes, and it becomes the raw UTF-8 representation of '←' as I've shown above.

    – egmont
    Sep 14 '17 at 7:00






  • 1





    See also savannah.gnu.org/bugs/?51685#comment3.

    – egmont
    Sep 14 '17 at 20:13














-1












-1








-1








I'd like to rebind the alt-left and alt-right keybindings in nano, can't seem to get it to work. I'm on ubuntu 16.04



my ~/.nanorc file:



bind M-right nextword main
bind M-left prevword main


version info:



GNU nano, version 2.5.3
(C) 1999..2016 Free Software Foundation, Inc.
Email: nano@nano-editor.org Web: http://www.nano-editor.org/
Compiled options: --disable-libmagic --disable-wrapping-as-root --enable-utf8









share|improve this question
















I'd like to rebind the alt-left and alt-right keybindings in nano, can't seem to get it to work. I'm on ubuntu 16.04



my ~/.nanorc file:



bind M-right nextword main
bind M-left prevword main


version info:



GNU nano, version 2.5.3
(C) 1999..2016 Free Software Foundation, Inc.
Email: nano@nano-editor.org Web: http://www.nano-editor.org/
Compiled options: --disable-libmagic --disable-wrapping-as-root --enable-utf8






ubuntu terminal keyboard-shortcuts nano






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 13 '17 at 20:27









Thomas Dickey

53.8k5103176




53.8k5103176










asked Sep 12 '17 at 17:53









Bill JohnstonBill Johnston

991




991








  • 1





    Taking a quick look at src/global.c where the detaults are loaded, it seemed to me that either "M-Left" (with uppercase L) or "M-←" (with U+2190, that's what's encoded in UTF-8 there) would work, however, they don't (in accordance with the docs as shown in Thomas's answer). I recommend that you file a bug / feature request in nano's bugtracker at savannah.gnu.org/bugs/?group=nano.

    – egmont
    Sep 13 '17 at 22:40













  • So I'm looking at the nano source and I found this: git.savannah.gnu.org/cgit/nano.git/tree/src/… (Line 1147) This doesn't seem to work though :/ bind M-xE2x86x90 nextword main bind M-xE2x86x92 prevword main Anyone know c?

    – Bill Johnston
    Sep 14 '17 at 0:24






  • 1





    The C compiler interprets those x escapes, and it becomes the raw UTF-8 representation of '←' as I've shown above.

    – egmont
    Sep 14 '17 at 7:00






  • 1





    See also savannah.gnu.org/bugs/?51685#comment3.

    – egmont
    Sep 14 '17 at 20:13














  • 1





    Taking a quick look at src/global.c where the detaults are loaded, it seemed to me that either "M-Left" (with uppercase L) or "M-←" (with U+2190, that's what's encoded in UTF-8 there) would work, however, they don't (in accordance with the docs as shown in Thomas's answer). I recommend that you file a bug / feature request in nano's bugtracker at savannah.gnu.org/bugs/?group=nano.

    – egmont
    Sep 13 '17 at 22:40













  • So I'm looking at the nano source and I found this: git.savannah.gnu.org/cgit/nano.git/tree/src/… (Line 1147) This doesn't seem to work though :/ bind M-xE2x86x90 nextword main bind M-xE2x86x92 prevword main Anyone know c?

    – Bill Johnston
    Sep 14 '17 at 0:24






  • 1





    The C compiler interprets those x escapes, and it becomes the raw UTF-8 representation of '←' as I've shown above.

    – egmont
    Sep 14 '17 at 7:00






  • 1





    See also savannah.gnu.org/bugs/?51685#comment3.

    – egmont
    Sep 14 '17 at 20:13








1




1





Taking a quick look at src/global.c where the detaults are loaded, it seemed to me that either "M-Left" (with uppercase L) or "M-←" (with U+2190, that's what's encoded in UTF-8 there) would work, however, they don't (in accordance with the docs as shown in Thomas's answer). I recommend that you file a bug / feature request in nano's bugtracker at savannah.gnu.org/bugs/?group=nano.

– egmont
Sep 13 '17 at 22:40







Taking a quick look at src/global.c where the detaults are loaded, it seemed to me that either "M-Left" (with uppercase L) or "M-←" (with U+2190, that's what's encoded in UTF-8 there) would work, however, they don't (in accordance with the docs as shown in Thomas's answer). I recommend that you file a bug / feature request in nano's bugtracker at savannah.gnu.org/bugs/?group=nano.

– egmont
Sep 13 '17 at 22:40















So I'm looking at the nano source and I found this: git.savannah.gnu.org/cgit/nano.git/tree/src/… (Line 1147) This doesn't seem to work though :/ bind M-xE2x86x90 nextword main bind M-xE2x86x92 prevword main Anyone know c?

– Bill Johnston
Sep 14 '17 at 0:24





So I'm looking at the nano source and I found this: git.savannah.gnu.org/cgit/nano.git/tree/src/… (Line 1147) This doesn't seem to work though :/ bind M-xE2x86x90 nextword main bind M-xE2x86x92 prevword main Anyone know c?

– Bill Johnston
Sep 14 '17 at 0:24




1




1





The C compiler interprets those x escapes, and it becomes the raw UTF-8 representation of '←' as I've shown above.

– egmont
Sep 14 '17 at 7:00





The C compiler interprets those x escapes, and it becomes the raw UTF-8 representation of '←' as I've shown above.

– egmont
Sep 14 '17 at 7:00




1




1





See also savannah.gnu.org/bugs/?51685#comment3.

– egmont
Sep 14 '17 at 20:13





See also savannah.gnu.org/bugs/?51685#comment3.

– egmont
Sep 14 '17 at 20:13










2 Answers
2






active

oldest

votes


















0














It doesn't work because





  • nano does not have a way to bind the cursor-keys (left, right, up, down), and

  • those keys do not correspond to a character, and

  • your cursor-keys send a character sequence which nano does not understand.


Referring to the manual:




The format of key should be one of:



^ followed by an ASCII character or the word "Space". Example: ^C.
M- followed by a ASCII character or the word "Space". Example: M-C.
F followed by a numeric value from 1 to 16. Example: F10.




The manual also mentions that you can use an escape character before the ASCII character when entering a key, though that would not help in this case because your cursor-keys send several ASCII characters, e.g.,



escape[1;3D



for the "Alt-left" which several terminal emulators (beginning with xterm) use.






share|improve this answer































    0














    If you see messages like [ backup files enabled ] when you try those shortcuts, it means they are producing Alt+B and Alt+F escape sequences. So you can just rebind those like so:



    unbind M-B all 
    bind M-B prevword main
    unbind M-F all
    bind M-F nextword main


    See this bug report thread for more info.






    share|improve this answer

























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f391845%2fre-bind-alt-left-right-in-nano%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      It doesn't work because





      • nano does not have a way to bind the cursor-keys (left, right, up, down), and

      • those keys do not correspond to a character, and

      • your cursor-keys send a character sequence which nano does not understand.


      Referring to the manual:




      The format of key should be one of:



      ^ followed by an ASCII character or the word "Space". Example: ^C.
      M- followed by a ASCII character or the word "Space". Example: M-C.
      F followed by a numeric value from 1 to 16. Example: F10.




      The manual also mentions that you can use an escape character before the ASCII character when entering a key, though that would not help in this case because your cursor-keys send several ASCII characters, e.g.,



      escape[1;3D



      for the "Alt-left" which several terminal emulators (beginning with xterm) use.






      share|improve this answer




























        0














        It doesn't work because





        • nano does not have a way to bind the cursor-keys (left, right, up, down), and

        • those keys do not correspond to a character, and

        • your cursor-keys send a character sequence which nano does not understand.


        Referring to the manual:




        The format of key should be one of:



        ^ followed by an ASCII character or the word "Space". Example: ^C.
        M- followed by a ASCII character or the word "Space". Example: M-C.
        F followed by a numeric value from 1 to 16. Example: F10.




        The manual also mentions that you can use an escape character before the ASCII character when entering a key, though that would not help in this case because your cursor-keys send several ASCII characters, e.g.,



        escape[1;3D



        for the "Alt-left" which several terminal emulators (beginning with xterm) use.






        share|improve this answer


























          0












          0








          0







          It doesn't work because





          • nano does not have a way to bind the cursor-keys (left, right, up, down), and

          • those keys do not correspond to a character, and

          • your cursor-keys send a character sequence which nano does not understand.


          Referring to the manual:




          The format of key should be one of:



          ^ followed by an ASCII character or the word "Space". Example: ^C.
          M- followed by a ASCII character or the word "Space". Example: M-C.
          F followed by a numeric value from 1 to 16. Example: F10.




          The manual also mentions that you can use an escape character before the ASCII character when entering a key, though that would not help in this case because your cursor-keys send several ASCII characters, e.g.,



          escape[1;3D



          for the "Alt-left" which several terminal emulators (beginning with xterm) use.






          share|improve this answer













          It doesn't work because





          • nano does not have a way to bind the cursor-keys (left, right, up, down), and

          • those keys do not correspond to a character, and

          • your cursor-keys send a character sequence which nano does not understand.


          Referring to the manual:




          The format of key should be one of:



          ^ followed by an ASCII character or the word "Space". Example: ^C.
          M- followed by a ASCII character or the word "Space". Example: M-C.
          F followed by a numeric value from 1 to 16. Example: F10.




          The manual also mentions that you can use an escape character before the ASCII character when entering a key, though that would not help in this case because your cursor-keys send several ASCII characters, e.g.,



          escape[1;3D



          for the "Alt-left" which several terminal emulators (beginning with xterm) use.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Sep 13 '17 at 20:26









          Thomas DickeyThomas Dickey

          53.8k5103176




          53.8k5103176

























              0














              If you see messages like [ backup files enabled ] when you try those shortcuts, it means they are producing Alt+B and Alt+F escape sequences. So you can just rebind those like so:



              unbind M-B all 
              bind M-B prevword main
              unbind M-F all
              bind M-F nextword main


              See this bug report thread for more info.






              share|improve this answer






























                0














                If you see messages like [ backup files enabled ] when you try those shortcuts, it means they are producing Alt+B and Alt+F escape sequences. So you can just rebind those like so:



                unbind M-B all 
                bind M-B prevword main
                unbind M-F all
                bind M-F nextword main


                See this bug report thread for more info.






                share|improve this answer




























                  0












                  0








                  0







                  If you see messages like [ backup files enabled ] when you try those shortcuts, it means they are producing Alt+B and Alt+F escape sequences. So you can just rebind those like so:



                  unbind M-B all 
                  bind M-B prevword main
                  unbind M-F all
                  bind M-F nextword main


                  See this bug report thread for more info.






                  share|improve this answer















                  If you see messages like [ backup files enabled ] when you try those shortcuts, it means they are producing Alt+B and Alt+F escape sequences. So you can just rebind those like so:



                  unbind M-B all 
                  bind M-B prevword main
                  unbind M-F all
                  bind M-F nextword main


                  See this bug report thread for more info.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 1 hour ago









                  drmercer

                  52




                  52










                  answered Sep 14 '17 at 20:58









                  Bill JohnstonBill Johnston

                  991




                  991






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f391845%2fre-bind-alt-left-right-in-nano%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      宮崎県

                      濃尾地震

                      シテ島