atuin icon indicating copy to clipboard operation
atuin copied to clipboard

Support vi-style up-down navigation with `j` and `k`

Open wtfbbqhax opened this issue 2 years ago • 9 comments

I love it, I just wish I could navigate up and down the list with j and k.

How would this work? -I have no clue

Okay, I lie. To feel authentic vi-style, it would probably need an "insert" mode to show the search bar and a "visual" mode to hide the bar and allow navigating with alternate up-down keys.

--

going further, a visual mode could allow paging up and down through queries.

wtfbbqhax avatar May 06 '22 03:05 wtfbbqhax

Yes, this would be great !

GaetanLepage avatar Dec 02 '22 09:12 GaetanLepage

Ctrl-j/k does work. But as you pointed out we don't have an insert/normal mode distinction

conradludgate avatar Dec 02 '22 09:12 conradludgate

Also, when using the vi-mode in zsh, pressing k in normal mode does not invoke atuin. In insert mode, pressing the up arrow works fine.

GaetanLepage avatar Dec 02 '22 09:12 GaetanLepage

  1. Ctrl-h/j/k/l are already bound to vi equivalent navigation commands, so this issue probably should be closed unless Atuin wants to consider having a vi-mode? Having a vi-mode seems like a lot of work, since we'd have to maintain a separate vi-compatability layer, and it would have to be behind a flag since you don't want a non-vi user to accidentally get stuck in it via hitting escape.
  2. Ctrl-j is broken for me somehow, it's interpreted the same as enter, even though Ctrl-n (which atuin maps to the same thing) works fine for me. I've made a note to track that down since it's probably something weird in my config.

when using the vi-mode in zsh, pressing k in normal mode does not invoke atuin

  1. This is an unrelated issue, and is because the zsh init script doesn't set the keybindings for all of the modes. That probably needs to be touched by somebody more familiar with zsh than me. I think you can get it to work with bindkey -M vicmd 'k' _atuin_search_widget

arcuru avatar Dec 05 '22 00:12 arcuru

  1. Ctrl-h/j/k/l are already bound to vi equivalent navigation commands, so this issue probably should be closed unless Atuin wants to consider having a vi-mode? Having a vi-mode seems like a lot of work, since we'd have to maintain a separate vi-compatability layer, and it would have to be behind a flag since you don't want a non-vi user to accidentally get stuck in it via hitting escape.

I agree. A vi-mode might not really be in the scope of this project.

2. Ctrl-j is broken for me somehow, it's interpreted the same as `enter`, even though Ctrl-n (which atuin maps to the same thing) works fine for me. I've made a note to track that down since it's probably something weird in my config.

I have the exact same problem.

3. This is an unrelated issue, and is because the zsh init script doesn't set the keybindings for all of the modes. That probably needs to be touched by somebody more familiar with zsh than me. I _think_ you can get it to work with `bindkey -M vicmd 'k' _atuin_search_widget`

Ok, thank you for the suggestion

GaetanLepage avatar Dec 05 '22 08:12 GaetanLepage

On CTRL+j shortcut, it's by default a newline character, and is interpreted that way by something before atuin gets the input. Either the terminal or maybe X (I am on linux).

arcuru avatar Dec 07 '22 17:12 arcuru

Same Ctrl-j issue. I have tried unbinding this in:

  1. Zsh: bindkey -r "^J"
  2. Bash: bind -r "\C-j"

The binding stops working in these shells, but strangely enough works in dash. I couldn't find any builtin commands for manipulating keybindings in this shell. Took a dive into keycodes and decided Ctrl-n is good enough for now.

cloud303-cholden avatar Jan 20 '23 23:01 cloud303-cholden

I'd also love to see an easy exit shortcut! My muscle memory is trained on Ctrl-c but only Esc works in Atuin

worldofgeese avatar Feb 22 '23 14:02 worldofgeese

Would also love to see a VIM mode, currently using zsh in Vi mode. So... Entering normal mode for navigation comes naturally. Using K to go upwards in history launches atuin and I start typing kkk instead of navigating suggestions upwards. I'd prefer just entering in normal mode. Anyone got a workflow for this?

adinhodovic avatar Jan 10 '24 13:01 adinhodovic