mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-02 02:19:06 +01:00
Commit tmux plugin. Currently only contains tmux pane autocomplete.
This commit is contained in:
parent
11034217a7
commit
6049787510
1 changed files with 23 additions and 0 deletions
23
plugins/tmux/tmux.plugin.zsh
Normal file
23
plugins/tmux/tmux.plugin.zsh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# tmux pane word completion by Julius Plenz
|
||||
# Source: http://blog.plenz.com/2012-01/zsh-complete-words-from-tmux-pane.html
|
||||
|
||||
# C-x t to initiate prefix search completions
|
||||
# C-x C-x to initiate global search for completions
|
||||
_tmux_pane_words() {
|
||||
local expl
|
||||
local -a w
|
||||
if [[ -z "$TMUX_PANE" ]]; then
|
||||
_message "not running inside tmux!"
|
||||
return 1
|
||||
fi
|
||||
w=( ${(u)=$(tmux capture-pane \; show-buffer \; delete-buffer)} )
|
||||
_wanted values expl 'words from current tmux pane' compadd -a w
|
||||
}
|
||||
|
||||
zle -C tmux-pane-words-prefix complete-word _generic
|
||||
zle -C tmux-pane-words-anywhere complete-word _generic
|
||||
bindkey '^Xt' tmux-pane-words-prefix
|
||||
bindkey '^X^X' tmux-pane-words-anywhere
|
||||
zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' completer _tmux_pane_words
|
||||
zstyle ':completion:tmux-pane-words-(prefix|anywhere):*' ignore-line current
|
||||
zstyle ':completion:tmux-pane-words-anywhere:*' matcher-list 'b:=* m:{A-Za-z}={a-zA-Z}'
|
||||
Loading…
Add table
Add a link
Reference in a new issue