mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 09:56:39 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a7473208c0 | |||
| 1dddbb502c | |||
| da1354d5b7 | |||
| f01c789de4 | |||
| b52ef20be8 | |||
|
|
212693b1e9 | ||
| 908152bb57 | |||
| a0365273d0 | |||
| 6c8777adc2 | |||
|
|
5e33aefa7d |
@@ -45,6 +45,38 @@ split_h() {
|
||||
__go_to_window_or_session_path
|
||||
}
|
||||
|
||||
# Split current window/pane vertically by line count.
|
||||
#
|
||||
# Arguments:
|
||||
# - $1: (optional) Number of lines the new pane will use.
|
||||
# - $2: (optional) Target pane ID to split in current window.
|
||||
#
|
||||
split_vl() {
|
||||
if [ -n "$1" ]; then local count=(-l "$1"); fi
|
||||
tmux split-window -t "$session:$window.$2" -v "${count[@]}"
|
||||
__go_to_window_or_session_path
|
||||
}
|
||||
|
||||
# Split current window/pane horizontally by column count.
|
||||
#
|
||||
# Arguments:
|
||||
# - $1: (optional) Number of columns the new pane will use.
|
||||
# - $2: (optional) Target pane ID to split in current window.
|
||||
#
|
||||
split_hl() {
|
||||
if [ -n "$1" ]; then local count=(-l "$1"); fi
|
||||
tmux split-window -t "$session:$window.$2" -h "${count[@]}"
|
||||
__go_to_window_or_session_path
|
||||
}
|
||||
|
||||
# Run clock mode.
|
||||
#
|
||||
# Arguments:
|
||||
# - $1: (optional) Target pane ID in which to run
|
||||
clock() {
|
||||
tmux clock-mode -t "$session:$window.$1"
|
||||
}
|
||||
|
||||
# Select a specific window.
|
||||
#
|
||||
# Arguments:
|
||||
@@ -111,12 +143,22 @@ window_root() {
|
||||
# Load specified window layout.
|
||||
#
|
||||
# Arguments:
|
||||
# - $1: Name of window layout to load.
|
||||
# - $1: Name of or file path to window layout to load.
|
||||
# - $2: (optional) Override default window name.
|
||||
#
|
||||
load_window() {
|
||||
local file="$TMUXIFIER_LAYOUT_PATH/$1.window.sh"
|
||||
local file="$1"
|
||||
if [ ! -f "$file" ]; then
|
||||
file="$TMUXIFIER_LAYOUT_PATH/$1.window.sh"
|
||||
fi
|
||||
|
||||
if [ -f "$file" ]; then
|
||||
window="$1"
|
||||
if [ $# -gt 1 ]; then
|
||||
window="$2"
|
||||
else
|
||||
window="${1/%.window.sh}"
|
||||
window="${window/%.sh}"
|
||||
fi
|
||||
source "$file"
|
||||
window=
|
||||
|
||||
@@ -125,19 +167,31 @@ load_window() {
|
||||
window_root "$session_root"
|
||||
fi
|
||||
else
|
||||
echo "No such window layout found '$1' in '$TMUXIFIER_LAYOUT_PATH'."
|
||||
echo "\"$1\" window layout not found." >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Load specified session layout.
|
||||
#
|
||||
# Arguments:
|
||||
# - $1: Name of session layout to load.
|
||||
# - $1: Name of or file path to session layout to load.
|
||||
# - $2: (optional) Override default window name.
|
||||
#
|
||||
load_session() {
|
||||
local file="$TMUXIFIER_LAYOUT_PATH/$1.session.sh"
|
||||
local file="$1"
|
||||
if [ ! -f "$file" ]; then
|
||||
file="$TMUXIFIER_LAYOUT_PATH/$1.session.sh"
|
||||
fi
|
||||
|
||||
if [ -f "$file" ]; then
|
||||
session="$1"
|
||||
if [ $# -gt 1 ]; then
|
||||
session="$2"
|
||||
else
|
||||
session="${1/%.session.sh}"
|
||||
session="${session/%.sh}"
|
||||
fi
|
||||
|
||||
set_default_path=true
|
||||
source "$file"
|
||||
session=
|
||||
@@ -147,7 +201,8 @@ load_session() {
|
||||
session_root="$HOME"
|
||||
fi
|
||||
else
|
||||
echo "No such session layout found '$1' in '$TMUXIFIER_LAYOUT_PATH'."
|
||||
echo "\"$1\" session layout not found." >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ set -e
|
||||
|
||||
# Set shell to first argument that is not "-", "-h" or "--help".
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" != "-" ] &&[ "$arg" != "-h" ] && [ "$arg" != "--help" ]; then
|
||||
if [ "$arg" != "-" ] && [ "$arg" != "-h" ] && [ "$arg" != "--help" ]; then
|
||||
shell="$arg"
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -7,7 +7,7 @@ source "$TMUXIFIER/lib/util.sh"
|
||||
|
||||
# Provide tmuxifier help
|
||||
if calling-help "$@"; then
|
||||
echo "usage: tmuxifier load-session <layout_name>
|
||||
echo "usage: tmuxifier load-session <layout_name | file_path>
|
||||
|
||||
Aliases: session, ses, s
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ source "$TMUXIFIER/lib/util.sh"
|
||||
|
||||
# Provide tmuxifier help
|
||||
if calling-help "$@"; then
|
||||
echo "usage: tmuxifier load-window <layout_name>
|
||||
echo "usage: tmuxifier load-window <layout_name | file_path>
|
||||
|
||||
Aliases: window, win, w
|
||||
|
||||
|
||||
@@ -13,4 +13,4 @@ Outputs Tmuxifier version."
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "0.7.1"
|
||||
echo "0.8.0"
|
||||
|
||||
Reference in New Issue
Block a user