Search code examples
macosterminalphpstormcommand-line-interfacekeyboard-shortcuts

Command-arrow for back and forward one word in PhpStorm terminal


I'm on OSX, and for some reason, when I do command - ← (back arrow) in the PhpStorm terminal I get a [D, while command - → (forward arrow) outputs a [C. What I want to do is jump forward and back one word.

enter image description here

In my OSX terminal these keypresses work as expected, and I can't find anywhere where they are set to output those characters. Does anyone have the answer to this conundrum?


Solution

  • Turns out that an answer for the same problem on iTerm also works for PhpStorm! The fix involves creating a new file named ~/.inputrc and then put the following code in it:

    "\e\e[D": backward-word
    "\e\e[C": forward-word
    

    Here is the original link