Skip to content

A kitty terminal extension for working with projects. It allows you to easily switch between projects, and load them either from local directories or github.

Notifications You must be signed in to change notification settings

taylorzr/kitty-meow

Repository files navigation

Kitty-Meow

Meow is a kitty terminal extension for working with projects, where each kitty tab is a different project. It allows you to fuzzy switch between projects, and load them either from local directories or github.

If you've used tmux, this is similar to switching between sessions, but allows you to create new sessions as well.

Meow Screenshot

Usage

Call your project mapping, e.g. ctrl-p, and hit enter to select. Initially, tabs & local projects are listed, but you can show remote, local project only, or tabs only.

On select

  • if the project is already in a tab, meow switches to that tab
  • if the project is a local dir, meow creates a new tab
  • if the project is github, meow clones to the first --dir, and creates a new tab

Installation

git clone git@github.com:taylorzr/kitty-meow.git ~/.config/kitty/meow

Depends on fzf and jq.

Getting Started

You'll need to:

  • create mappings
  • set your github token as env

For example:

# ~/.config/kitty/kitty.conf

env GITHUB_TOKEN=<github_token>
env BIN_PATH=/opt/homebrew/bin/ # probably only needed on macs
map ctrl+p kitten meow/projects.py load --dir $HOME/code/ --user my_cool_self --org my_cool_org
map ctrl+shift+n kitten meow/projects.py new --dir $HOME/code/
map ctrl+shift+x kitten meow/kill_old_projects.py
map ctrl+shift+g kitten meow/cache_all_repos.py --org my_cool_org
map ctrl+- goto_tab -1

Kitty Mappings

Loading projects

Create a mapping for loading projects. The pattern is:

# ~/.config/kitty/kitty.conf

map ctrl+p kitten meow/project.py load --dir $HOME/code/ --user <you> --org <github_org>

--dir can be provided multiple times.

  • when a dir ends in /, meow shows all it's subdirs
  • otherwise, meow only shows that specific dir

For example, I use:

# ~/.config/kitty/kitty.conf

map ctrl+p kitten meow/project.py load --dir $HOME/code/ --dir $HOME --dir $HOME/.config/kitty/meow --org my_cool_org

On mac, paths are goofy. You proabably need to set env BIN_PATH as well. This should be the dir containing and fzf.

# ~/.config/kitty/kitty.conf

env BIN_PATH=/opt/homebrew/bin/

Caching github repositories

If you work in an org with lots of repos, loading remote projects can be slow. You can create a binding that will cache all the repos for orgs. This is a manual process, just run it whenever you need to update the list of projects for an org.

map ctrl+shift+g kitten meow/cache_all_repos.py --org my_cool_org

Just like the projects.py load mapping, you can specify multiple users and orgs in your cache mapping. You might want these to be different than users and orgs in your projects.py load mapping, because an org might have lots of repos, but your user just a few. Any uncached users/orgs repos will be loaded from github on every call to projects.py load. And the cache never expires, you must call cache_all_repos to refresh it.

Github Auth

You need to create a github token, and set it as env GITHUB_TOKEN. Because I commit kitty.conf to my dotfiles, I put any secrets in an extra conf file:

# ~/.config/kitty/kitty.conf

include ./dont_commit_me.conf
# ~/.config/kitty/dont_commit_me.conf

env GITHUB_TOKEN=<github_token>

You need to put env in your kitty config, not .zshrc. More about that here

TODO

  • record short video demo
  • configurable fzf bindings
  • selectable dir to clone to?
    • some people might use 1 dir for work and one for personal?
  • maybe use flags like --login=user=taylorzr --login=org=my_cool_org
  • combine the scripts into one cli with subcommands

About

A kitty terminal extension for working with projects. It allows you to easily switch between projects, and load them either from local directories or github.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages