Alt+key not working in embedded terminal
已回答
For instance, ALT+F and ALT+B works in the editor for moving the caret to start of next and previous word respectively. However, in the embedded terminal this is not working - though the chain ESC-ESC-F and ESC-ESC-B provides the same functionality I would really prefer to use the aforementioned.
Is there a way to have ALT+F and ALT+B work in the embedded terminal? Disabling mneumonics does not appear to solve the problem.
PhpStorm 2016.3.2
Ubuntu 16.04
请先登录再写评论。
What keymap are you using (alt+f brings File menu by default)?
Do you have Override IDE shortcuts disabled in File | Settings | Tools | Terminal?
I should have mentioned: I am using Emacs keymap.
ALT+F should move the caret to the start of the next word, and ALT+B should move the caret to the start of the previous word, same functionality as CTRL+RightArrow and CTRL+LeftArrow respectively. I'd like to point out that this (ALT+F and ALT+B) works well in the editor, my problem is that I can't get it to work in the embedded terminal.
Override IDE shortcuts in File | Settings | Tools | Terminal is true/checked/active. After your comment I have also tried with Override IDE shortcuts disabled, but it made no difference.
I had the same issue.Why not fix it?
https://youtrack.jetbrains.com/issue/IDEA-153536 - this seems to be related bug report. Please vote/follow it to receive updates on it's progress
In order to activate ALT-LEFT & ALT-RIGHT in the terminal (as they work in bash), add the following to your ~/.inputrc:
"\e\e[C": forward-word
"\e\e[D": backward-word
and.. reopen the terminal within IntelliJ.
Adding to "~/.inputrc" doesn't work for me.
The only shortcuts working are Esc+B/F that are very uncomfortable.
I managed to have both Opt+B/F and Opt+arrows in iTerm2 and I'd like to have them also in IntelliJ Terminal
~/.inputrc solution did not work for me too
~/.inputrc worked great for me on OSX
@Clarence What version of IntelliJ and OSX are you on?
@Andybergon Sierra 10.12.6 and Webstorm 2017.2.5, before I made the inputrc file alt+left and right would result in [C and [D in the terminal.
Added this file, and opened a new terminal and it worked.
I noticed that Opt+Left/Right add C or D and not [C or [D.
What can cause this? What should I put in the "~/.inputrc" file?
"\e\eC": forward-word
"\e\eD": backward-word
That's curious, for me SHIFT+LEFT and RIGHT add C or D, maybe a keyboard setting?
For example I need to use my fn key to use my top bar controls, e.g. media controls.
@Andybergon, is it possible that it pasted with smart quotes? These nasty quotes aren't called smart for no good reason - they're there to mess with you.
Probably the cause is that I use zsh.
"Zsh does not use readline, instead it uses its own and more powerful Zsh Line Editor, ZLE. It does not read
/etc/inputrc
or~/.inputrc
"Any chance you made it work with zsh? I'm stuck with this issue too.
Nope :V
I am really thinking about going back to bash as I use the terminal in IntelliJ a lot...
This is why PHPStorm's embedded terminal sucks.
~/.inputrc works great!Thanks
I am using bash on mac and adding the shortcuts inside (newly created) ~/.inputrc helped in my case! Thanx a lot!
For the people using zsh
Add this to ~/.zshrc:
bindkey "\e\eOD" backward-word
bindkey "\e\eOC" forward-word
benjamin GUEZ thanks a lot!
Benjamin GUEZ you beauty....
Thanks a lot!
Would be nice if IntelliJ supported this out the box.
(osx solution)
Though this hack uses a non-free tool, the tool itself is very useful in general, so one might consider trial checking / buying if this works.
Using BetterTouchTool (last four lines fix the problem for me) this adds support for option+f and option+b, but it can be done the same way for arrows:
Also, I'm doing this on a global level for all the apps, but if it's conflicting with something one can do a shortcut which will only for Idea.
I modified ` ~/.inputrc` as someone commented above and ALT+Arrow works just fine. But now SHIFT+CMD+[ and SHIFT+CMD+] are not working to switch between terminal tabs :D
~/.inputrc worked for me on OSX Mohave and 2018.3
@benjamin GUEZ - that worked, thanks!
For me the solution made by @Moshe Bixenshpaner works fine!
MacOS version: macOS High Sierra 10.13.4
PHPStorm version: 2018.2.1
Thanks @Moshe Bixenshpaner, that .inputrc fixed it for me!
benjamin GUEZ solution didn't work for me. I use zsh with mac OS Catalina Version 10.15.3 on PyCharm 2019.3.2 Build Build #PY-193.6015.41.
However, i found a thread with a solution that worked for me: https://youtrack.jetbrains.com/issue/IDEA-165184?_ga=2.164760255.14018606.1580937565-184060322.1580438498
I had to put these lines into my ~/.zshrc
# fix for navigation keys in JetBrains terminal
if [[ "$TERMINAL_EMULATOR" == "JetBrains-JediTerm" ]]; then
bindkey "∫" backward-word # Option-b
bindkey "ƒ" forward-word # Option-f
bindkey "∂" delete-word # Option-d
fi