zellij-org / zellij

A terminal workspace with batteries included
https://zellij.dev
MIT License
22.06k stars 674 forks source link

There is no alt button in macos #265

Open qballer opened 3 years ago

qballer commented 3 years ago

MacOS alt button is mapped out to be the options key. While I see the awesome new UI which has this fancy new Alt option I can not actually use it. Is it possible to map the Alt button to options in case we load in Mac?

bbil commented 3 years ago

I ran into the same issue (back on a Mac for work), the issue is not this application, it is MacOS itself. What you need to do is tell Terminal or iTerm to use the option key in a non-mac way.

iterm -- set left option key as Esc+ (not sure why Meta doesn't work): image

Terminal -- use option as meta key: image

bbil commented 3 years ago

Doing the above means you now can't enter special characters using option/alt, like alt+j -> triangle. But, that's not something I do ever.

believer commented 3 years ago

If you use kitty set macos_option_as_alt yes in your kitty settings. Unfortunately, this breaks entering things like @ and ~ (Swedish keyboard layout).

steamfan commented 3 years ago

The problem that you can not enter special characters anymore depends on the keyboard you are using: on a german keyboard you need alt to type various often used special characters

alt + n gives you ~. This might be often used to abbreviate the home directory. alt + 5 and alt + 6 gives you [ and ] alt + 8 and alt +9 gives you {and } alt + l gives you @

laingc commented 3 years ago

One solution to this would be to allow multiple modifier keys (e.g. Alt + Ctrl or Alt + Shift).

trst commented 3 years ago

If you use kitty set macos_option_as_alt yes in your kitty settings. Unfortunately, this breaks entering things like @ and ~ (Swedish keyboard layout).

@believer To add on here, the options for Kitty's macos_option_as_alt config are left, right and both. This way if you need access to special characters, you could set only the right Option key to act as Alt for instance. More details on the Kitty docs.

qballer commented 3 years ago

for alacritty users, based of this https://github.com/alacritty/alacritty/issues/62#issuecomment-347552058 Last two lines are of my own making and they map "alt+[" and "alt +]"

key_bindings:
  - { key: A,         mods: Alt,       chars: "\x1ba"                       }
  - { key: B,         mods: Alt,       chars: "\x1bb"                       }
  - { key: C,         mods: Alt,       chars: "\x1bc"                       }
  - { key: D,         mods: Alt,       chars: "\x1bd"                       }
  - { key: E,         mods: Alt,       chars: "\x1be"                       }
  - { key: F,         mods: Alt,       chars: "\x1bf"                       }
  - { key: G,         mods: Alt,       chars: "\x1bg"                       }
  - { key: H,         mods: Alt,       chars: "\x1bh"                       }
  - { key: I,         mods: Alt,       chars: "\x1bi"                       }
  - { key: J,         mods: Alt,       chars: "\x1bj"                       }
  - { key: K,         mods: Alt,       chars: "\x1bk"                       }
  - { key: L,         mods: Alt,       chars: "\x1bl"                       }
  - { key: M,         mods: Alt,       chars: "\x1bm"                       }
  - { key: N,         mods: Alt,       chars: "\x1bn"                       }
  - { key: O,         mods: Alt,       chars: "\x1bo"                       }
  - { key: P,         mods: Alt,       chars: "\x1bp"                       }
  - { key: Q,         mods: Alt,       chars: "\x1bq"                       }
  - { key: R,         mods: Alt,       chars: "\x1br"                       }
  - { key: S,         mods: Alt,       chars: "\x1bs"                       }
  - { key: T,         mods: Alt,       chars: "\x1bt"                       }
  - { key: U,         mods: Alt,       chars: "\x1bu"                       }
  - { key: V,         mods: Alt,       chars: "\x1bv"                       }
  - { key: W,         mods: Alt,       chars: "\x1bw"                       }
  - { key: X,         mods: Alt,       chars: "\x1bx"                       }
  - { key: Y,         mods: Alt,       chars: "\x1by"                       }
  - { key: Z,         mods: Alt,       chars: "\x1bz"                       }
  - { key: A,         mods: Alt|Shift, chars: "\x1bA"                       }
  - { key: B,         mods: Alt|Shift, chars: "\x1bB"                       }
  - { key: C,         mods: Alt|Shift, chars: "\x1bC"                       }
  - { key: D,         mods: Alt|Shift, chars: "\x1bD"                       }
  - { key: E,         mods: Alt|Shift, chars: "\x1bE"                       }
  - { key: F,         mods: Alt|Shift, chars: "\x1bF"                       }
  - { key: G,         mods: Alt|Shift, chars: "\x1bG"                       }
  - { key: H,         mods: Alt|Shift, chars: "\x1bH"                       }
  - { key: I,         mods: Alt|Shift, chars: "\x1bI"                       }
  - { key: J,         mods: Alt|Shift, chars: "\x1bJ"                       }
  - { key: K,         mods: Alt|Shift, chars: "\x1bK"                       }
  - { key: L,         mods: Alt|Shift, chars: "\x1bL"                       }
  - { key: M,         mods: Alt|Shift, chars: "\x1bM"                       }
  - { key: N,         mods: Alt|Shift, chars: "\x1bN"                       }
  - { key: O,         mods: Alt|Shift, chars: "\x1bO"                       }
  - { key: P,         mods: Alt|Shift, chars: "\x1bP"                       }
  - { key: Q,         mods: Alt|Shift, chars: "\x1bQ"                       }
  - { key: R,         mods: Alt|Shift, chars: "\x1bR"                       }
  - { key: S,         mods: Alt|Shift, chars: "\x1bS"                       }
  - { key: T,         mods: Alt|Shift, chars: "\x1bT"                       }
  - { key: U,         mods: Alt|Shift, chars: "\x1bU"                       }
  - { key: V,         mods: Alt|Shift, chars: "\x1bV"                       }
  - { key: W,         mods: Alt|Shift, chars: "\x1bW"                       }
  - { key: X,         mods: Alt|Shift, chars: "\x1bX"                       }
  - { key: Y,         mods: Alt|Shift, chars: "\x1bY"                       }
  - { key: Z,         mods: Alt|Shift, chars: "\x1bZ"                       }
  - { key: Key1,      mods: Alt,       chars: "\x1b1"                       }
  - { key: Key2,      mods: Alt,       chars: "\x1b2"                       }
  - { key: Key3,      mods: Alt,       chars: "\x1b3"                       }
  - { key: Key4,      mods: Alt,       chars: "\x1b4"                       }
  - { key: Key5,      mods: Alt,       chars: "\x1b5"                       }
  - { key: Key6,      mods: Alt,       chars: "\x1b6"                       }
  - { key: Key7,      mods: Alt,       chars: "\x1b7"                       }
  - { key: Key8,      mods: Alt,       chars: "\x1b8"                       }
  - { key: Key9,      mods: Alt,       chars: "\x1b9"                       }
  - { key: Key0,      mods: Alt,       chars: "\x1b0"                       }
  - { key: Space,     mods: Control,   chars: "\x00"                        } # Ctrl + Space
  - { key: Grave,     mods: Alt,       chars: "\x1b`"                       } # Alt + `
  - { key: Grave,     mods: Alt|Shift, chars: "\x1b~"                       } # Alt + ~
  - { key: Period,    mods: Alt,       chars: "\x1b."                       } # Alt + .
  - { key: Key8,      mods: Alt|Shift, chars: "\x1b*"                       } # Alt + *
  - { key: Key3,      mods: Alt|Shift, chars: "\x1b#"                       } # Alt + #
  - { key: Period,    mods: Alt|Shift, chars: "\x1b>"                       } # Alt + >
  - { key: Comma,     mods: Alt|Shift, chars: "\x1b<"                       } # Alt + <
  - { key: Minus,     mods: Alt|Shift, chars: "\x1b_"                       } # Alt + _
  - { key: Key5,      mods: Alt|Shift, chars: "\x1b%"                       } # Alt + %
  - { key: Key6,      mods: Alt|Shift, chars: "\x1b^"                       } # Alt + ^
  - { key: Backslash, mods: Alt,       chars: "\x1b\\"                      } # Alt + \
  - { key: Backslash, mods: Alt|Shift, chars: "\x1b|"                       } # Alt + |

  - { key: Period,   mods: Alt,       chars: "\x1b."                        }
  - { key: Key8,     mods: Alt|Shift, chars: "\x1b*"                        }
  - { key: Key3,     mods: Alt|Shift, chars: "\x1b#"                        }
  - { key: Key1,     mods: Alt,     chars: "\x1b1"                          }
  - { key: Key2,     mods: Alt,     chars: "\x1b2"                          }
  - { key: Key3,     mods: Alt,     chars: "\x1b3"                          }
  - { key: Key4,     mods: Alt,     chars: "\x1b4"                          }
  - { key: Key5,     mods: Alt,     chars: "\x1b5"                          }
  - { key: Key6,     mods: Alt,     chars: "\x1b6"                          }
  - { key: Key7,     mods: Alt,     chars: "\x1b7"                          }
  - { key: Key8,     mods: Alt,     chars: "\x1b8"                          }
  - { key: Key9,     mods: Alt,     chars: "\x1b9"                          }
  - { key: Key0,     mods: Alt,     chars: "\x1b0"                          }
  - { key: Period,   mods: Alt|Shift, chars: "\x1b>"                       } # Alt + >
  - { key: Comma,    mods: Alt|Shift, chars: "\x1b<"                       } # Alt + <
  - { key: LBracket,    mods: Alt, chars: "\x1b["                       } # Alt + [
  - { key: RBracket,    mods: Alt, chars: "\x1b]"                       } # Alt + ]
poliorcetics commented 2 years ago

See #1343

felipesere commented 1 year ago

Alacritty 0.12-rc1 (there is an rc2 out already) supports option_as_alt on macOS now.

bric3 commented 1 year ago

@bbil Did you setup iterm for recognizing Alt + ?

bmikaili commented 1 year ago

Neither the remappings by @qballer nor @felipesere work for me. Wondering if others are having the same issue?

merikan commented 1 year ago

@bmikaili which terminal are you using? Take a look at https://zellij.dev/documentation/faq.html#i-am-a-macos-user-how-can-i-use-the-alt-key

smileart commented 1 year ago

I have my left option configured as alt in kitty macos_option_as_alt left but still can't use alt+[ for stacked panes as was explained here: https://zellij.dev/news/stacked-panes-swap-layouts Any solutions or progress on this one? 🤔

tgross35 commented 8 months ago

For anyone using wezterm, you need the following to get skipping by word:

config.keys = {
  {
    key = 'LeftArrow',
    mods = 'ALT',
    action = wezterm.action.SendKey {
      key = 'b',
      mods = 'ALT',
    },
  },
  {
    key = 'RightArrow',
    mods = 'ALT',
    action = wezterm.action.SendKey {
      key = 'f',
      mods = 'ALT',
    },
  }
}

However, I still have an issue with zellij that isn't present outside of it. Option+Left correctly goes one word to the left, but Option+Right enters some sort of mode that jumps to the next character (Option+Right then a will go to the next character a after that position), or deletes (Option+Right followed by Right deletes to the end of the line). This happens even when zellij is locked. Does anyone know why that would be?