Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS + iterm ctrl-n binding issues #1577

Open
oucystong opened this issue Jan 16, 2024 · 7 comments
Open

macOS + iterm ctrl-n binding issues #1577

oucystong opened this issue Jan 16, 2024 · 7 comments

Comments

@oucystong
Copy link

it doesn't work in macOS Donoma 14.1.2 that use ctrl_n_shortcuts = true in config file. when i use this config, press ctrl+n shortcut and don't work!

@wllenyj
Copy link

wllenyj commented Jan 16, 2024

In my macOS, iTerm2 3.4.23.
ctrl+1, ctrl+2, ctrl+3, ctrl+8, ctrl+9 can't work, the others are OK.

ctrl+1 and ctrl+9 will print 1 and 9.
ctrl+2 print the space.
Pressed ctrl+3, search UI will exit. But the result don't display to prompt.
Pressed ctrl+8, nothing happen.

@ellie
Copy link
Member

ellie commented Jan 16, 2024

Do you have any bindings setup? iTerm often has a bunch of shortcuts defined in its keys settings.

Also - what keyboard layout are you using?

@ellie ellie changed the title macOS Sonoma 14.1.2 macOS + iterm ctrl binding issues Jan 16, 2024
@ellie ellie changed the title macOS + iterm ctrl binding issues macOS + iterm ctrl-n binding issues Jan 16, 2024
@wllenyj
Copy link

wllenyj commented Jan 17, 2024

There are Key Mappings in iTerm2 as follow.
image

@Samasaur1
Copy link

I'm also having issues. I have a lot of terminals on my Mac, so I tested in all of them:

  • kitty: ctrl-1 and ctrl-2 insert 1 and 2, respectively, in the search bar. ctrl-3 exits atuin but puts nothing on my prompt. ctrl-4 through ctrl-7 work as expected. ctrl-8 does nothing. ctrl-9 inserts 9
  • hyper: ctrl-1 and ctrl-2 do nothing. ctrl-3 exists atuin but puts nothing on my prompt. ctrl-4 through ctrl-7 work as expected. ctrl-8 and ctrl-9 do nothing
  • wezterm: ctrl-1 inserts 1. ctrl-2 inserts space. ctrl-3 exits atuin but puts nothing on my prompt. ctrl-4 through ctrl-7 work as expected. ctrl-8 does nothing. ctrl-9 inserts 9
  • tabby: ctrl-1, ctrl-2, ctrl-8, and ctrl-9 do nothing. ctrl-3 exits atuin but puts nothing on my prompt. ctrl-4 through ctrl-7 work as expected
  • iterm2: ctrl-1 inserts 1. ctrl-2 inserts space. ctrl-3 exits atuin but puts nothing on my prompt. ctrl-4 through ctrl-7 work as expected. ctrl-8 does nothing. ctrl-9 inserts 9
  • cool-retro-term: none of the ctrl-n keys do anything
  • alacritty: ctrl-n inserts n (e.g., ctrl-1 inserts 1, ctrl-2 inserts 2, etc.)

I don't actually use most of these terminals, so I doubt that it's my config that's the issue.

@martinetd
Copy link

Having the same problem here on linux/us layout with multiple terminals/shells (including tty!), so it's not just macs -- upon further digging it looks like it's a feature; for example xterm's code:
https://github.com/xterm-x11/xterm-snapshots/blob/master/input.c#L267

 * X "normally" has some built-in translations, which the user may want to
 * suppress when processing the modifyOtherKeys resource.  In particular, the
 * control modifier applied to some of the keyboard digits gives results for
 * control characters.
 *
 * control 2   0    NUL
 * control 3   0x1b ESC
 * control 4   0x1c FS
 * control 5   0x1d GS
 * control 6   0x1e RS
 * control 7   0x1f US
 * control 8   0x7f DEL

So ctrl-3 is escape, that'd close the search interface alright...

Looking at showkey -a output it's also easy to confirm the keys atuin can see are ambiguous, so there's not much that can be done here... Apparently some terminals can be configured to override which key is sent, but that's not obvious, will be a battle everytime you change term, and I'm not quite sure what character would be appropriate to send in the first place anyway!

Since I cannot use alt for this (taken up by my window manager), I'd be tempted to suggest other alternatives (shift-number, F keys, first row...) -- but that'll depend heavily on the keyboard layout, perhaps it'd be simpler to just let users bind each key individually?

The code in atuin/src/command/client/search/interactive.rs is currently a big match switch that's a tad unwieldy to customize but I guess it'll be an investment that pays off for everyone who isn't on us layout as well.
(If using alt I'd also consider allowing escape to not close the interactive view, as escape+digit could acts as alt (meta), but that doesn't look possible to disable right now either)

Until then, we can just ignore the pretty numbers on the left! :p

@atuin-bot
Copy link

This issue has been mentioned on Atuin Community. There might be relevant details there:

https://forum.atuin.sh/t/help-with-macos-ctrl-n-key-shortcuts/271/2

@wllenyj
Copy link

wllenyj commented Apr 8, 2024

This issue has been mentioned on Atuin Community. There might be relevant details there:

https://forum.atuin.sh/t/help-with-macos-ctrl-n-key-shortcuts/271/2

It works for me, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants