@@ -11,10 +11,6 @@ default_open_editor_key="C-o"
11
11
open_editor_option=" @open-editor"
12
12
open_editor_override=" @open-editor-command"
13
13
14
- default_open_search_key=" S"
15
- open_search_option=" @open_search"
16
- open_search_override=" @open_search_command"
17
-
18
14
command_exists () {
19
15
local command=" $1 "
20
16
type " $command " > /dev/null 2>&1
@@ -41,7 +37,9 @@ command_generator() {
41
37
42
38
search_command_generator () {
43
39
local command_string=" $1 "
44
- echo " xargs -I {} tmux run-shell 'cd #{pane_current_path}; $command_string https://www.google.com/search?q=\" {}\" > /dev/null'"
40
+ local engine=" $2 "
41
+
42
+ echo " xargs -I {} tmux run-shell 'cd #{pane_current_path}; $command_string $engine \" {}\" > /dev/null'"
45
43
}
46
44
47
45
generate_open_command () {
@@ -57,9 +55,9 @@ generate_open_command() {
57
55
58
56
generate_open_search_command () {
59
57
if is_osx; then
60
- echo " $( search_command_generator " open" ) "
58
+ echo " $( search_command_generator " open" " $engine " ) "
61
59
elif command_exists " xdg-open" ; then
62
- echo " $( search_command_generator " xdg-open" ) "
60
+ echo " $( search_command_generator " xdg-open" " $engine " ) "
63
61
else
64
62
# error command for Linux machines when 'xdg-open' not installed
65
63
" $CURRENT_DIR /scripts/tmux_open_error_message.sh xdg-open"
@@ -97,13 +95,17 @@ set_copy_mode_open_editor_bindings() {
97
95
}
98
96
99
97
set_copy_mode_open_search_bindings () {
100
- local search_command=" $( generate_open_search_command) "
101
- local key_bindings=$( get_tmux_option " $open_search_option " " $default_open_search_key " )
102
- local key
103
- for key in $key_bindings ; do
104
- tmux bind-key -t vi-copy " $key " copy-pipe " $search_command "
105
- tmux bind-key -t emacs-copy " $key " copy-pipe " $search_command "
106
- done
98
+ local stored_engine_vars=" $( stored_engine_vars) "
99
+ local engine_var
100
+ local engine
101
+ local key
102
+
103
+ for engine_var in $stored_engine_vars ; do
104
+ engine=" $( get_engine " $engine_var " ) "
105
+
106
+ tmux bind-key -t vi-copy " $engine_var " copy-pipe " $( generate_open_search_command " $engine " ) "
107
+ tmux bind-key -t emacs-copy " $engine_var " copy-pipe " $( generate_open_search_command " $engine " ) "
108
+ done
107
109
}
108
110
109
111
main () {
0 commit comments