This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!zsh | |
| # エディタのファイルの履歴を補完候補にするようなスクリプトです | |
| _rf () { | |
| local ref=$1 | |
| shift | |
| local -a xs | |
| xs=("$@") | |
| local -a ret | |
| ret=() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #autoload | |
| local -a flags | |
| flags=( | |
| '):end of flags' | |
| '#:as numeric' | |
| '%:expand %s in result as in prompts' | |
| '@:array expand even in double quotes' | |
| 'A:create an array parameter with ${...=...}, (AA) associative array' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!zsh | |
| # _git vcs_info | |
| # __git_branch_switches | |
| autoload -Uz vcs_info | |
| zstyle ':vcs_info:*' enable git | |
| #zstyle ':vcs_info:*' formats '%B%F{black}(%f%b%F{black})%f%%b' # `%f` eats "1" | |
| zstyle ':vcs_info:*' formats '%B%F{black}(%F{white}%b%F{black})%f%%b' | |
| zstyle ':vcs_info:*' actionformats '%B%F{black}(%F{white}%b%F{black}|%F{white}%a%F{black})%f%%b' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin/gosh | |
| ;;; stuff such that .zhistory → “"cdr" function for recent directories etc.” | |
| ;;; - http://thread.gmane.org/gmane.comp.shells.zsh.devel/20592 | |
| #| | |
| % { | |
| local -a match mbegin mend | |
| print -l ${${(@f)"$(\ | |
| gosh /tmp/cdr.scm -f $HISTFILE -t $((12 * 60 * 60)) -l 99999 \ | |
| )"}/(#b)(*)/\$"'"${match}"'"} | |
| } > ~/..chpwd-recent-dirs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!zsh | |
| # textobj-between code. | |
| # Thank you very much, thinca and tarao! | |
| # | |
| # http://d.hatena.ne.jp/thinca/20100614/1276448745 | |
| # http://d.hatena.ne.jp/tarao/20100715/1279185753 | |
| def-oppc-textobj-between () { | |
| def-oppc-inbetween-2 "$1" "opp+i$1" "opp+a$1" oppc-tb-main | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // Regular Expression for URL validation | |
| // | |
| // Author: Diego Perini | |
| // Created: 2010/12/05 | |
| // Updated: 2018/09/12 | |
| // License: MIT | |
| // | |
| // Copyright (c) 2010-2018 Diego Perini (http://www.iport.it) | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function! s:ExecuteInShell(command) | |
| let command = join(map(split(a:command), 'expand(v:val)')) | |
| let winnr = bufwinnr('^' . command . '$') | |
| silent! execute winnr < 0 ? 'botright new ' . fnameescape(command) : winnr . 'wincmd w' | |
| setlocal buftype=nowrite bufhidden=wipe nobuflisted noswapfile nowrap number | |
| echo 'Execute ' . command . '...' | |
| silent! execute 'silent %!'. command | |
| silent! execute 'resize ' . line('$') | |
| silent! redraw | |
| silent! execute 'au BufUnload <buffer> execute bufwinnr(' . bufnr('#') . ') . ''wincmd w''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # zaw.zsh source for the elements of the directory stack. | |
| # https://github.com/nakamuray/zaw | |
| # Thank you very much, nakamuray! | |
| zmodload zsh/parameter | |
| function zaw-src-dirstack() { | |
| : ${(A)candidates::=$dirstack} | |
| actions=("zaw-callback-execute" "zaw-callback-replace-buffer" "zaw-callback-append-to-buffer") | |
| act_descriptions=("execute" "replace edit buffer" "append to edit buffer") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # zaw.zsh source for 'git show-branch'. | |
| # Thank you very much, nakamuray! | |
| # https://github.com/nakamuray/zaw | |
| zaw-src-git-showbranch () { | |
| git rev-parse -q --is-inside-work-tree >/dev/null || return 1 | |
| #local b="${orig_lbuffer}${orig_rbuffer}" | |
| local b="$BUFFER" | |
| local z="$(git rev-parse --git-dir)""/zaw-src-git-showbranch" |