How do I convert inputrc settings to bashrc ones?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite
2












I'd like to keep my modifications to as few files as possible, so I don't want to touch .inputrc unless I absolutely have to. So, given .inputrc lines like:



"e[5~": history-search-backward
"e[6~": history-search-forward


How can I apply them only using bash?



This SU post indicated that bind could read from .inputrc, and bind's help says:



$ help bind
bind: bind [-lpsvPSVX] [-m keymap] [-f filename] [-q name] [-u name] [-r keyseq] [-x keyseq:shell-command] [keyseq:readline-function or readline-command]


history-search-* look like readline functions, so I tried:



bind "e[6~":history-search-forward
bind "e[5~":history-search-backward


Page Up now triggers a bell, Page Down printed a ~.



Is there a general way for me to use inputrc lines in bash?










share|improve this question



















  • 1




    One reason to use .inputrc here, though, is so that the key bindings are available in any program that uses readline, not just bash.
    – chepner
    Sep 25 '15 at 13:43














up vote
3
down vote

favorite
2












I'd like to keep my modifications to as few files as possible, so I don't want to touch .inputrc unless I absolutely have to. So, given .inputrc lines like:



"e[5~": history-search-backward
"e[6~": history-search-forward


How can I apply them only using bash?



This SU post indicated that bind could read from .inputrc, and bind's help says:



$ help bind
bind: bind [-lpsvPSVX] [-m keymap] [-f filename] [-q name] [-u name] [-r keyseq] [-x keyseq:shell-command] [keyseq:readline-function or readline-command]


history-search-* look like readline functions, so I tried:



bind "e[6~":history-search-forward
bind "e[5~":history-search-backward


Page Up now triggers a bell, Page Down printed a ~.



Is there a general way for me to use inputrc lines in bash?










share|improve this question



















  • 1




    One reason to use .inputrc here, though, is so that the key bindings are available in any program that uses readline, not just bash.
    – chepner
    Sep 25 '15 at 13:43












up vote
3
down vote

favorite
2









up vote
3
down vote

favorite
2






2





I'd like to keep my modifications to as few files as possible, so I don't want to touch .inputrc unless I absolutely have to. So, given .inputrc lines like:



"e[5~": history-search-backward
"e[6~": history-search-forward


How can I apply them only using bash?



This SU post indicated that bind could read from .inputrc, and bind's help says:



$ help bind
bind: bind [-lpsvPSVX] [-m keymap] [-f filename] [-q name] [-u name] [-r keyseq] [-x keyseq:shell-command] [keyseq:readline-function or readline-command]


history-search-* look like readline functions, so I tried:



bind "e[6~":history-search-forward
bind "e[5~":history-search-backward


Page Up now triggers a bell, Page Down printed a ~.



Is there a general way for me to use inputrc lines in bash?










share|improve this question















I'd like to keep my modifications to as few files as possible, so I don't want to touch .inputrc unless I absolutely have to. So, given .inputrc lines like:



"e[5~": history-search-backward
"e[6~": history-search-forward


How can I apply them only using bash?



This SU post indicated that bind could read from .inputrc, and bind's help says:



$ help bind
bind: bind [-lpsvPSVX] [-m keymap] [-f filename] [-q name] [-u name] [-r keyseq] [-x keyseq:shell-command] [keyseq:readline-function or readline-command]


history-search-* look like readline functions, so I tried:



bind "e[6~":history-search-forward
bind "e[5~":history-search-backward


Page Up now triggers a bell, Page Down printed a ~.



Is there a general way for me to use inputrc lines in bash?







bash readline






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 13 '17 at 12:37









Community

1




1










asked Sep 24 '15 at 4:49









muru

34.7k580153




34.7k580153







  • 1




    One reason to use .inputrc here, though, is so that the key bindings are available in any program that uses readline, not just bash.
    – chepner
    Sep 25 '15 at 13:43












  • 1




    One reason to use .inputrc here, though, is so that the key bindings are available in any program that uses readline, not just bash.
    – chepner
    Sep 25 '15 at 13:43







1




1




One reason to use .inputrc here, though, is so that the key bindings are available in any program that uses readline, not just bash.
– chepner
Sep 25 '15 at 13:43




One reason to use .inputrc here, though, is so that the key bindings are available in any program that uses readline, not just bash.
– chepner
Sep 25 '15 at 13:43










2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










According to what I have in my .bashrc you need something like



bind '"e[6~": history-search-forward'





share|improve this answer




















  • ... and now I feel like an idiot. I stopped trying after bind 'e[6~': history-search-forward failed.
    – muru
    Sep 24 '15 at 6:21






  • 1




    I think I had trouble getting there too, as I noted it as non-obvious in my personal "help on bash" file.
    – meuh
    Sep 24 '15 at 6:27

















up vote
1
down vote













For anyone else searching, this works for all inputrc commands: just wrap them in quotes, shove a bind in front, and you're good (make sure you have different types of quotes if the actual inputrc command itself requires quotes).



For example, set show-all-if-ambiguous on is the inputrc config to have tab-completion immediately return multiple options, instead of first ringing the bell and then the next tab return the multiple options. To put it in your bashrc, it's just



bind "set show-all-if-ambiguous on"





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',
    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%2f231726%2fhow-do-i-convert-inputrc-settings-to-bashrc-ones%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








    up vote
    2
    down vote



    accepted










    According to what I have in my .bashrc you need something like



    bind '"e[6~": history-search-forward'





    share|improve this answer




















    • ... and now I feel like an idiot. I stopped trying after bind 'e[6~': history-search-forward failed.
      – muru
      Sep 24 '15 at 6:21






    • 1




      I think I had trouble getting there too, as I noted it as non-obvious in my personal "help on bash" file.
      – meuh
      Sep 24 '15 at 6:27














    up vote
    2
    down vote



    accepted










    According to what I have in my .bashrc you need something like



    bind '"e[6~": history-search-forward'





    share|improve this answer




















    • ... and now I feel like an idiot. I stopped trying after bind 'e[6~': history-search-forward failed.
      – muru
      Sep 24 '15 at 6:21






    • 1




      I think I had trouble getting there too, as I noted it as non-obvious in my personal "help on bash" file.
      – meuh
      Sep 24 '15 at 6:27












    up vote
    2
    down vote



    accepted







    up vote
    2
    down vote



    accepted






    According to what I have in my .bashrc you need something like



    bind '"e[6~": history-search-forward'





    share|improve this answer












    According to what I have in my .bashrc you need something like



    bind '"e[6~": history-search-forward'






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 24 '15 at 6:14









    meuh

    31k11754




    31k11754











    • ... and now I feel like an idiot. I stopped trying after bind 'e[6~': history-search-forward failed.
      – muru
      Sep 24 '15 at 6:21






    • 1




      I think I had trouble getting there too, as I noted it as non-obvious in my personal "help on bash" file.
      – meuh
      Sep 24 '15 at 6:27
















    • ... and now I feel like an idiot. I stopped trying after bind 'e[6~': history-search-forward failed.
      – muru
      Sep 24 '15 at 6:21






    • 1




      I think I had trouble getting there too, as I noted it as non-obvious in my personal "help on bash" file.
      – meuh
      Sep 24 '15 at 6:27















    ... and now I feel like an idiot. I stopped trying after bind 'e[6~': history-search-forward failed.
    – muru
    Sep 24 '15 at 6:21




    ... and now I feel like an idiot. I stopped trying after bind 'e[6~': history-search-forward failed.
    – muru
    Sep 24 '15 at 6:21




    1




    1




    I think I had trouble getting there too, as I noted it as non-obvious in my personal "help on bash" file.
    – meuh
    Sep 24 '15 at 6:27




    I think I had trouble getting there too, as I noted it as non-obvious in my personal "help on bash" file.
    – meuh
    Sep 24 '15 at 6:27












    up vote
    1
    down vote













    For anyone else searching, this works for all inputrc commands: just wrap them in quotes, shove a bind in front, and you're good (make sure you have different types of quotes if the actual inputrc command itself requires quotes).



    For example, set show-all-if-ambiguous on is the inputrc config to have tab-completion immediately return multiple options, instead of first ringing the bell and then the next tab return the multiple options. To put it in your bashrc, it's just



    bind "set show-all-if-ambiguous on"





    share|improve this answer
























      up vote
      1
      down vote













      For anyone else searching, this works for all inputrc commands: just wrap them in quotes, shove a bind in front, and you're good (make sure you have different types of quotes if the actual inputrc command itself requires quotes).



      For example, set show-all-if-ambiguous on is the inputrc config to have tab-completion immediately return multiple options, instead of first ringing the bell and then the next tab return the multiple options. To put it in your bashrc, it's just



      bind "set show-all-if-ambiguous on"





      share|improve this answer






















        up vote
        1
        down vote










        up vote
        1
        down vote









        For anyone else searching, this works for all inputrc commands: just wrap them in quotes, shove a bind in front, and you're good (make sure you have different types of quotes if the actual inputrc command itself requires quotes).



        For example, set show-all-if-ambiguous on is the inputrc config to have tab-completion immediately return multiple options, instead of first ringing the bell and then the next tab return the multiple options. To put it in your bashrc, it's just



        bind "set show-all-if-ambiguous on"





        share|improve this answer












        For anyone else searching, this works for all inputrc commands: just wrap them in quotes, shove a bind in front, and you're good (make sure you have different types of quotes if the actual inputrc command itself requires quotes).



        For example, set show-all-if-ambiguous on is the inputrc config to have tab-completion immediately return multiple options, instead of first ringing the bell and then the next tab return the multiple options. To put it in your bashrc, it's just



        bind "set show-all-if-ambiguous on"






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        jeremysprofile

        231111




        231111



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f231726%2fhow-do-i-convert-inputrc-settings-to-bashrc-ones%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