mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 09:56:39 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e21664439 | |||
| d4dfe39037 | |||
| b0b8d29d27 | |||
| 855c522cf0 | |||
| 0d3cfb2494 | |||
| 60e92c35e8 | |||
| 1e50f0c2c3 |
38
README.md
38
README.md
@@ -65,7 +65,7 @@ And add the following to your `~/.profile`, `~/.bash_profile` or equivalent:
|
||||
|
||||
*__Note:__ This section needs expanding upon.*
|
||||
|
||||
For a quick reference on available commands, please run:
|
||||
For a quick reference on available commands and their aliases, please run:
|
||||
|
||||
tmuxifier help
|
||||
|
||||
@@ -74,6 +74,41 @@ window and session layout files. New layout files are populated with examples
|
||||
and comments explaining what things do. Also, having a look at the
|
||||
[examples][] directory will also give you a good idea.
|
||||
|
||||
### Window Layouts
|
||||
|
||||
First off you'll want to define a window layout:
|
||||
|
||||
tmuxifier new-window my-awesome-window
|
||||
|
||||
This will create a new layout file called `my-awesome-window.window.sh` in
|
||||
your `$TMUXIFIER_LAYOUT_PATH`, and open it with the editor defined in
|
||||
`$EDITOR`. Customize it as you wish, and save.
|
||||
|
||||
You can now load *my-awesome-window* with the following command:
|
||||
|
||||
tmuxifier load-window my-awesome-window
|
||||
|
||||
You should now have a new Tmux window open created from your custom and
|
||||
awesome window layout.
|
||||
|
||||
### Session Layouts
|
||||
|
||||
To create your first session layout, run:
|
||||
|
||||
tmuxifier new-session my-awesome-session
|
||||
|
||||
Same deal as with creating a new window, except the filename ends with
|
||||
`.session.sh` instead of `.window.sh`, and the file's pre-populated content
|
||||
looks different. To have your awesome window loaded, add `load_window
|
||||
"my-awesome-window"` to the session layout next to existing examples.
|
||||
|
||||
To load the session layout simply run:
|
||||
|
||||
tmuxifier load-session my-awesome-session
|
||||
|
||||
You'll now have a new Tmux session with your previously defined awesome window
|
||||
in it.
|
||||
|
||||
[examples]: https://github.com/jimeh/tmuxifier/tree/master/examples
|
||||
|
||||
## Configure & Customize
|
||||
@@ -168,4 +203,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
@@ -24,13 +24,12 @@ case "$command" in
|
||||
;;
|
||||
|
||||
* )
|
||||
command_path="$(command -v "tmuxifier-$command" || true)"
|
||||
|
||||
# Attempt to resolve aliases
|
||||
if [ -z "$command_path" ]; then
|
||||
# Lookup command, attempt to resolve as alias if fails
|
||||
! command_path="$(command -v "tmuxifier-$command")"
|
||||
if [ ! -n $? ]; then
|
||||
resolved="$(tmuxifier-alias "$command")"
|
||||
if [ ! -z "$resolved" ]; then
|
||||
command_path="$(command -v "tmuxifier-$resolved" || true)"
|
||||
! command_path="$(command -v "tmuxifier-$resolved")"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -16,13 +16,14 @@ new_window() {
|
||||
if [ ! -z "$1" ]; then
|
||||
window="$1"
|
||||
fi
|
||||
local command=()
|
||||
if [ ! -z "$2" ]; then
|
||||
local command="\"$2\""
|
||||
command+=("$2")
|
||||
fi
|
||||
if [ ! -z "$window" ]; then
|
||||
local winarg="-n \"$window\""
|
||||
local winarg=(-n "$window")
|
||||
fi
|
||||
eval "tmux new-window -t \"$session:\" $winarg $command"
|
||||
tmux new-window -t "$session:" "${winarg[@]}" "${command[@]}"
|
||||
}
|
||||
|
||||
# Select a specific window.
|
||||
@@ -156,7 +157,7 @@ initialize_session() {
|
||||
# created, the session already exists, and we'll need to specifically switch
|
||||
# to it here.
|
||||
finalize_and_go_to_session() {
|
||||
tmux kill-window -t "$session:99" 2>/dev/null || true
|
||||
! tmux kill-window -t "$session:99" 2>/dev/null
|
||||
if [[ "$(tmuxifier-current-session)" != "$session" ]]; then
|
||||
__go_to_session
|
||||
fi
|
||||
|
||||
@@ -30,4 +30,7 @@ case "$1" in
|
||||
"list-win" | "lsw" )
|
||||
echo "list-windows"
|
||||
;;
|
||||
* )
|
||||
echo "unknown alias \"$1\""
|
||||
exit 1
|
||||
esac
|
||||
|
||||
@@ -18,13 +18,12 @@ if [ -z "$command" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
command_path="$(command -v "tmuxifier-$command" || true)"
|
||||
|
||||
# Attempt to resolve aliases
|
||||
if [ -z "$command_path" ]; then
|
||||
# Lookup command, attempt to resolve as alias if fails
|
||||
! command_path="$(command -v "tmuxifier-$command")"
|
||||
if [ ! -n $? ]; then
|
||||
resolved="$(tmuxifier-alias "$command")"
|
||||
if [ ! -z "$resolved" ]; then
|
||||
command_path="$(command -v "tmuxifier-$resolved" || true)"
|
||||
! command_path="$(command -v "tmuxifier-$resolved")"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ if [ "$1" == "--complete" ]; then
|
||||
fi
|
||||
|
||||
command="$1"
|
||||
command_path="$(command -v "tmuxifier-$command" || true)"
|
||||
|
||||
# Attempt to resolve aliases
|
||||
if [ -z "$command_path" ]; then
|
||||
# Lookup command, attempt to resolve as alias if fails
|
||||
! command_path="$(command -v "tmuxifier-$command")"
|
||||
if [ ! -n $? ]; then
|
||||
resolved="$(tmuxifier-alias "$command")"
|
||||
if [ ! -z "$resolved" ]; then
|
||||
command="$resolved"
|
||||
command_path="$(command -v "tmuxifier-$command" || true)"
|
||||
! command_path="$(command -v "tmuxifier-$command")"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
set -e
|
||||
[ -n "$TMUXIFIER_DEBUG" ] && set -x
|
||||
|
||||
echo "0.1.0"
|
||||
echo "0.1.1"
|
||||
|
||||
Reference in New Issue
Block a user