Alt+key not working in embedded terminal

Answered

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

 

29 comments
Comment actions Permalink

What keymap are you using (alt+f brings File menu by default)?

Do you have Override IDE shortcuts disabled in File | Settings | Tools | Terminal?

 

0
Comment actions Permalink

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.

 

3
Comment actions Permalink

 I had the same issue.Why not fix it?

0
Comment actions Permalink

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

0
Comment actions Permalink

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.

25
Comment actions Permalink

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

2
Comment actions Permalink

~/.inputrc solution did not work for me too

0
Comment actions Permalink

~/.inputrc worked great for me on OSX

2
Comment actions Permalink

@Clarence What version of IntelliJ and OSX are you on?

0
Comment actions Permalink

@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.

 

0
Comment actions Permalink

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

 

0
Comment actions Permalink

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.

0
Comment actions Permalink

@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.

0
Comment actions Permalink

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"

2
Comment actions Permalink

Any chance you made it work with zsh? I'm stuck with this issue too. 

0
Comment actions Permalink

Nope :V
I am really thinking about going back to bash as I use the terminal in IntelliJ a lot...

0
Comment actions Permalink

This is why PHPStorm's embedded terminal sucks.

1
Comment actions Permalink

~/.inputrc works great!Thanks

1
Comment actions Permalink

I am using bash on mac and adding the shortcuts inside (newly created) ~/.inputrc helped in my case! Thanx a lot! 

0
Comment actions Permalink

For the people using zsh

Add this to ~/.zshrc:

bindkey "\e\eOD" backward-word
bindkey "\e\eOC" forward-word

33
Comment actions Permalink

benjamin GUEZ thanks a lot!

0
Comment actions Permalink

Benjamin GUEZ you beauty....

Thanks a lot!

 

Would be nice if IntelliJ supported this out the box.

0
Comment actions Permalink

(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.

 

-1
Comment actions Permalink

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

0
Comment actions Permalink

~/.inputrc worked for me on OSX Mohave and 2018.3

0
Comment actions Permalink

@benjamin GUEZ - that worked, thanks!

0
Comment actions Permalink

For me the solution made by @Moshe Bixenshpaner works fine! 

MacOS version: macOS High Sierra 10.13.4 
PHPStorm version: 2018.2.1

0
Comment actions Permalink

Thanks @Moshe Bixenshpaner, that .inputrc fixed it for me!

0

Please sign in to leave a comment.