The idea behind ttr
is the same as behind Vim WhichKey. It allows you to run tasks using simple one character codes.
The main difference is ttr doesn't depend on any editor and works right in the shell.
ct
for cargo test
etc.)$ brew install bazhenov/tap/ttr
$ cur -OL https://github.com/bazhenov/ttr/releases/download/0.3.0/ttr-0.3.0-x86_64-unknown-linux-gnu.deb
$ dpkg -i ttr-0.3.0-x86_64-unknown-linux-gnu.deb
You need rust toolchain to be installed.
$ cargo install --git=https://github.com/bazhenov/ttr.git
ttr
looks for a .ttr.yaml
file in following directories:
$XDG_CONFIG_HOME
or .config/ttr
on Linux and ~/Library/Application Support/ttr
on macOS).Tasks from all files are merged together. Prirority is given to task defined earlier.
Configuration example:
groups:
- name: git
key: g
tasks:
- name: lazygit
key: g
cmd: lazygit
- name: git diff
key: d
cmd: git diff
- name: cargo
key: c
tasks:
- name: test
key: t
cmd: cargo test
confirm: true # displays confirmation after command exited
clear: true # clears terminal before running command
- name: run
key: r
cmd: cargo run
Add following code to your .zshrc
bindkey -s '^k' '^E^Uttr^M'
This will bind ttr
to Ctrl+k
Put following in ~/.config/fish/config.fish
bind \ck 'echo; ttr; commandline -f repaint'
Analog in bash would be following configuration in .bashrc
bind -x '"\C-K":"ttr"'
In tmux you can use shortcut to run ttr
like this:
bind t new-window sh -c "ttr"
Now on <leader>t
ttr will be executed in a new window in the current session. You also can map a key in a normal mode (no need to press the <leader>
key first)
bind -n C-Space new-window sh -c "ttr"
this will bind ttr
to Ctrl+Space.
In iTerm you can assign shortcuts to execute ttr
.