Skip to content

Commit

Permalink
Add tmux search bind.
Browse files Browse the repository at this point in the history
Press `S` to search google for the selected text in copymode
  • Loading branch information
micke committed Nov 4, 2015
1 parent 1068e3f commit 6fe053f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tmux.conf
Expand Up @@ -14,11 +14,12 @@ set -g history-limit 20000
bind = select-layout even-horizontal

# Smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"

set-window-option -g mode-keys vi

Expand Down Expand Up @@ -87,7 +88,9 @@ set-option -g display-panes-active-colour blue #blue
set-option -g display-panes-colour brightred #orange

# clock
set-window-option -g clock-mode-colour green #green)
set-window-option -g clock-mode-colour green #green

bind-key -t vi-copy S copy-pipe "xargs -I {} tmux run-shell 'cd #{pane_current_path}; open https://google.com/search?q=\"{}\" > /dev/null'"

bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
Expand Down

0 comments on commit 6fe053f

Please sign in to comment.