Announcement

Collapse
No announcement yet.

Unable to configure alt-p shortcut with inputrc

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Unable to configure alt-p shortcut with inputrc

    Hello,

    I installed kubuntu 16.04.2 LTS on my laptop Asus Zenbook UX310U. I had no problem with the installation, media keys (Fn-volume up/down/mute) are working.
    After installation I usually configure my ~/.inputrc with the following :
    Code:
    # Mapping to search the history                                                                                                                                                              
    "\ep": history-search-backward                                                                                                                                                               
    "\en": history-search-forward
    (among others things)
    The first line maps alt-p to search backward in the shell history based on what is currently typed on the command line, the second looks forward with alt-n.

    The problem is that the alt-p shortcut does not work. Alt-n is working fine though.

    I had a look at xev output and I am getting the following with alt-p :
    Code:
    KeyPress event, serial 40, synthetic NO, window 0x1e00001,
      root 0x20a, subw 0x0, time 372887, (591,618), root:(591,647),
      state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
      XLookupString gives 0 bytes: 
      XmbLookupString gives 0 bytes: 
      XFilterEvent returns: False
    
    FocusOut event, serial 40, synthetic NO, window 0x1e00001,
      mode NotifyGrab, detail NotifyAncestor
    
    FocusIn event, serial 40, synthetic NO, window 0x1e00001,
      mode NotifyUngrab, detail NotifyAncestor
    
    KeymapNotify event, serial 40, synthetic NO, window 0x0,
      keys:  2   0   0   0   2   0   0   0   1   0   0   0   0   0   0   0   
             0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
    
    KeyRelease event, serial 40, synthetic NO, window 0x1e00001,
      root 0x20a, subw 0x0, time 373470, (591,618), root:(591,647),
      state 0x8, keycode 33 (keysym 0x70, p), same_screen YES,
      XLookupString gives 1 bytes: (70) "p"
      XFilterEvent returns: False
    
    KeyRelease event, serial 40, synthetic NO, window 0x1e00001,
      root 0x20a, subw 0x0, time 373877, (591,618), root:(591,647),
      state 0x8, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
      XLookupString gives 0 bytes: 
      XFilterEvent returns: False
    For comparison here is the alt-n output of xev :
    Code:
    KeyPress event, serial 40, synthetic NO, window 0x1e00001,
      root 0x20a, subw 0x0, time 361116, (421,739), root:(421,768),
      state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
      XLookupString gives 0 bytes: 
      XmbLookupString gives 0 bytes: 
      XFilterEvent returns: False
    
    KeyPress event, serial 40, synthetic NO, window 0x1e00001,
      root 0x20a, subw 0x0, time 361887, (421,739), root:(421,768),
      state 0x8, keycode 57 (keysym 0x6e, n), same_screen YES,
      XLookupString gives 1 bytes: (6e) "n"
      XmbLookupString gives 1 bytes: (6e) "n"
      XFilterEvent returns: False
    
    KeyRelease event, serial 40, synthetic NO, window 0x1e00001,
      root 0x20a, subw 0x0, time 361967, (421,739), root:(421,768),
      state 0x8, keycode 57 (keysym 0x6e, n), same_screen YES,
      XLookupString gives 1 bytes: (6e) "n"
      XFilterEvent returns: False
    
    KeyRelease event, serial 40, synthetic NO, window 0x1e00001,
      root 0x20a, subw 0x0, time 362486, (421,739), root:(421,768),
      state 0x8, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
      XLookupString gives 0 bytes: 
      XFilterEvent returns: False
    I tried alt-p shortcut in a terminal session (ctrl-alt-F1), and it works. So my guess is that an application in kde environment steals alt-p shortcut and is not received by my shell (bash).

    So I looked in the "Configure Shortcuts" menu of konsole and saw no shortcut mapped to alt-p. I searched in System Settings > Workspace > Shortcuts and there was nothing there either.

    Do you have any ideas where I might look or how I can solve this issue ?

    Thanks,
    Nicolas.

    #2
    Using KDEneon here, but I have no ~/.inputrc file but I do have ~/.config/kcminputrc

    Odd thing is, I don't use these shortcuts, but they work in konsole and tty mode by default here. There are keymapping setting in the konsole setup.

    Since they work here out of the box, you might be correct - something else has remapped alt-p

    Please Read Me

    Comment


      #3
      You can check what Gnu readline is seeing by pressing ctrl-v first. If I type echo 'ctrl-v alt-p' I see it echoed as echo '^[p'; and your mapping in my .inputrc works.

      readline is an awkward, antiquated beast. I've resorted to putting mappings for dump-functions and dump-variables into my .inputrc to fathom what's going on; one problem was the difference between "set keymap vi-command" and "set keymap vi-insert".

      If you're typing accented characters that can conflict with meta mode.
      Regards, John Little

      Comment


        #4
        For Alt-p in Konsole I see this : echo ^M.
        For alt-n I see echo ^[n
        But note that i need to type echo ctrl-v alt-p enter for the ^M to appear. If i do not press enter, nothing appears.
        In a terminal session (ctrl-alt-f1) I see echo ^[p as expected.

        edit : in fact typing echo ctrl-v enter yields echo ^M. So it looks like alt-p is not received by readline...

        Comment

        Working...
        X