diff options
-rw-r--r-- | README.markdown | 2 | ||||
-rw-r--r-- | lib/directories.zsh | 1 | ||||
-rw-r--r-- | lib/functions.zsh | 10 | ||||
-rw-r--r-- | lib/spectrum.zsh | 6 | ||||
-rw-r--r-- | lib/termsupport.zsh | 43 | ||||
-rw-r--r-- | plugins/common-aliases/common-aliases.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/extract/extract.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/history-substring-search/history-substring-search.plugin.zsh | 9 | ||||
-rwxr-xr-x | plugins/history-substring-search/update-from-upstream.zsh | 6 | ||||
-rw-r--r-- | plugins/mercurial/mercurial.plugin.zsh | 3 | ||||
-rw-r--r-- | plugins/tmux-cssh/_tmux-cssh | 25 | ||||
-rw-r--r-- | plugins/web-search/web-search.plugin.zsh | 2 |
12 files changed, 78 insertions, 33 deletions
diff --git a/README.markdown b/README.markdown index 6007d6500..9d7210f77 100644 --- a/README.markdown +++ b/README.markdown @@ -104,7 +104,7 @@ The default location is `~/.oh-my-zsh` (hidden in your home directory) If you'd like to change the install directory with the `ZSH` environment variable, either by running `export ZSH=/your/path` before installing, or by setting it before the end of the install pipeline like this: ```shell -export ZSH="~/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" ``` #### Manual Installation diff --git a/lib/directories.zsh b/lib/directories.zsh index 3bffa9fd9..a50a692c8 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -8,6 +8,7 @@ alias -g ....='../../..' alias -g .....='../../../..' alias -g ......='../../../../..' +alias -- -='cd -' alias 1='cd -' alias 2='cd -2' alias 3='cd -3' diff --git a/lib/functions.zsh b/lib/functions.zsh index ec6f37214..f9d4a9717 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -16,13 +16,17 @@ function take() { } function open_command() { + emulate -L zsh + setopt shwordsplit + local open_cmd # define the open command case "$OSTYPE" in - darwin*) open_cmd="open" ;; - cygwin*) open_cmd="cygstart" ;; - linux*) open_cmd="xdg-open" ;; + darwin*) open_cmd='open' ;; + cygwin*) open_cmd='cygstart' ;; + linux*) open_cmd='xdg-open' ;; + msys*) open_cmd='start ""' ;; *) echo "Platform $OSTYPE not supported" return 1 ;; diff --git a/lib/spectrum.zsh b/lib/spectrum.zsh index b683aca29..87092d8ae 100644 --- a/lib/spectrum.zsh +++ b/lib/spectrum.zsh @@ -3,7 +3,7 @@ # P.C. Shyamshankar <sykora@lucentbeing.com> # Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/ -typeset -Ag FX FG BG +typeset -AHg FX FG BG FX=( reset "%{[00m%}" @@ -25,13 +25,13 @@ ZSH_SPECTRUM_TEXT=${ZSH_SPECTRUM_TEXT:-Arma virumque cano Troiae qui primus ab o # Show all 256 colors with color number function spectrum_ls() { for code in {000..255}; do - print -P -- "$code: %F{$code}$ZSH_SPECTRUM_TEXT%f" + print -P -- "$code: %{$FG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}" done } # Show all 256 colors where the background is set to specific color function spectrum_bls() { for code in {000..255}; do - print -P -- "$BG[$code]$code: $ZSH_SPECTRUM_TEXT %{$reset_color%}" + print -P -- "$code: %{$BG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}" done } diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 4c5068e9b..7cf15b0a0 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -9,32 +9,42 @@ function title { emulate -L zsh setopt prompt_subst - + [[ "$EMACS" == *term* ]] && return # if $2 is unset use $1 as default # if it is set and empty, leave it as is : ${2=$1} - if [[ "$TERM" == screen* ]]; then - print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars - elif [[ "$TERM" == xterm* ]] || [[ "$TERM" == rxvt* ]] || [[ "$TERM" == ansi ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then - print -Pn "\e]2;$2:q\a" #set window name - print -Pn "\e]1;$1:q\a" #set icon (=tab) name - fi + case "$TERM" in + cygwin|xterm*|putty*|rxvt*|ansi) + print -Pn "\e]2;$2:q\a" # set window name + print -Pn "\e]1;$1:q\a" # set tab name + ;; + screen*) + print -Pn "\ek$1:q\e\\" # set screen hardstatus + ;; + *) + if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + print -Pn "\e]2;$2:q\a" # set window name + print -Pn "\e]1;$1:q\a" # set tab name + fi + ;; + esac } ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" # Avoid duplication of directory in terminals with independent dir display -if [[ $TERM_PROGRAM == Apple_Terminal ]]; then +if [[ "$TERM_PROGRAM" == Apple_Terminal ]]; then ZSH_THEME_TERM_TITLE_IDLE="%n@%m" fi # Runs before showing the prompt function omz_termsupport_precmd { emulate -L zsh - if [[ $DISABLE_AUTO_TITLE == true ]]; then + + if [[ "$DISABLE_AUTO_TITLE" == true ]]; then return fi @@ -44,12 +54,12 @@ function omz_termsupport_precmd { # Runs before executing the command function omz_termsupport_preexec { emulate -L zsh - if [[ $DISABLE_AUTO_TITLE == true ]]; then + setopt extended_glob + + if [[ "$DISABLE_AUTO_TITLE" == true ]]; then return fi - setopt extended_glob - # cmd name only, or if this is sudo or ssh, the next cmd local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%} local LINE="${2:gs/%/%%}" @@ -66,19 +76,18 @@ preexec_functions+=(omz_termsupport_preexec) # With extra fixes to handle multibyte chars and non-UTF-8 locales if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then - # Emits the control sequence to notify Terminal.app of the cwd + # Identifies the directory using a file: URI scheme, including + # the host name to disambiguate local vs. remote paths. function update_terminalapp_cwd() { emulate -L zsh - # Identify the directory using a "file:" scheme URL, including - # the host name to disambiguate local vs. remote paths. # Percent-encode the pathname. local URL_PATH="$(omz_urlencode -P $PWD)" [[ $? != 0 ]] && return 1 - local PWD_URL="file://$HOST$URL_PATH" + # Undocumented Terminal.app-specific control sequence - printf '\e]7;%s\a' $PWD_URL + printf '\e]7;%s\a' "file://$HOST$URL_PATH" } # Use a precmd hook instead of a chpwd hook to avoid contaminating output diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index fc19d73c3..c7aafd8b8 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -52,7 +52,7 @@ alias mv='mv -i' # zsh is able to auto-do some kungfoo # depends on the SUFFIX :) -if [ ${ZSH_VERSION//\./} -ge 420 ]; then +if is-at-least 4.2.0; then # open browser on urls _browser_fts=(htm html de org net com at cx nl se dk dk php) for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 690126ba6..5d0809e9a 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -52,7 +52,7 @@ function extract() { (*.xz) unxz "$1" ;; (*.lzma) unlzma "$1" ;; (*.Z) uncompress "$1" ;; - (*.zip|*.war|*.jar|*.sublime-package|*.ipsw) unzip "$1" -d $extract_dir ;; + (*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk) unzip "$1" -d $extract_dir ;; (*.rar) unrar x -ad "$1" ;; (*.7z) 7za x "$1" ;; (*.deb) diff --git a/plugins/history-substring-search/history-substring-search.plugin.zsh b/plugins/history-substring-search/history-substring-search.plugin.zsh index 25fd3a2da..7883a65f3 100644 --- a/plugins/history-substring-search/history-substring-search.plugin.zsh +++ b/plugins/history-substring-search/history-substring-search.plugin.zsh @@ -13,11 +13,14 @@ fi # Bind terminal-specific up and down keys - +# Bind in both emacs and vi modes so it works in both, and is not +# sensitive to whether this is loaded before or after the vi-mode plugin if [[ -n "$terminfo[kcuu1]" ]]; then - bindkey "$terminfo[kcuu1]" history-substring-search-up + bindkey -M emacs "$terminfo[kcuu1]" history-substring-search-up + bindkey -M viins "$terminfo[kcuu1]" history-substring-search-up fi if [[ -n "$terminfo[kcud1]" ]]; then - bindkey "$terminfo[kcud1]" history-substring-search-down + bindkey -M emacs "$terminfo[kcud1]" history-substring-search-down + bindkey -M viins "$terminfo[kcud1]" history-substring-search-down fi diff --git a/plugins/history-substring-search/update-from-upstream.zsh b/plugins/history-substring-search/update-from-upstream.zsh index 6e6cca5d5..81e1942a5 100755 --- a/plugins/history-substring-search/update-from-upstream.zsh +++ b/plugins/history-substring-search/update-from-upstream.zsh @@ -76,10 +76,12 @@ cat >> $plugin_basename.plugin.zsh <<EOF # Bind terminal-specific up and down keys if [[ -n "\$terminfo[kcuu1]" ]]; then - bindkey "\$terminfo[kcuu1]" history-substring-search-up + bindkey -M emacs "\$terminfo[kcuu1]" history-substring-search-up + bindkey -M viins "\$terminfo[kcuu1]" history-substring-search-up fi if [[ -n "\$terminfo[kcud1]" ]]; then - bindkey "\$terminfo[kcud1]" history-substring-search-down + bindkey -M emacs "\$terminfo[kcud1]" history-substring-search-down + bindkey -M viins "\$terminfo[kcud1]" history-substring-search-down fi EOF diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index 86200ccf6..3ae59496e 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -14,8 +14,7 @@ alias hgo='hg outgoing' alias hgp='hg push' alias hgs='hg status' alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n" ' -# this is the 'git commit --amend' equivalent -alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip' +alias hgca='hg commit --amend' # list unresolved files (since hg does not list unmerged files in the status command) alias hgun='hg resolve --list' diff --git a/plugins/tmux-cssh/_tmux-cssh b/plugins/tmux-cssh/_tmux-cssh new file mode 100644 index 000000000..604e2e478 --- /dev/null +++ b/plugins/tmux-cssh/_tmux-cssh @@ -0,0 +1,25 @@ +#compdef tmux-cssh + +# tmux-cssh autocompletion for oh-my-zsh +# Requires: tmux-cssh installed +# Author: Manfred Touron (@moul) + +_arguments \ +'(-h --help)'{-h,--help}'[This help.]' \ +'(-u --user)'{-u,--user}'[User to use.]' \ +'(-c --certificate)'{-c,--certificate}'[Path to ssh-certificate to use.]' \ +'(-sc --ssh)'{-sc,--ssh}'[SSH-connection-string, multiple.]' \ +'(-sa --ssh)'{-sa,--ssh}'[SSH connection arguments, used on every session.]' \ +'(-ts --tmux)'{-ts,--tmux}'[Alternative tmux-session-name, default: tmux-cssh]' \ +'(-ns --new)'{-ns,--new}'[Initializes a new session, like -ts \[name\].]' \ +'(-q --quiet)'{-q,--quiet}'[Quiet-mode.]' \ +'(-f --filename)'{-f,--filename}'[Filename of textfile to get -sc connection-strings from, line separated.]' \ +'(-cs --config)'{-cs,--config}'[Name of config-settings which should be get from config-file "$HOME/.tmux-cssh". Which can be a grep-regular expression to find the name(s).]' \ + ':hosts:_hosts' \ + '*:: :->subcmds' \ + && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "tmux-cssh command" + return +fi diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh index 369a0e680..d3bf97d75 100644 --- a/plugins/web-search/web-search.plugin.zsh +++ b/plugins/web-search/web-search.plugin.zsh @@ -13,6 +13,7 @@ function web_search() { yandex "https://yandex.ru/yandsearch?text=" github "https://github.com/search?q=" baidu "https://www.baidu.com/s?wd=" + ecosia "https://www.ecosia.org/search?q=" ) # check whether the search engine is supported @@ -43,6 +44,7 @@ alias ddg='web_search duckduckgo' alias yandex='web_search yandex' alias github='web_search github' alias baidu='web_search baidu' +alias ecosia='web_search ecosia' #add your own !bang searches here alias wiki='web_search duckduckgo \!w' |