There are a number of terminals available for osx. I used iterm for a while, and it was fine. I don’t think it had panes when I first started using it, or maybe it did? But I found tmux, and tmux has a great plugin vim-tmux-navigator. Navigator makes moving between vim splits and tmux panes seamless.
Tmux also has sessions, sessions are kinda like browser tabs. I used a session for each software project I’d work on. Tmux prefix + s
lists all your sessions, and lets you move between them.
At some point I changed terminals from iterm to kitty. Iterm was fine, but iirc I was looking for a terminal I could use on both mac and linux. So I settled on kitty, but I continued using tmux. I was used to a terminal just kinda existing without using any of its features, so didn’t think about using kitty more.
But recently I switched jobs, and that got me thinking about my setup. I noticed kitty has windows (equivalent of tmux pane), so I wondered if I needed tmux at all? I made a list of the important features tmux gives me:
easily switch between projects
seamlessly switch between vim and shell panes
full-screen a pane
save and restore sessions
A few of these are easy. There is basically the same navigator plugin for kitty: vim-kitty-navigator. And full-screening a pane can be achieved with a mapping map ctrl+f toggle_layout stack
.
But there didn’t seem like a great solution to switching between projects. Kitty doesn’t have sessions like tmux, but it does have tabs. And it’s not too hard to manually create a tab, and cd to a project. But you’d have to click on a tab to switch, and any vim user will tell you that just won’t work.
Luckily kitty is easily scriptable. For example, you can list all tab titles: $ kitty @ ls | jq '.[0].tabs | map(.title)'.
Add in fzf and a kitty mapping and you have a fuzzy project switcher very similar to tmux:
# ~/.config/kitty/kitty.conf
map ctrl+space launch --type=overlay zsh -ic "kitty @ ls | jq -r '.[0].tabs | map(.title) | .[]' | fzf | xargs -I _ kitty @ focus-tab --match title:_"
I didn’t want to stop there, I figured I could create new “sessions“ as well. And after that I thought I could create new “sessions“ from github repos. This ended up working really well, so here it is: https://github.com/taylorzr/kitty-meow
A similar mapping lets you switch between open projects, and create new projects from local dirs or github:
# ~/.config/kitty/kitty.conf
map ctrl+space kitten meow/load_project.py --dir $HOME/code/ --org my_cool_org
map ctrl+- goto_tab -1 # previous tab
map ctrl+f toggle_layout stack # fullscreen window
After hitting ctrl-space, you can fuzzy pick an open project. Or you can hit ctrl-r to load a project from a local dir. Or ctrl-g will load a tab from a github repo!
This setup makes it really easy to load projects, so I’m not sure I need that last tmux feature, save and restore projects. But that is still possible with kitty. Kitty lets you define a session, and load it on startup. Or alternatively there is a plugin: https://github.com/dflock/kitty-save-session.
This is what I've been looking for, someone who's been down this road. Thank you!