mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 09:56:39 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9baadfbb1e | |||
| 2adc885bb8 | |||
| 7cc0fa2d0e | |||
| 7aeeaf31d1 | |||
| ca6dcfaaf2 | |||
|
|
fdbb1704e0 | ||
|
|
499c5abd83 | ||
| 3563c3d975 | |||
| 3bfbc50918 | |||
|
|
3a8a43ccdc | ||
|
|
a9a87992df | ||
| 5f4dd92d7f | |||
|
|
bdaa272ca5 | ||
| dce4fb3ad2 | |||
|
|
6f8773133d |
@@ -8,7 +8,7 @@ env:
|
||||
before_install:
|
||||
- sudo apt-get update
|
||||
- sudo apt-get install -y bc build-essential libevent-dev libncurses5-dev
|
||||
- wget http://downloads.sourceforge.net/tmux/tmux-${TMUX_VERSION}.tar.gz
|
||||
- wget https://github.com/tmux/tmux/releases/download/${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz
|
||||
- tar -zxf tmux-${TMUX_VERSION}.tar.gz
|
||||
- cd tmux-${TMUX_VERSION}
|
||||
- ./configure && make && sudo make install
|
||||
|
||||
@@ -216,7 +216,7 @@ example:
|
||||
- Setting the `TMUXIFIER_TMUX_ITERM_ATTACH` environment variable to `-CC`
|
||||
before calling the `load-session` command.
|
||||
|
||||
[tmux integration]: https://code.google.com/p/iterm2/wiki/TmuxIntegration
|
||||
[tmux integration]: https://gitlab.com/gnachman/iterm2/wikis/TmuxIntegration
|
||||
|
||||
## Inspiration
|
||||
|
||||
|
||||
@@ -22,6 +22,10 @@ new_window() {
|
||||
if [ -n "$2" ]; then local command=("$2"); fi
|
||||
|
||||
tmuxifier-tmux new-window -t "$session:" "${winarg[@]}" "${command[@]}"
|
||||
|
||||
# Disable renaming if a window name was given.
|
||||
if [ -n "$1" ]; then tmuxifier-tmux set-option -t "$1" allow-rename off; fi
|
||||
|
||||
window="$(__get_current_window_index)"
|
||||
__go_to_window_or_session_path
|
||||
}
|
||||
@@ -101,6 +105,14 @@ select_pane() {
|
||||
tmuxifier-tmux select-pane -t "$session:$window.$1"
|
||||
}
|
||||
|
||||
balance_windows_vertical() {
|
||||
tmuxifier-tmux select-layout even-vertical
|
||||
}
|
||||
|
||||
balance_windows_horizontal() {
|
||||
tmuxifier-tmux select-layout even-horizontal
|
||||
}
|
||||
|
||||
# Send/paste keys to the currently active pane/window.
|
||||
#
|
||||
# Arguments:
|
||||
@@ -185,31 +197,39 @@ load_window() {
|
||||
# - $2: (optional) Override default window name.
|
||||
#
|
||||
load_session() {
|
||||
local file="$1"
|
||||
if [ ! -f "$file" ]; then
|
||||
file="$TMUXIFIER_LAYOUT_PATH/$1.session.sh"
|
||||
fi
|
||||
|
||||
if [ -f "$file" ]; then
|
||||
if [ $# -gt 1 ]; then
|
||||
session="$2"
|
||||
local file
|
||||
if [ "${1#*/}" = "$1" ]; then
|
||||
# There's no slash in the path.
|
||||
if [ -f "$TMUXIFIER_LAYOUT_PATH/$1.session.sh" ] || [ ! -f "$1" ]; then
|
||||
file="$TMUXIFIER_LAYOUT_PATH/$1.session.sh"
|
||||
else
|
||||
session="${1/%.session.sh}"
|
||||
session="${session/%.sh}"
|
||||
fi
|
||||
|
||||
set_default_path=true
|
||||
source "$file"
|
||||
session=
|
||||
|
||||
# Reset `$session_root`.
|
||||
if [[ "$session_root" != "$HOME" ]]; then
|
||||
session_root="$HOME"
|
||||
# bash's 'source' requires an slash in the filename to not use $PATH.
|
||||
file="./$1"
|
||||
fi
|
||||
else
|
||||
file="$1"
|
||||
fi
|
||||
|
||||
if ! [ -f "$file" ]; then
|
||||
echo "\"$1\" session layout not found." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ $# -gt 1 ]; then
|
||||
session="$2"
|
||||
else
|
||||
session="${1/%.session.sh}"
|
||||
session="${session/%.sh}"
|
||||
fi
|
||||
|
||||
set_default_path=true
|
||||
source "$file"
|
||||
session=
|
||||
|
||||
# Reset `$session_root`.
|
||||
if [[ "$session_root" != "$HOME" ]]; then
|
||||
session_root="$HOME"
|
||||
fi
|
||||
}
|
||||
|
||||
# Create a new session, returning 0 on success, 1 on failure.
|
||||
|
||||
@@ -11,7 +11,7 @@ if calling-help "$@"; then
|
||||
|
||||
Outputs current Tmux version. If given optional target-version it outputs one
|
||||
of three possible characters indicating if the current Tmux version number is
|
||||
equal to, less than, or greater than the [target-version].
|
||||
equal to, less than, or greater than the <target-version>.
|
||||
|
||||
The three possible outputs are \"=\", \"<\", and \">\"."
|
||||
exit
|
||||
@@ -44,7 +44,16 @@ vercomp () {
|
||||
version=$(tmux -V)
|
||||
version=${version/tmux /}
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
if [ -z "$1" ]; then
|
||||
echo "$version"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$version" == "master" ]; then
|
||||
# When version string is "master", tmux was compiled from source, and we
|
||||
# assume it's later than whatever the <target-version> is.
|
||||
echo '>'
|
||||
else
|
||||
# Fix for "1.9a" version comparison, as vercomp() can only deal with
|
||||
# purely numeric version numbers.
|
||||
version=${version//+([a-zA-Z])/}
|
||||
@@ -55,6 +64,4 @@ if [ -n "$1" ]; then
|
||||
1) echo '>';;
|
||||
2) echo '<';;
|
||||
esac
|
||||
else
|
||||
echo "$version"
|
||||
fi
|
||||
|
||||
@@ -13,4 +13,4 @@ Outputs Tmuxifier version."
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "0.12.1"
|
||||
echo "0.12.3"
|
||||
|
||||
Reference in New Issue
Block a user