@@ -11,10 +11,6 @@ default_open_editor_key="C-o"
1111open_editor_option=" @open-editor"
1212open_editor_override=" @open-editor-command"
1313
14- default_open_search_key=" S"
15- open_search_option=" @open_search"
16- open_search_override=" @open_search_command"
17-
1814command_exists () {
1915 local command=" $1 "
2016 type " $command " > /dev/null 2>&1
@@ -41,7 +37,9 @@ command_generator() {
4137
4238search_command_generator () {
4339 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'"
4543}
4644
4745generate_open_command () {
@@ -57,9 +55,9 @@ generate_open_command() {
5755
5856generate_open_search_command () {
5957 if is_osx; then
60- echo " $( search_command_generator " open" ) "
58+ echo " $( search_command_generator " open" " $engine " ) "
6159 elif command_exists " xdg-open" ; then
62- echo " $( search_command_generator " xdg-open" ) "
60+ echo " $( search_command_generator " xdg-open" " $engine " ) "
6361 else
6462 # error command for Linux machines when 'xdg-open' not installed
6563 " $CURRENT_DIR /scripts/tmux_open_error_message.sh xdg-open"
@@ -97,13 +95,17 @@ set_copy_mode_open_editor_bindings() {
9795}
9896
9997set_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
107109}
108110
109111main () {
0 commit comments