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

Vim-like navigation #3778

Closed
gbaranski opened this issue Jun 30, 2021 · 9 comments
Closed

Vim-like navigation #3778

gbaranski opened this issue Jun 30, 2021 · 9 comments

Comments

@gbaranski
Copy link

Hi, is it possible to use hjkl for navigation instead arrows? I'm looking into switching from alacritty+tmux to kitty, but that is strongly rejecting me.

@kovidgoyal
Copy link
Owner

navigation of what? If you mean the scrollback, kitty display the
scrollback by default in less, you can configure less hwoever you want,
or configure kitty to display the scrollback in vim, if you prefer that.

https://sw.kovidgoyal.net/kitty/#the-scrollback-buffer

@gbaranski
Copy link
Author

navigation of what?

tabs, panes navigation

@kovidgoyal
Copy link
Owner

You can change all shortcuts in kitty to whatever you like, read the
docs.

@Luflosi
Copy link
Contributor

Luflosi commented Jun 30, 2021

See https://sw.kovidgoyal.net/kitty/#tabs for example.

@gbaranski
Copy link
Author

I've managed to do something like that

map alt+1 goto_tab 1
map alt+2 goto_tab 2
map alt+3 goto_tab 3
map alt+4 goto_tab 4
map alt+5 goto_tab 5
map alt+6 goto_tab 6
map alt+7 goto_tab 7
map alt+8 goto_tab 8
map alt+9 goto_tab 9
map alt+0 goto_tab 10

map alt+enter new_window
map alt+k previous_window
map alt+j next_window

map alt+shift+j move_window_forward
map alt+shift+k move_window_backward

map alt+f goto_layout stack

However I couldn't manage to do few things

  • Toggling stack layout
  • Moving to up/down/left/right window

I'm trying to do something similar to tmux-tillish.

@kovidgoyal
Copy link
Owner

Use neighboring_window to move to neighboring windows https://sw.kovidgoyal.net/kitty/actions.html#neighboring-window

And I dont know what you mean by toggling a layout, but probably this: https://sw.kovidgoyal.net/kitty/kittens/custom.html#using-kittens-to-script-kitty-without-any-terminal-ui

@gbaranski
Copy link
Author

gbaranski commented Jul 1, 2021

Use neighboring_window to move to neighboring windows https://sw.kovidgoyal.net/kitty/actions.html#neighboring-window

And I dont know what you mean by toggling a layout, but probably this: https://sw.kovidgoyal.net/kitty/kittens/custom.html#using-kittens-to-script-kitty-without-any-terminal-ui

works perfectly, thanks

if anyone is interested in my current configuration, here it is:
~/.config/kitty/kitty.conf

map alt+1 goto_tab 1
map alt+2 goto_tab 2
map alt+3 goto_tab 3
map alt+4 goto_tab 4
map alt+5 goto_tab 5
map alt+6 goto_tab 6
map alt+7 goto_tab 7
map alt+8 goto_tab 8
map alt+9 goto_tab 9
map alt+0 goto_tab 10

map alt+enter new_window

map alt+h neighboring_window left
map alt+j neighboring_window bottom
map alt+k neighboring_window top
map alt+l neighboring_window right

map alt+shift+h move_window left
map alt+shift+j move_window bottom
map alt+shift+k move_window top
map alt+shift+l move_window right

map alt+f kitten zoom_toggle.py

~/.config/kittyzoom_toggle.py(source)

def main(args):
    pass

from kittens.tui.handler import result_handler
@result_handler(no_ui=True)
def handle_result(args, answer, target_window_id, boss):
    tab = boss.active_tab
    if tab is not None:
        if tab.current_layout.name == 'stack':
            tab.last_used_layout()
        else:
            tab.goto_layout('stack')

@louregni
Copy link

louregni commented Jul 7, 2021

@kovidgoyal Hi,

Is it possible to use neighboring_window top with stack layout ?
The same shortcut to switch windows in grid & stack layouts could be really useful.

map kitty_mod+k neighboring_window up
map kitty_mod+j neighboring_window down
map kitty_mod+h neighboring_window left
map kitty_mod+l neighboring_window right

I use this to move around, but the only way I found to move around in stack layout is previous and next windows.
But I guess neighboring_window concept could be used in stack layout too.

@kovidgoyal
Copy link
Owner

Sure 75b73f6

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

4 participants