I use the IntelliJ IDEA's Embedded Local Terminal quite a lot, but there is one thing that is driving me nuts : special and accented characters do not work. This is what should but is not working :
D
C
?
when I hit another keyThere are probably other combinations that should but do not work ... but these are the most annoying ones.
I'm using :
Important notes :
�
), and I'd really prefer using zsh. showkey --scancodes
prints Couldn't get a file descriptor referring to the console
od -c
I get ^[[H
for the HOME key and ^[[F
for the END key showkey --ascii
works and prints ^[[H
too for the HOME keyWhat I did already :
TERM
variable is not overridden in .zshrc
bindkey "${terminfo[khome]}" beginning-of-line
and end of line equivalent in .zshrc
readline
(OK I see now that this was useless as Zsh does not use readline)edit : I could make the home/end keys work (see accepted answer below), but not the CTRL+LEFT and CTRL+RIGHT key (for forward-word and backward-word). After some more digging this seems to be an issue with IntelliJ not 100% properly emulating the terminal. 4
There is an issue here, with interesting input from an oh-my-zsh contributor : https://youtrack.jetbrains.com/issue/IDEA-118848#comment=27-1292473
They consider ditching smkx (which appears to be the root of the problem) from oh-my-zsh soon. I've checked out this PR and now my keys work fine (still need the bindings, but CTRL+LEFT and CTRL+RIGHT are ok now)
edit: accented/special characters are now properly supported in IntelliJ (yeehaa !), be sure to have at least the following version : IntelliJ IDEA 2016.3.1, Build #IC-163.9166.29, built on December 9, 2016
I can appreciate that zsh works fine outside IntelliJ.
Find the correct key codes being used by the terminal inside Intellij. This will depend on the OS you are using. For OSX and Linux od -c
followed by pressing the keys will result in the key code being emitted.
Once you have the keycodes, modify your ~/.zshrc
:
bindkey "$HOME_KEY_CODE_FROM_STEP_1" beginning-of-line
bindkey "$END_KEY_CODE_FROM_STEP_1" end-of-line
for example (as was the case for the OP):
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
and restart the terminal.