decorate
decorate is a minimal tmux dsl for storing tmux pane and window configurations as simple shell scripts.
An example decorate script looks like this:
w srv _srv
w code _code
v _watch_css
h _watch_js
Commands
w [window-name] [command]
- create a new windowv [command]
- vertical splith [command]
- horizontal split
Getting Started
First, source the included shell script.
. decorate-internal
Then, assuming your commands are saved in a directory called “features”, source your shellscript of commands:
. features/example
Pane Creation
The currently attached session is used for creating windows and panes. Splits act on the last created window. Commands are sent to the last created pane.
Managing Large Commands
Use sourced shell functions for longer commands and place them in files
named after the feature. Place them in a functions directory and source
them in your .bashrc
. For example, this shellscript called dev-project
provides pane commands for a web development project:
__docker_up() {
docker inspect --format='' gt 2> /dev/null
}
_srv() {
cd ~/_dev/project && . docker-kit.sh && dstart
}
_code() {
cd ~/_dev/project
}
_watch_css() {
if [ "$(__docker_up)" == "true" ]; then
cd ~/_dev/project && docker exec project npm run watch
else
_watch_css
end
}
_watch_js() {
if [ "$(__docker_up)" == "true" ]; then
cd ~/_dev/project && docker exec project npm run watch-webpack
else
_watch_js
end
}