tmux-plugins / tmux-copycat

A plugin that enhances tmux search
MIT License
1.11k stars 63 forks source link

Add ssh:// and general URLs to url_search #72

Closed DamZiobro closed 9 years ago

DamZiobro commented 9 years ago

Here is patch which should help:

diff --git a/copycat.tmux b/copycat.tmux
index 19ac082..72c16d5 100755
--- a/copycat.tmux
+++ b/copycat.tmux
@@ -14,7 +14,7 @@ set_default_stored_searches() {
        local ip_search="$(get_tmux_option "$copycat_ip_search_option" "$default_ip_search_key")"

        if stored_search_not_defined "$url_search"; then
-               tmux set-option -g "${COPYCAT_VAR_PREFIX}_${url_search}" "(https?://|git@|git://|ftp://|file:///)[[:alnum:]?=%/_.:,;~@!#$&()*+-]*"
+               tmux set-option -g "${COPYCAT_VAR_PREFIX}_${url_search}" "(https?://|git@|git://|ftp://|ssh://|[a-z]+://|file:///)[[:alnum:]?=%/_.:,;~@!#$&()*+-]*"
        fi
        if stored_search_not_defined "$file_search"; then
                tmux set-option -g "${COPYCAT_VAR_PREFIX}_${file_search}" "(^|^\.|[[:space:]]|[[:space:]]\.|[[:space:]]\.\.|^\.\.)[[:alnum:]~_]*/[][[:alnum:]_.#$%&+=/@-]*"
bruno- commented 9 years ago

Hey, thanks for the patch! I'm a bit reluctant to add general case [a-z]+ because it might match something random, so there might be false positives.

About adding support for ssh://: is that something you somehow use within tmux? I'm asking because whenever I use ssh in the terminal it's mostly in the format of user@domain.com.

jbnicolai commented 9 years ago

@bruno- the output of git remote -v for instance, might very well list an ssh:// url.