Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow disabling current pane path as new windows starting path #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
### master
- update readme - write all keybindings
- override default split window key bindings
- added "@new_window_path" to allow disabling using the panes current path as
the new windows starting path

### v1.0.0, 2014-08-30
- update readme to reflect github organization change
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ Example:

set-option -g @pane_resize "10"


You can set `@new_window_path` Tmux option to false to disable creation of new windows with the starting path of the current pane. "true" is the default.

Example:

set-option -g @new_window_path "false"

### Other plugins

You might also find these useful:
Expand Down
7 changes: 6 additions & 1 deletion pain_control.tmux
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

default_pane_resize="5"
default_new_window_path="true"

# tmux show-option "q" (quiet) flag does not set return value to 1, even though
# the option does not exist. This function patches that.
Expand Down Expand Up @@ -49,7 +50,11 @@ pane_split_bindings() {
}

improve_new_window_binding() {
tmux bind-key "c" new-window -c "#{pane_current_path}"
local args=()
if [ $(get_tmux_option "@new_window_path" "$default_new_window_path") = "true" ]; then
args=(-c "#{pane_current_path}")
fi
tmux bind-key "c" new-window "${args[@]}"
}

main() {
Expand Down