intellij-ideazshzsh-zle

How to have special/accented characters support in IntelliJ terminal


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 :

There are probably other combinations that should but do not work ... but these are the most annoying ones.

I'm using :

Important notes :

What I did already :


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


Solution

  • I can appreciate that zsh works fine outside IntelliJ.

    Step 1

    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.

    Step 2

    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.