├── .editorconfig ├── LICENSE ├── README.md ├── anyframe-functions ├── actions │ ├── anyframe-action-execute │ ├── anyframe-action-insert │ └── anyframe-action-put ├── selectors │ ├── anyframe-selector-auto │ ├── anyframe-selector-fzf │ ├── anyframe-selector-fzf-tmux │ ├── anyframe-selector-peco │ └── anyframe-selector-percol ├── sources │ ├── anyframe-source-all-widgets │ ├── anyframe-source-cdr │ ├── anyframe-source-ghq-repository │ ├── anyframe-source-git-branch │ ├── anyframe-source-git-status │ ├── anyframe-source-history │ ├── anyframe-source-list-file │ ├── anyframe-source-process │ └── anyframe-source-tmux-sessions └── widgets │ ├── anyframe-widget-cd-ghq-repository │ ├── anyframe-widget-cdr │ ├── anyframe-widget-checkout-git-branch │ ├── anyframe-widget-execute-history │ ├── anyframe-widget-git-add │ ├── anyframe-widget-insert-filename │ ├── anyframe-widget-insert-git-branch │ ├── anyframe-widget-kill │ ├── anyframe-widget-put-history │ ├── anyframe-widget-select-widget │ └── anyframe-widget-tmux-attach ├── anyframe-init └── anyframe.plugin.zsh /.editorconfig: -------------------------------------------------------------------------------- 1 | ; This file is for unifying the coding style for different editors and IDEs. 2 | ; More information at http://EditorConfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | indent_style = space 8 | indent_size = 2 9 | tab_width = 2 10 | end_of_line = LF 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Hideaki Miyake 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # anyframe 2 | 3 | ## Synopsis 4 | 5 | ## How to set up 6 | 7 | First of all, you need to install [peco](https://github.com/peco/peco), [percol](https://github.com/mooz/percol), or [fzf](https://github.com/junegunn/fzf) (, or fzf-tmux) 8 | 9 | ### Manually install 10 | 11 | Put all files somewhere in your $fpath, and add the following lines to your .zshrc: 12 | 13 | ``` 14 | autoload -Uz anyframe-init 15 | anyframe-init 16 | ``` 17 | 18 | #### For example 19 | 20 | ``` 21 | # download all files 22 | % cd /path/to/dir 23 | % git clone https://github.com/mollifier/anyframe 24 | ``` 25 | 26 | And add the following lines to your .zshrc: 27 | 28 | ``` 29 | fpath=(/path/to/dir/anyframe(N-/) $fpath) 30 | 31 | autoload -Uz anyframe-init 32 | anyframe-init 33 | ``` 34 | 35 | ### Installing using Antigen 36 | If you use [Antigen](https://github.com/zsh-users/antigen), add the following line to your .zshrc: 37 | 38 | ``` 39 | antigen bundle mollifier/anyframe 40 | ``` 41 | 42 | ### keybind 43 | You can map anyframe widgets to whatever key you like. 44 | 45 | For example, add the following lines to your .zshrc: 46 | 47 | ``` 48 | bindkey '^xb' anyframe-widget-cdr 49 | bindkey '^x^b' anyframe-widget-checkout-git-branch 50 | 51 | bindkey '^xr' anyframe-widget-execute-history 52 | bindkey '^x^r' anyframe-widget-execute-history 53 | 54 | bindkey '^xi' anyframe-widget-put-history 55 | bindkey '^x^i' anyframe-widget-put-history 56 | 57 | bindkey '^xg' anyframe-widget-cd-ghq-repository 58 | bindkey '^x^g' anyframe-widget-cd-ghq-repository 59 | 60 | bindkey '^xk' anyframe-widget-kill 61 | bindkey '^x^k' anyframe-widget-kill 62 | 63 | bindkey '^xe' anyframe-widget-insert-git-branch 64 | bindkey '^x^e' anyframe-widget-insert-git-branch 65 | ``` 66 | 67 | ## Requirement 68 | 69 | Some widgets requires external commands. 70 | 71 | ### anyframe-widget-cdr 72 | require cdr 73 | 74 | To use cdr, add the following line to your .zshrc: 75 | 76 | ``` 77 | autoload -Uz chpwd_recent_dirs cdr add-zsh-hook 78 | add-zsh-hook chpwd chpwd_recent_dirs 79 | ``` 80 | 81 | for more information, see REMEMBERING RECENT DIRECTORIES section in man zshcontrib(1) 82 | 83 | ### anyframe-widget-cd-ghq-repository 84 | require [ghq](https://github.com/motemen/ghq) 85 | 86 | 87 | ## Usage 88 | 89 | ## Configurations 90 | 91 | ``` 92 | # expressly specify to use peco 93 | zstyle ":anyframe:selector:" use peco 94 | # expressly specify to use percol 95 | zstyle ":anyframe:selector:" use percol 96 | # expressly specify to use fzf-tmux 97 | zstyle ":anyframe:selector:" use fzf-tmux 98 | # expressly specify to use fzf 99 | zstyle ":anyframe:selector:" use fzf 100 | 101 | # specify path and options for peco, percol, or fzf 102 | zstyle ":anyframe:selector:peco:" command 'peco --no-ignore-case' 103 | zstyle ":anyframe:selector:percol:" command 'percol --case-sensitive' 104 | zstyle ":anyframe:selector:fzf-tmux:" command 'fzf-tmux --extended' 105 | zstyle ":anyframe:selector:fzf:" command 'fzf --extended' 106 | ``` 107 | 108 | ## Examples 109 | 110 | 111 | -------------------------------------------------------------------------------- /anyframe-functions/actions/anyframe-action-execute: -------------------------------------------------------------------------------- 1 | # anyframe-action-execute [-q|-Q|-d] 2 | # Options 3 | # -q : quote special characters in the resulting words with backslashes 4 | # -Q : not quote special characters with backslashes [Default] 5 | # -d : use double quote to embrace selected items 6 | 7 | function _anyframe-action-execute() 8 | { 9 | if zle; then 10 | BUFFER="$*" 11 | zle accept-line 12 | # redisplay the command line 13 | zle -R -c 14 | else 15 | eval "$*" 16 | fi 17 | } 18 | 19 | local quote_item="0" 20 | local use_double_quote="0" 21 | local option OPTARG OPTIND 22 | while getopts ':q:d' option; do 23 | case $option in 24 | q) 25 | quote_item="1" 26 | ;; 27 | Q) 28 | quote_item="0" 29 | ;; 30 | d) 31 | use_double_quote="1" 32 | ;; 33 | *) 34 | echo "$0: invalid option -- $OPTARG" 1>&2 35 | return 1 36 | ;; 37 | esac 38 | done 39 | shift $((OPTIND - 1)) 40 | 41 | local selected_items 42 | selected_items="$(cat)" 43 | if [[ -z "$selected_items" ]]; then 44 | return 1 45 | fi 46 | 47 | local dquote="" 48 | if [[ "$use_double_quote" == "1" ]]; then 49 | dquote="\"" 50 | fi 51 | 52 | if [[ "$quote_item" == "1" ]]; then 53 | # (q) : Quote characters that are special to the shell in the resulting words with backslashes 54 | _anyframe-action-execute "${(q)@}" "${dquote}""${(fq)selected_items}""${dquote}" 55 | else 56 | _anyframe-action-execute "$@" "${dquote}""${(f)selected_items}""${dquote}" 57 | fi 58 | 59 | 60 | # Local Variables: 61 | # mode: Shell-Script 62 | # End: 63 | # vim: ft=zsh 64 | -------------------------------------------------------------------------------- /anyframe-functions/actions/anyframe-action-insert: -------------------------------------------------------------------------------- 1 | # anyframe-action-insert [-q|-Q] 2 | # Options 3 | # -q : quote special characters in the resulting words with backslashes 4 | # -Q : not quote special characters with backslashes [Default] 5 | 6 | function _anyframe-action-insert() 7 | { 8 | if zle; then 9 | LBUFFER+="$*" 10 | CURSOR=$#LBUFFER 11 | # redisplay the command line 12 | zle -R -c 13 | else 14 | print -z -f '%s' "$*" 15 | fi 16 | } 17 | 18 | local quote_item="0" 19 | local option OPTARG OPTIND 20 | while getopts ':q' option; do 21 | case $option in 22 | q) 23 | quote_item="1" 24 | ;; 25 | Q) 26 | quote_item="0" 27 | ;; 28 | *) 29 | echo "$0: invalid option -- $OPTARG" 1>&2 30 | return 1 31 | ;; 32 | esac 33 | done 34 | shift $((OPTIND - 1)) 35 | 36 | local selected_items 37 | selected_items="$(cat)" 38 | if [[ -z "$selected_items" ]]; then 39 | return 1 40 | fi 41 | 42 | if [[ "$quote_item" == "1" ]]; then 43 | # (q) : Quote characters that are special to the shell in the resulting words with backslashes 44 | _anyframe-action-insert "${(q)@}" "${(fq)selected_items}" 45 | else 46 | _anyframe-action-insert "$@" "${(f)selected_items}" 47 | fi 48 | 49 | # Local Variables: 50 | # mode: Shell-Script 51 | # End: 52 | # vim: ft=zsh 53 | -------------------------------------------------------------------------------- /anyframe-functions/actions/anyframe-action-put: -------------------------------------------------------------------------------- 1 | # anyframe-action-put [-q|-Q] 2 | # Options 3 | # -q : quote special characters in the resulting words with backslashes 4 | # -Q : not quote special characters with backslashes [Default] 5 | 6 | function _anyframe-action-put() 7 | { 8 | if zle; then 9 | BUFFER="$*" 10 | CURSOR=$#BUFFER 11 | # redisplay the command line 12 | zle -R -c 13 | else 14 | print -z -f '%s' "$*" 15 | fi 16 | } 17 | 18 | local quote_item="0" 19 | local option OPTARG OPTIND 20 | while getopts ':q' option; do 21 | case $option in 22 | q) 23 | quote_item="1" 24 | ;; 25 | Q) 26 | quote_item="0" 27 | ;; 28 | *) 29 | echo "$0: invalid option -- $OPTARG" 1>&2 30 | return 1 31 | ;; 32 | esac 33 | done 34 | shift $((OPTIND - 1)) 35 | 36 | local selected_items 37 | selected_items="$(cat)" 38 | if [[ -z "$selected_items" ]]; then 39 | return 1 40 | fi 41 | 42 | if [[ "$quote_item" == "1" ]]; then 43 | # (q) : Quote characters that are special to the shell in the resulting words with backslashes 44 | _anyframe-action-put "${(q)@}" "${(fq)selected_items}" 45 | else 46 | _anyframe-action-put "$@" "${(f)selected_items}" 47 | fi 48 | 49 | # Local Variables: 50 | # mode: Shell-Script 51 | # End: 52 | # vim: ft=zsh 53 | -------------------------------------------------------------------------------- /anyframe-functions/selectors/anyframe-selector-auto: -------------------------------------------------------------------------------- 1 | # Usage : anyframe-selector-auto [query] [options]... 2 | # Launch peco, percol, or fzf 3 | # 4 | # query : pre-input query 5 | # options : specify additional options for peco, percol, or fzf 6 | # 7 | # Example : anyframe-selector-auto "$LBUFFER" --initial-index 1 8 | 9 | # specify peco or percol 10 | local selector_mode='' 11 | zstyle -s ":anyframe:selector:" use selector_mode || selector_mode='' 12 | 13 | if [[ $selector_mode != 'peco' ]] && 14 | [[ $selector_mode != 'percol' ]] && 15 | [[ $selector_mode != 'fzf-tmux' ]] && 16 | [[ $selector_mode != 'fzf' ]]; then 17 | # selector isn't specified 18 | if which peco > /dev/null 2>&1; then 19 | selector_mode='peco' 20 | elif which percol > /dev/null 2>&1; then 21 | selector_mode='percol' 22 | elif which fzf-tmux > /dev/null 2>&1; then 23 | selector_mode='fzf-tmux' 24 | elif which fzf > /dev/null 2>&1; then 25 | selector_mode='fzf' 26 | else 27 | echo "anyframe: not found any of peco, percol, or fzf" 1>&2 28 | return 1 29 | fi 30 | fi 31 | 32 | if [[ "$selector_mode" == 'peco' ]]; then 33 | anyframe-selector-peco "$@" 34 | elif [[ "$selector_mode" == 'percol' ]]; then 35 | anyframe-selector-percol "$@" 36 | elif [[ "$selector_mode" == 'fzf-tmux' ]]; then 37 | anyframe-selector-fzf-tmux "$@" 38 | elif [[ "$selector_mode" == 'fzf' ]]; then 39 | anyframe-selector-fzf "$@" 40 | fi 41 | 42 | # Local Variables: 43 | # mode: Shell-Script 44 | # End: 45 | # vim: ft=zsh 46 | -------------------------------------------------------------------------------- /anyframe-functions/selectors/anyframe-selector-fzf: -------------------------------------------------------------------------------- 1 | local fzf_path 2 | zstyle -s ":anyframe:selector:fzf:" command fzf_path || fzf_path='fzf' 3 | 4 | if [[ $# -gt 0 ]]; then 5 | ${=fzf_path} --query "$@" 6 | else 7 | ${=fzf_path} 8 | fi 9 | 10 | # Local Variables: 11 | # mode: Shell-Script 12 | # End: 13 | # vim: ft=zsh 14 | -------------------------------------------------------------------------------- /anyframe-functions/selectors/anyframe-selector-fzf-tmux: -------------------------------------------------------------------------------- 1 | local fzf_tmux_path 2 | zstyle -s ":anyframe:selector:fzf-tmux:" command fzf_tmux_path || fzf_tmux_path='fzf-tmux' 3 | 4 | if [[ $# -gt 0 ]]; then 5 | ${=fzf_tmux_path} --query "$@" 6 | else 7 | ${=fzf_tmux_path} 8 | fi 9 | 10 | # Local Variables: 11 | # mode: Shell-Script 12 | # End: 13 | # vim: ft=zsh 14 | -------------------------------------------------------------------------------- /anyframe-functions/selectors/anyframe-selector-peco: -------------------------------------------------------------------------------- 1 | local peco_path 2 | zstyle -s ":anyframe:selector:peco:" command peco_path || peco_path='peco' 3 | 4 | if [[ $# -gt 0 ]]; then 5 | ${=peco_path} --query "$@" 6 | else 7 | ${=peco_path} 8 | fi 9 | 10 | # Local Variables: 11 | # mode: Shell-Script 12 | # End: 13 | # vim: ft=zsh 14 | -------------------------------------------------------------------------------- /anyframe-functions/selectors/anyframe-selector-percol: -------------------------------------------------------------------------------- 1 | local peco_path percol_path 2 | zstyle -s ":anyframe:selector:percol:" command percol_path || percol_path='percol' 3 | 4 | if [[ $# -gt 0 ]]; then 5 | ${=percol_path} --query "$@" 6 | else 7 | ${=percol_path} 8 | fi 9 | 10 | # Local Variables: 11 | # mode: Shell-Script 12 | # End: 13 | # vim: ft=zsh 14 | -------------------------------------------------------------------------------- /anyframe-functions/sources/anyframe-source-all-widgets: -------------------------------------------------------------------------------- 1 | { 2 | local dir 3 | for dir in ${^fpath}/anyframe-functions/widgets(N-/); do 4 | ls -1 $dir 5 | done 6 | } | sort | uniq 7 | 8 | # Local Variables: 9 | # mode: Shell-Script 10 | # End: 11 | # vim: ft=zsh 12 | -------------------------------------------------------------------------------- /anyframe-functions/sources/anyframe-source-cdr: -------------------------------------------------------------------------------- 1 | # require cdr 2 | # for more information, see REMEMBERING RECENT DIRECTORIES section in man zshcontrib(1) 3 | 4 | cdr -l | sed 's/^[^ ][^ ]* *//' 5 | 6 | # Local Variables: 7 | # mode: Shell-Script 8 | # End: 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /anyframe-functions/sources/anyframe-source-ghq-repository: -------------------------------------------------------------------------------- 1 | # require ghq (https://github.com/motemen/ghq) 2 | 3 | ghq list --full-path 4 | 5 | # Local Variables: 6 | # mode: Shell-Script 7 | # End: 8 | # vim: ft=zsh 9 | -------------------------------------------------------------------------------- /anyframe-functions/sources/anyframe-source-git-branch: -------------------------------------------------------------------------------- 1 | # anyframe-source-git-branch [-i|-n] 2 | # Options 3 | # -i include current branch name in output [Default] 4 | # -n not include current branch name in output 5 | # -a include both remote-tracking branches and local branches 6 | # -r only remote-tracking branches 7 | 8 | local include_current_branch="1" 9 | local option OPTARG OPTIND 10 | local git_option 11 | git_option=("--list" "-v") 12 | while getopts ':inar' option; do 13 | case $option in 14 | i) 15 | include_current_branch="1" 16 | ;; 17 | n) 18 | include_current_branch="0" 19 | ;; 20 | a) 21 | git_option+=("-a") 22 | ;; 23 | r) 24 | git_option+=("-r") 25 | ;; 26 | *) 27 | echo "$0: invalid option -- $OPTARG" 1>&2 28 | return 1 29 | ;; 30 | esac 31 | done 32 | shift $(expr $OPTIND - 1) 33 | 34 | git branch $git_option \ 35 | | { 36 | if [[ "$include_current_branch" == "1" ]]; then 37 | sed 's/^\*//' 38 | else 39 | # remove current branch name 40 | grep -v '^\*' 41 | fi 42 | } \ 43 | | sed 's/^ *//' 44 | 45 | # Local Variables: 46 | # mode: Shell-Script 47 | # End: 48 | # vim: ft=zsh 49 | -------------------------------------------------------------------------------- /anyframe-functions/sources/anyframe-source-git-status: -------------------------------------------------------------------------------- 1 | # anyframe-source-git-status 2 | # Args: 3 | # Regulaer expressions for grep 4 | 5 | # replace / with \/ 6 | local base_path="$(git rev-parse --show-cdup | sed 's%/%\\/%g')" 7 | 8 | git status --porcelain | 9 | sed "s/^\(..\) /\1\t${base_path}/" | # convert file path to relative path 10 | grep "^$1" 11 | 12 | # Local Variables: 13 | # mode: Shell-Script 14 | # End: 15 | # vim: ft=zsh 16 | -------------------------------------------------------------------------------- /anyframe-functions/sources/anyframe-source-history: -------------------------------------------------------------------------------- 1 | # -r : reverses the order of the commands 2 | # -n : suppresses command numbers 3 | # '!a[$0]++' : prints unique lines 4 | history -n -r 1 | awk '!a[$0]++' 5 | 6 | # Local Variables: 7 | # mode: Shell-Script 8 | # End: 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /anyframe-functions/sources/anyframe-source-list-file: -------------------------------------------------------------------------------- 1 | # anyframe-source-list-file 2 | # or 3 | # anyframe-source-list-file "$BUFFER" 4 | 5 | local buffer="$1" 6 | local dir="$PWD" 7 | 8 | if [[ -n "$buffer" ]]; then 9 | if [[ "$buffer" == *\ ]]; then 10 | # buffer ends with space 11 | : 12 | else 13 | local trim_buffer="$(echo $buffer | sed 's/^ *//' | sed 's/ *$//')" 14 | local last_argument="${trim_buffer##* }" 15 | 16 | # get dirname 17 | dir="${last_argument%/*}" 18 | fi 19 | fi 20 | 21 | ls -- "$dir" 22 | 23 | # Local Variables: 24 | # mode: Shell-Script 25 | # End: 26 | # vim: ft=zsh 27 | -------------------------------------------------------------------------------- /anyframe-functions/sources/anyframe-source-process: -------------------------------------------------------------------------------- 1 | ps -u $USER -o pid,stat,%cpu,%mem,cputime,command 2 | 3 | # Local Variables: 4 | # mode: Shell-Script 5 | # End: 6 | # vim: ft=zsh 7 | -------------------------------------------------------------------------------- /anyframe-functions/sources/anyframe-source-tmux-sessions: -------------------------------------------------------------------------------- 1 | # anyframe-source-tmux-sessions 2 | 3 | tmux list-sessions 4 | 5 | # Local Variables: 6 | # mode: Shell-Script 7 | # End: 8 | # vim: ft=zsh 9 | -------------------------------------------------------------------------------- /anyframe-functions/widgets/anyframe-widget-cd-ghq-repository: -------------------------------------------------------------------------------- 1 | anyframe-source-ghq-repository \ 2 | | anyframe-selector-auto \ 3 | | anyframe-action-execute cd -- 4 | 5 | # Local Variables: 6 | # mode: Shell-Script 7 | # End: 8 | # vim: ft=zsh 9 | -------------------------------------------------------------------------------- /anyframe-functions/widgets/anyframe-widget-cdr: -------------------------------------------------------------------------------- 1 | anyframe-source-cdr \ 2 | | anyframe-selector-auto \ 3 | | anyframe-action-execute cd -- 4 | 5 | # Local Variables: 6 | # mode: Shell-Script 7 | # End: 8 | # vim: ft=zsh 9 | -------------------------------------------------------------------------------- /anyframe-functions/widgets/anyframe-widget-checkout-git-branch: -------------------------------------------------------------------------------- 1 | anyframe-source-git-branch -n \ 2 | | anyframe-selector-auto \ 3 | | awk '{print $1}' \ 4 | | anyframe-action-execute git checkout 5 | 6 | # Local Variables: 7 | # mode: Shell-Script 8 | # End: 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /anyframe-functions/widgets/anyframe-widget-execute-history: -------------------------------------------------------------------------------- 1 | anyframe-source-history \ 2 | | anyframe-selector-auto "$LBUFFER" \ 3 | | anyframe-action-execute 4 | 5 | # Local Variables: 6 | # mode: Shell-Script 7 | # End: 8 | # vim: ft=zsh 9 | -------------------------------------------------------------------------------- /anyframe-functions/widgets/anyframe-widget-git-add: -------------------------------------------------------------------------------- 1 | anyframe-source-git-status ".[MD?]" \ 2 | | anyframe-selector-auto \ 3 | | awk '{print $2}' \ 4 | | anyframe-action-execute git add -- 5 | 6 | # Local Variables: 7 | # mode: Shell-Script 8 | # End: 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /anyframe-functions/widgets/anyframe-widget-insert-filename: -------------------------------------------------------------------------------- 1 | anyframe-source-list-file "$BUFFER" \ 2 | | anyframe-selector-auto \ 3 | | anyframe-action-insert -q 4 | 5 | # Local Variables: 6 | # mode: Shell-Script 7 | # End: 8 | # vim: ft=zsh 9 | -------------------------------------------------------------------------------- /anyframe-functions/widgets/anyframe-widget-insert-git-branch: -------------------------------------------------------------------------------- 1 | anyframe-source-git-branch -i \ 2 | | anyframe-selector-auto \ 3 | | awk '{print $1}' \ 4 | | anyframe-action-insert 5 | 6 | # Local Variables: 7 | # mode: Shell-Script 8 | # End: 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /anyframe-functions/widgets/anyframe-widget-kill: -------------------------------------------------------------------------------- 1 | anyframe-source-process \ 2 | | anyframe-selector-auto \ 3 | | awk '{print $1}' \ 4 | | anyframe-action-execute kill 5 | 6 | # Local Variables: 7 | # mode: Shell-Script 8 | # End: 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /anyframe-functions/widgets/anyframe-widget-put-history: -------------------------------------------------------------------------------- 1 | anyframe-source-history \ 2 | | anyframe-selector-auto "$LBUFFER" \ 3 | | anyframe-action-put 4 | 5 | # Local Variables: 6 | # mode: Shell-Script 7 | # End: 8 | # vim: ft=zsh 9 | -------------------------------------------------------------------------------- /anyframe-functions/widgets/anyframe-widget-select-widget: -------------------------------------------------------------------------------- 1 | anyframe-source-all-widgets \ 2 | | grep -v '^anyframe-widget-select-widget$' \ 3 | | sed 's/^anyframe-widget-//' \ 4 | | anyframe-selector-auto \ 5 | | sed 's/^/anyframe-widget-/' \ 6 | | anyframe-action-execute 7 | 8 | # Local Variables: 9 | # mode: Shell-Script 10 | # End: 11 | # vim: ft=zsh 12 | -------------------------------------------------------------------------------- /anyframe-functions/widgets/anyframe-widget-tmux-attach: -------------------------------------------------------------------------------- 1 | anyframe-source-tmux-sessions \ 2 | | anyframe-selector-auto \ 3 | | cut -d ':' -f 1 \ 4 | | anyframe-action-execute -d tmux attach -t 5 | 6 | # Local Variables: 7 | # mode: Shell-Script 8 | # End: 9 | # vim: ft=zsh 10 | -------------------------------------------------------------------------------- /anyframe-init: -------------------------------------------------------------------------------- 1 | # put this file somewhere in your $fpath 2 | # and call below lines 3 | # % autoload -Uz anyframe-init 4 | # % anyframe-init 5 | 6 | local dir file 7 | for dir in ${^fpath}/anyframe-functions/{actions,selectors,sources}(N-/); do 8 | fpath=($fpath $dir) 9 | 10 | for file in $dir/*(N-.); do 11 | local function_name="${file:t}" 12 | autoload -Uz -- "$function_name" 13 | done 14 | done 15 | 16 | for dir in ${^fpath}/anyframe-functions/widgets(N-/); do 17 | fpath=($fpath $dir) 18 | 19 | for file in $dir/*(N-.); do 20 | local function_name="${file:t}" 21 | autoload -Uz -- "$function_name" 22 | zle -N -- "$function_name" 23 | done 24 | done 25 | 26 | # Local Variables: 27 | # mode: Shell-Script 28 | # End: 29 | # vim: ft=zsh 30 | -------------------------------------------------------------------------------- /anyframe.plugin.zsh: -------------------------------------------------------------------------------- 1 | # init script for antigen 2 | fpath=("${0:h}" $fpath) 3 | autoload -Uz anyframe-init 4 | anyframe-init 5 | 6 | # Local Variables: 7 | # mode: Shell-Script 8 | # End: 9 | # vim: ft=zsh 10 | --------------------------------------------------------------------------------