mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 09:56:39 +00:00
Use cd to set the working dir of a split or window so that rvm works
This commit is contained in:
@@ -17,8 +17,8 @@ new_window() {
|
|||||||
if [ -n "$2" ]; then local command=("$2"); fi
|
if [ -n "$2" ]; then local command=("$2"); fi
|
||||||
if [ -n "$window" ]; then local winarg=(-n "$window"); fi
|
if [ -n "$window" ]; then local winarg=(-n "$window"); fi
|
||||||
|
|
||||||
if [ -n "$window_root" ]; then cd "$window_root"; fi
|
|
||||||
tmux new-window -t "$session:" "${winarg[@]}" "${command[@]}"
|
tmux new-window -t "$session:" "${winarg[@]}" "${command[@]}"
|
||||||
|
__goto_window_or_session_path
|
||||||
}
|
}
|
||||||
|
|
||||||
# Split current window/pane vertically.
|
# Split current window/pane vertically.
|
||||||
@@ -30,6 +30,7 @@ new_window() {
|
|||||||
split_v() {
|
split_v() {
|
||||||
if [ -n "$1" ]; then local percentage=(-p "$1"); fi
|
if [ -n "$1" ]; then local percentage=(-p "$1"); fi
|
||||||
tmux split-window -t "$session:$window.$2" -v "${percentage[@]}"
|
tmux split-window -t "$session:$window.$2" -v "${percentage[@]}"
|
||||||
|
__goto_window_or_session_path
|
||||||
}
|
}
|
||||||
|
|
||||||
# Split current window/pane horizontally.
|
# Split current window/pane horizontally.
|
||||||
@@ -41,6 +42,7 @@ split_v() {
|
|||||||
split_h() {
|
split_h() {
|
||||||
if [ -n "$1" ]; then local percentage=(-p "$1"); fi
|
if [ -n "$1" ]; then local percentage=(-p "$1"); fi
|
||||||
tmux split-window -t "$session:$window.$2" -h "${percentage[@]}"
|
tmux split-window -t "$session:$window.$2" -h "${percentage[@]}"
|
||||||
|
__goto_window_or_session_path
|
||||||
}
|
}
|
||||||
|
|
||||||
# Select a specific window.
|
# Select a specific window.
|
||||||
@@ -234,3 +236,11 @@ __go_to_session() {
|
|||||||
tmux -u switch-client -t "$session:"
|
tmux -u switch-client -t "$session:"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__goto_window_or_session_path() {
|
||||||
|
local window_or_session_root=${window_root-$session_root}
|
||||||
|
if [ -n "$window_or_session_root" ]; then
|
||||||
|
run_cmd "cd \"$window_or_session_root\""
|
||||||
|
send_keys "C-l"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user