Use cd to set the working dir of a split or window so that rvm works

This commit is contained in:
Trae Robrock
2012-06-27 17:46:12 -07:00
parent 54a4f565c6
commit 5c2659c8e7

View File

@@ -17,8 +17,8 @@ new_window() {
if [ -n "$2" ]; then local command=("$2"); 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[@]}"
__goto_window_or_session_path
}
# Split current window/pane vertically.
@@ -30,6 +30,7 @@ new_window() {
split_v() {
if [ -n "$1" ]; then local percentage=(-p "$1"); fi
tmux split-window -t "$session:$window.$2" -v "${percentage[@]}"
__goto_window_or_session_path
}
# Split current window/pane horizontally.
@@ -41,6 +42,7 @@ split_v() {
split_h() {
if [ -n "$1" ]; then local percentage=(-p "$1"); fi
tmux split-window -t "$session:$window.$2" -h "${percentage[@]}"
__goto_window_or_session_path
}
# Select a specific window.
@@ -234,3 +236,11 @@ __go_to_session() {
tmux -u switch-client -t "$session:"
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
}