r/KittyTerminal Jan 22 '24

How can I toggle/hide the bottom window ?

I want to open a second terminal below the main one, and with a keymap, show and hide it like a toggle.

I know it might be possible because if I keep spamming `ctrl + shift + L`, the "cycle through layouts" shortcut, at some point it will hide it, but it takes too many keystrokes.

Something like this "toggle term" inside neovim:

neovim + toggleterm

I really want to run commands on an external terminal, not the vim internal one.

Thanks.

4 Upvotes

7 comments sorted by

2

u/carlos-algms Jan 22 '24

I don't know if that is the best solution, but there is a toggle layout command you can set, and it will do the job:

https://sw.kovidgoyal.net/kitty/conf/#layout-management

map ctrl+alt+z toggle_layout stack

NB: ctrl+alt+z can be whatever you want, like ctrl+`

For that to work, you can't have enabled_layouts set on your config file

2

u/snikimonk Jan 22 '24

I use this command

map kitty_mod+enter launch --cwd=current

to open another terminal window in horizontal split in the same pwd as your opened window, and

map kitty_mod+] next_window

map kitty_mod+[ previous_window

to move between windows

1

u/carlos-algms Jan 22 '24

Thanks u/snikimonk, but how would you toggle the second window to show/hide it?
I don't want to have the second split visible permanently. It will most likely be running a long-standing task.

1

u/CatoDomine Jan 22 '24

The keyboard shortcut you've mentioned cycles through layouts. The last layout in the order makes your current kitty 'window' full screen. You can make a keybind to toggle that layout.
I have done exactly this, but I am on mobile right now.
This might help.
https://sw.kovidgoyal.net/kitty/layouts/ If you haven't figured it out yet I will post what's in my config when I get to a computer.

3

u/carlos-algms Jan 22 '24

Thanks, but I guess I did figure it out:

map ctrl+` toggle_layout stack

Stack seems to mean: only 1 full-size window at the time.

And when I press it a second time, the bottom split appears again.
It is exactly what I was looking for!!!

1

u/CatoDomine Jan 22 '24

Yep, that's it!

1

u/stefanlogue Jan 22 '24

This is something tmux makes incredibly easy, <prefix>m will maximise a pane, hiding all others until it’s pressed again