Skip to content

Commit

Permalink
Add screencast
Browse files Browse the repository at this point in the history
  • Loading branch information
David Garcia committed Oct 14, 2020
1 parent 6bebffc commit 8759380
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
Binary file added .content/cast.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 28 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
# Tmux Project Switcher

Switch between tmux sessions that represent a project/repo.
Quickly switch between tmux sessions that represent a project/repo.

Given you have a root folder with all your projects like:

```
$HOME
└── src
   ├── github.com
│    ├── dgmora
│    │   ├── repo1
│    │   ├── tmux
│    │   └── tmux-project-switcher
│    └── tmux
│       ├── tmux
│       └── repo3
   ├── github.myenterprise.com
│    └── DavidMora
│       └── an-enterprise-repo
   └── gitlab.com
   └── dgmora
      └── i-have-repos-all-over-the-place
```
![](.content/cast.gif)

`tmux-project-switcher` will open a popup with all those leaf folders, where
you'll be able to fuzzy find a project you can switch to. When selected, it will
Expand All @@ -33,13 +12,13 @@ either switch to that session or create a new session, and change into the right

- [fzf](https://github.com/junegunn/fzf)
- Ruby
- Tmux >= 3.2
- Tmux >= 3.2 (still a rc)
- (optional) Works well with [`gh`](https://github.com/jdxcode/gh) for quickly cloning projects

## Tmux 3.2 popup window
### Tmux 3.2 popup window

This plugin works with the popup window, which is only supported in some of the
newer tmux versions. If you use `brew` you can install it with `--HEAD`
newer tmux versions. If you use `brew` you can install it with `brew install --HEAD tmux`

To check if that's working fine run inside a tmux session `tmux popup`. An empty popup should appear.

Expand All @@ -55,15 +34,31 @@ set -g @plugin 'dgmora/tmux-project-switcher'

## Setup

The default configuration assumes that you have a file structure as defined in the beginning:
The default configuration assumes that you have a file structure as defined like this:

```
$HOME
└── src
   ├── github.com
│    ├── dgmora
│    │   ├── repo1
│    │   └── tmux-project-switcher
│    └── tmux
│       └── repo3
   └── github.myenterprise.com
   └── DavidMora
      └── an-enterprise-repo
```

- A root folder with all your projects in `$HOME/src`.
- Your projects are at depth `3` from that folder. This is important becaus what you see
in the popup will be all folders at that depth from the root. 1st level would be `github.com`,
second `dgmora` and third `tmux-project-switcher`.
- The "meaningful name" of the project is the last `2` folders. i.e. `dgmora/tmux-project-switcher`.
this will be used for the tmux session name. 2 is used because of git forks. 1 can be used but
won't work super well if you have forks
- The default keys is `-n C-m-p`. So `ctrl + opt + P` (_without_ prefix). You can overwrite that with:
- The default key to trigger the switcher is `-n C-m-p`. So `ctrl + opt + P` (_without_ prefix). You can overwrite that by adding this to your `tmux.conf`:
```
set -g @switcher-key 'C-M-t' # This would be ctrl + M + t with prefix
Expand All @@ -89,4 +84,9 @@ The default is `fzf-tmux -w80% -h100% --preview ''`
## Credits

[TPM](https://github.com/tmux-plugins/tpm) for making it so easy to create tmux plugins

https://github.com/schasse/tmux-jump for inspiration on how to make it work with ruby!

https://github.com/dergachev for making screengif

https://github.com/jdxcode/gh to come up with such a simple but great idea to organize your repos

0 comments on commit 8759380

Please sign in to comment.