Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### master
- fix a problem where we try to bind `editor` from `@open-editor`
- add a "@open-cancel-copy-mode" option that indicates exiting copy mode. if set to "off", will to preserve copy mode. ( default is "on" )

### v3.0.0, Nov 01, 2017
- enable extensibility via search engines (@vasconcelloslf)
Expand Down
28 changes: 22 additions & 6 deletions open.tmux
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ open_option="@open"
default_open_editor_key="C-o"
open_editor_option="@open-editor"
open_editor_override="@open-editor-command"
cancel_copy_mode=$(get_tmux_option "@open-cancel-copy-mode" "on")

command_exists() {
local command="$1"
Expand Down Expand Up @@ -93,8 +94,13 @@ set_copy_mode_open_bindings() {
local key
for key in $key_bindings; do
if tmux-is-at-least 2.4; then
tmux bind-key -T copy-mode-vi "$key" send-keys -X copy-pipe-and-cancel "$open_command"
tmux bind-key -T copy-mode "$key" send-keys -X copy-pipe-and-cancel "$open_command"
if [[ "$cancel_copy_mode" == "on" ]]; then
tmux bind-key -T copy-mode-vi "$key" send-keys -X copy-pipe-and-cancel "$open_command"
tmux bind-key -T copy-mode "$key" send-keys -X copy-pipe-and-cancel "$open_command"
else
tmux bind-key -T copy-mode-vi "$key" send-keys -X copy-pipe "$open_command"
tmux bind-key -T copy-mode "$key" send-keys -X copy-pipe "$open_command"
fi
else
tmux bind-key -t vi-copy "$key" copy-pipe "$open_command"
tmux bind-key -t emacs-copy "$key" copy-pipe "$open_command"
Expand All @@ -108,8 +114,13 @@ set_copy_mode_open_editor_bindings() {
local key
for key in $key_bindings; do
if tmux-is-at-least 2.4; then
tmux bind-key -T copy-mode-vi "$key" send-keys -X copy-pipe-and-cancel "$editor_command"
tmux bind-key -T copy-mode "$key" send-keys -X copy-pipe-and-cancel "$editor_command"
if [[ "$cancel_copy_mode" == "on" ]]; then
tmux bind-key -T copy-mode-vi "$key" send-keys -X copy-pipe-and-cancel "$editor_command"
tmux bind-key -T copy-mode "$key" send-keys -X copy-pipe-and-cancel "$editor_command"
else
tmux bind-key -T copy-mode-vi "$key" send-keys -X copy-pipe "$editor_command"
tmux bind-key -T copy-mode "$key" send-keys -X copy-pipe "$editor_command"
fi
else
tmux bind-key -t vi-copy "$key" copy-pipe "$editor_command"
tmux bind-key -t emacs-copy "$key" copy-pipe "$editor_command"
Expand All @@ -127,8 +138,13 @@ set_copy_mode_open_search_bindings() {
engine="$(get_engine "$engine_var")"

if tmux-is-at-least 2.4; then
tmux bind-key -T copy-mode-vi "$engine_var" send-keys -X copy-pipe-and-cancel "$(generate_open_search_command "$engine")"
tmux bind-key -T copy-mode "$engine_var" send-keys -X copy-pipe-and-cancel "$(generate_open_search_command "$engine")"
if [[ "$cancel_copy_mode" == "on" ]]; then
tmux bind-key -T copy-mode-vi "$engine_var" send-keys -X copy-pipe-and-cancel "$(generate_open_search_command "$engine")"
tmux bind-key -T copy-mode "$engine_var" send-keys -X copy-pipe-and-cancel "$(generate_open_search_command "$engine")"
else
tmux bind-key -T copy-mode-vi "$engine_var" send-keys -X copy-pipe "$(generate_open_search_command "$engine")"
tmux bind-key -T copy-mode "$engine_var" send-keys -X copy-pipe "$(generate_open_search_command "$engine")"
fi
else
tmux bind-key -t vi-copy "$engine_var" copy-pipe "$(generate_open_search_command "$engine")"
tmux bind-key -t emacs-copy "$engine_var" copy-pipe "$(generate_open_search_command "$engine")"
Expand Down