0

I bound ^++ and ^++ as my custom shortcuts to move between Spaces (Move right a space and Move left a space respectively) in System settings > Keyboard > Keyboard Shortcuts.

These shortcuts work fine except when I'm focusing on an iTerm2 window, in that case nothing happens. I've been searching for a possible conflict with no luck. I've looked in iTerm2 Preferences > Profiles > Keys > Key mappings and it seems like I'm using the xterm defaults which bind ^+ and ^+ to respectively ^[[1;5D and ^[[1;5C which let me move between words using those key combos. I tried removing them but the only effect I got was the loss of ability to move between words. Any ideas?

Marc Wilson
  • 5,920
  • Why did you remap the standard shortcut for moving between spaces? While you can, I don't recommend this because other devs expect this shortcut and "listen" for these things. I'm thinking that because iTerm2 has to differentiate between terminal keybindings (Emacs based) and Finder keybindings (they are totally different) you "broke" things in iTerm2 since it doesn't handle this change well. – Allan Aug 19 '23 at 13:59
  • Coming from Linux I remapped a few shortcuts and the default shortcut for switching spaces, ^+ and I believe, was conflicting with another one. I understand I "broke" things on iTerm2, but I'd like to understand why. Where should I look for conflicts? Why does iTerm2 not recognise the shortcut like every other app? – gccallie Aug 19 '23 at 16:19
  • Here's a similar situation involving remapping Windows keys. In short, Apple publishes a guide for Devs in creating their apps and strongly encourage Devs to stay true to this. Since iTerm2 has two environments it must content with, I suspect it's listening for the defaults to act appropriately in the Finder context and it doesn't know to listen for your custom shortcut. Ctrl-Cmd-→ is something that can be assigned and used solely in iTerm so it's not expecting Finder specific mapping to be configured. – Allan Aug 19 '23 at 16:33
  • ^ + → or ← is by default set a shortcut to move between words in iTerm2. Even without changing anything and "work with the system instead of against it" how is iTerm2 supposed to listen to that and perform a change of Space instead of moving between words? – gccallie Aug 19 '23 at 16:47
  • That's not a default in iTerm2. That's a custom Emacs keybinding (used by shells as well). You'll see that the default keybinding is Meta-f and Meta-b for "forward word" and "back word". I just tested in iTerm2 and the only thing that responds to Ctrl Arrow is Finder. – Allan Aug 19 '23 at 16:59
  • That's strange because I didn't change any defaults and that's the standard behaviour I get in iTerm2. Even turning off all my custom shortcuts remaps. While searching for a solution to this problem I found people looking for ways to map ^ + → or ← to forward/back word and the solution was exactly what I already had in my key bindings. – gccallie Aug 19 '23 at 17:11

0 Answers0