ubuntukeyboard-shortcutszshzshrcterminator

Fix key settings (Home/End/Insert/Delete) in .zshrc when running Zsh in Terminator Terminal Emulator


I'm running Ubuntu 11.04. I installed the Terminator Terminal Emulator 0.95, and Zsh, version 4.3.15.
I have (commonly known) problems with my keys inside the Zsh. At least these:

I already tried some configurations for .zshrc which should solve the problem, but no approach really worked so far. Maybe this is related to the combination of Terminator and Zsh. I took the 2 configs on this page: https://bbs.archlinux.org/viewtopic.php?pid=428669.

Does oneone have a similar configuration (especially Terminator and Zsh) and figured out what needs to be inserted into the .zshrc to fix the key settings?


Solution

  • To know the code of a key, execute cat, press enter, press the key, then Ctrl+C.

    For me, Home sends ^[[H and End ^[[F, so i can put i my .zshrc in my home dir

    bindkey  "^[[H"   beginning-of-line
    bindkey  "^[[F"   end-of-line
    bindkey  "^[[3~"  delete-char
    

    These codes could change with the terminal emulator you use.

    autoload zkbd ; zkbd will create a file with an array of keycodes to use, like bindkey "${key[Home]}" beginning-of-line, and you can source a different file depending on the terminal.