atuin icon indicating copy to clipboard operation
atuin copied to clipboard

Alt-N jump back doesn't work on MacOS

Open conradludgate opened this issue 2 years ago • 6 comments

Macs don't have an alt key, and using Option-N doesn't work either.

conradludgate avatar May 19 '22 08:05 conradludgate

This is something to set in your terminal emulator.

  • for Terminal; Preferences > Profiles (Your profile) > Keyboard > "Use Option as Meta Key"
  • for iTerm2; Preferences > Profiles (Your profile) > Keys > Left or Right Option Key setting > "esc+" (or "meta")

@conradludgate

justinmcp avatar Nov 03 '22 00:11 justinmcp

@justinmcp ~iTerm2 doesn't give me that choice :/ Any other idea, please?~ [Edit: see below, PEBKAC, was looking in the wrong place] image

jucor avatar Mar 06 '23 13:03 jucor

Note: using "Option as Meta key" solves the issue in Terminal, thanks. Just can't find the equivalent in iTerm2 3.4.19.

jucor avatar Mar 06 '23 13:03 jucor

OK, I'm a moron, I was looking in the wrong place in iTerm2. Thanks @justinmcp for your advice which was on point! image

Would still be easier if atuin/crossterm recognized Option, but for now Meta will work :) (hoping this won't interfere with other apps :/ )

jucor avatar Mar 06 '23 13:03 jucor

Oh awesome! Thank you for finding this! 🙌 Will see if we can also recognize Option

ellie avatar Mar 08 '23 16:03 ellie

Dang, side-effect: remapping to Meta wrecks havoc with entering special characters in the terminal (e.g. in vim) :/ So recognising Option would be amazing :)

jucor avatar Mar 08 '23 18:03 jucor

Dang, side-effect: remapping to Meta wrecks havoc with entering special characters in the terminal (e.g. in vim) :/ So recognising Option would be amazing :)

This isn't the responsibility of Atuin but rather the terminal emulator

mizlan avatar Jun 06 '23 18:06 mizlan

I was just playing with this, because it would be good to be able to use Alt-n. I use Kitty as my terminal emulator, so enabling the mapping was easy: just add macos_option_as_alt yes to its config file.

This worked beautifully! However, when I then went to type # in a file I found I couldn't: I'm using a British keyboard, so # is actually Option-3 (yes, for some reason, Apple still seems to think Brits type § and ± more often than #!)

This means mapping Option as Alt is not a solution for me; much as I'd like the Atuin shortcuts, being able to type # is far more important.

zygous avatar Jul 16 '23 11:07 zygous

What issues might be caused by using Ctrl-n instead of Alt-n on Macs? I've created a PR that does this: https://github.com/ellie/atuin/pull/1106

zygous avatar Jul 16 '23 15:07 zygous

Ideally this would be configurable.

bitboxer avatar Jul 17 '23 04:07 bitboxer

Ideally this would be configurable.

Yes, but getting it working at all for Mac users solves the immediate problem. Making the keybindings configurable is a fair bit more work.

zygous avatar Jul 17 '23 06:07 zygous

It needs to be configurable I'm afraid, as otherwise this will break it for all mac users who have reconfigured their setup

ellie avatar Jul 17 '23 06:07 ellie

Yeah, fair enough. I was caught up with the idea that there wouldn't be any Mac users in that situation, because of the breakage I'd seen, but that's a terrible assumption.

I've updated my PR to honour a config setting -- ctrl_n_shortcuts -- instead of testing the OS. It was actually a lot less work than I anticipated 🙂

zygous avatar Jul 17 '23 19:07 zygous

This is now supported via one of the following:

  1. Enable ctrl_n_shortcuts to use ctrl instead of alt
  2. Map option to alt, and accept any issues with the keyboard this may cause

See the docs for more! https://atuin.sh/docs/config#macos-ctrl-n-key-shortcuts

ellie avatar Oct 18 '23 02:10 ellie