Discussion:
[iterm2-discuss] Can't type # in iTerm2 shells: how to pass Alt+3 into a shell?
TheBloke
2018-08-27 23:38:38 UTC
Permalink
Hi all

I'm running latest iTerm 2, version 3.2.0, on Mac OS 10.13.6.

I use a PC-style keyboard, with UK layout. My # key is therefore in a
different place to a Mac keyboard, and US style. I use an app called
Karabiner-Elements to remap the keys such that I can get # on the correct
keyboard key. This remapping works by sending Alt+3 when I press that key
- pressing Alt+3 being another way to get # in Mac OS.

This works in all apps except iTerm 2 shells. In my iTerm2 shells,
pressing my # key, or just hitting Alt+3, does nothing. So I have no way
to type a #, which is a rather important symbol in a shell. It does work
elsewhere in iTerm2, eg I can type # in a search box in the Preferences
pane.

I've been using iTerm2 with this keyboard for a couple of years, and this
only became a problem quite recently. I don't know exactly when it stopped
working, but I did a couple of iTerm2 upgrades in the last month or two, so
I assume it started then (I wasn't using iTerm2 daily at the time I did the
upgrades, so only spotted it a little later.)

Is there any way I can fix this? The only normal setting related to the
Alt key I could find is changing it to Meta or Esc+ - I did try changing
that, to no avail. I also looked through Advanced, and tried changing
settings such as "On keyboards that require a modifier to press a digit.."
and "When you press an arrow key .. that transmits the modifiers, should
Alt be translated to Meta", but again with no success.

I guess the basic issue is probably that iTerm2 is always sending the Alt
to the remote terminal, whereas I need it to process itself in order to
create the #?

Thanks in advance for any help. Let me know if I should raise a bug/issue
instead.

TB.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
TheBloke
2018-08-27 23:43:52 UTC
Permalink
PS. I also tried disabling all the hotkeys for switching
splits/windows/tabs, in case that Alt+3 was triggering one of those. I
also checked I have no hotkeys assigned to Alt+3.

I also found that if I changed "Switch split panes" to just Alt (*⌥*), then
pressing my # key, or hitting Alt+3, switched to pane 3. So again, Alt+3
is being recognised by iTerm2, just it's either eaten by a hotkey, or else
passed to the shell. I can't get it to be used to create the # symbol when
inside a shell.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
George Nachman
2018-08-29 21:21:48 UTC
Permalink
It sounds like you want "Prefs>Profiles>Keys>(left/right) option key" to be
set to "normal". If that doesn't do it please file an issue and attach a
debug log at https://iterm2.com/bugs. Instructions on producing a debug log
are in the issue template.
Post by TheBloke
PS. I also tried disabling all the hotkeys for switching
splits/windows/tabs, in case that Alt+3 was triggering one of those. I
also checked I have no hotkeys assigned to Alt+3.
I also found that if I changed "Switch split panes" to just Alt (*⌥*),
then pressing my # key, or hitting Alt+3, switched to pane 3. So again,
Alt+3 is being recognised by iTerm2, just it's either eaten by a hotkey, or
else passed to the shell. I can't get it to be used to create the # symbol
when inside a shell.
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
TheBloke
2018-08-29 22:44:56 UTC
Permalink
Thanks for the reply.

I just managed to solve it. It wasn't "Left/Right option" to Normal
(that's what I had already). But while I was checking that, I looked again
and realised the issue was Prefs->Navigation Keys: I needed to make sure
none of the three options (Panes, Tabs, Windows) had Alt as an option.

I was sure I had already tried those, but clearly I never properly checked
that none of the three had Alt as an option. My bad!

So all is fine now, no need for a ticket. Thanks again for the reply.
Post by George Nachman
It sounds like you want "Prefs>Profiles>Keys>(left/right) option key" to
be set to "normal". If that doesn't do it please file an issue and attach a
debug log at https://iterm2.com/bugs. Instructions on producing a debug
log are in the issue template.
Post by TheBloke
PS. I also tried disabling all the hotkeys for switching
splits/windows/tabs, in case that Alt+3 was triggering one of those. I
also checked I have no hotkeys assigned to Alt+3.
I also found that if I changed "Switch split panes" to just Alt (*⌥*),
then pressing my # key, or hitting Alt+3, switched to pane 3. So again,
Alt+3 is being recognised by iTerm2, just it's either eaten by a hotkey, or
else passed to the shell. I can't get it to be used to create the # symbol
when inside a shell.
--
You received this message because you are subscribed to the Google Groups
"iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
TheBloke
2018-08-29 22:50:46 UTC
Permalink
Oh, I know what happened. For the record: I did make sure that none of
Navigation Keys had alt. But I only did so after I'd also tried setting
Prefs->Profiles->Leys->Option Key to Meta+. Then I set Navigation Keys
to Alt to test that iTerm 2 could receive the Alt at all, and didn't undo
that when I changed Option Key back to Normal.

So it was only now that I finally had the combo of Navigation Keys=no Alt
and Option Key=Normal :)

Thanks again for the support.
Post by TheBloke
Thanks for the reply.
I just managed to solve it. It wasn't "Left/Right option" to Normal
(that's what I had already). But while I was checking that, I looked again
and realised the issue was Prefs->Navigation Keys: I needed to make sure
none of the three options (Panes, Tabs, Windows) had Alt as an option.
I was sure I had already tried those, but clearly I never properly checked
that none of the three had Alt as an option. My bad!
So all is fine now, no need for a ticket. Thanks again for the reply.
Post by George Nachman
It sounds like you want "Prefs>Profiles>Keys>(left/right) option key" to
be set to "normal". If that doesn't do it please file an issue and attach a
debug log at https://iterm2.com/bugs. Instructions on producing a debug
log are in the issue template.
Post by TheBloke
PS. I also tried disabling all the hotkeys for switching
splits/windows/tabs, in case that Alt+3 was triggering one of those. I
also checked I have no hotkeys assigned to Alt+3.
I also found that if I changed "Switch split panes" to just Alt (*⌥*),
then pressing my # key, or hitting Alt+3, switched to pane 3. So again,
Alt+3 is being recognised by iTerm2, just it's either eaten by a hotkey, or
else passed to the shell. I can't get it to be used to create the # symbol
when inside a shell.
--
You received this message because you are subscribed to the Google
Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discuss+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...