From 9b811fb625c03c30a766191cdf65a1c7c1fd96b2 Mon Sep 17 00:00:00 2001 From: Michael Orr Date: Fri, 6 Dec 2013 17:31:35 -0500 Subject: accidentally blew away a git config setting used for another purpose, renaming in order to distinguish --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/git.zsh b/lib/git.zsh index 305a77aff..a1396653b 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -13,7 +13,7 @@ parse_git_dirty() { local SUBMODULE_SYNTAX='' local GIT_STATUS='' local CLEAN_MESSAGE='nothing to commit (working directory clean)' - if [[ "$(command git config --get oh-my-zsh.hide-status)" != "1" ]]; then + if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then if [[ $POST_1_7_2_GIT -gt 0 ]]; then SUBMODULE_SYNTAX="--ignore-submodules=dirty" fi -- cgit v1.2.3-70-g09d2 From cd8d5c4410f96ee16a6349a0cf7bcac882e37604 Mon Sep 17 00:00:00 2001 From: Simon Courtois Date: Wed, 9 Apr 2014 18:13:19 +0200 Subject: Defining nocorrect aliases only when ENABLE_CORRECTION is "true" This commit move the nocorrect aliases definition so they're called only when the user set ENABLE_CORRECTION to "true" to activate commands autocorrection. --- lib/correction.zsh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/correction.zsh b/lib/correction.zsh index 47eb83b1d..35771474f 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -1,13 +1,13 @@ -alias man='nocorrect man' -alias mv='nocorrect mv' -alias mysql='nocorrect mysql' -alias mkdir='nocorrect mkdir' -alias gist='nocorrect gist' -alias heroku='nocorrect heroku' -alias ebuild='nocorrect ebuild' -alias hpodder='nocorrect hpodder' -alias sudo='nocorrect sudo' - if [[ "$ENABLE_CORRECTION" == "true" ]]; then + alias man='nocorrect man' + alias mv='nocorrect mv' + alias mysql='nocorrect mysql' + alias mkdir='nocorrect mkdir' + alias gist='nocorrect gist' + alias heroku='nocorrect heroku' + alias ebuild='nocorrect ebuild' + alias hpodder='nocorrect hpodder' + alias sudo='nocorrect sudo' + setopt correct_all fi -- cgit v1.2.3-70-g09d2 From b64e695b35db8bf0ff01433669a3adc4ee04341c Mon Sep 17 00:00:00 2001 From: Simon Courtois Date: Wed, 9 Apr 2014 18:16:57 +0200 Subject: Ordering nocorrect aliases alphabetically --- lib/correction.zsh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/correction.zsh b/lib/correction.zsh index 35771474f..3e1415a0b 100644 --- a/lib/correction.zsh +++ b/lib/correction.zsh @@ -1,12 +1,12 @@ if [[ "$ENABLE_CORRECTION" == "true" ]]; then - alias man='nocorrect man' - alias mv='nocorrect mv' - alias mysql='nocorrect mysql' - alias mkdir='nocorrect mkdir' + alias ebuild='nocorrect ebuild' alias gist='nocorrect gist' alias heroku='nocorrect heroku' - alias ebuild='nocorrect ebuild' alias hpodder='nocorrect hpodder' + alias man='nocorrect man' + alias mkdir='nocorrect mkdir' + alias mv='nocorrect mv' + alias mysql='nocorrect mysql' alias sudo='nocorrect sudo' setopt correct_all -- cgit v1.2.3-70-g09d2 From 3c485db8c73bfebf379f3e9382eb8f300b608bd8 Mon Sep 17 00:00:00 2001 From: r3dDoX Date: Sat, 24 May 2014 12:15:26 +0200 Subject: replaced hardcoded origin/{branch-name} with @{upstream} which gets the upstream branch since git 1.7.0 --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/git.zsh b/lib/git.zsh index 305a77aff..3eca8a6c6 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -54,7 +54,7 @@ git_remote_status() { # Checks if there are commits ahead from remote function git_prompt_ahead() { - if $(echo "$(command git log origin/$(current_branch)..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then echo "$ZSH_THEME_GIT_PROMPT_AHEAD" fi } -- cgit v1.2.3-70-g09d2 From 59c8fcc712556a4c0b612898073e212877c21d60 Mon Sep 17 00:00:00 2001 From: r3dDoX Date: Sat, 24 May 2014 12:19:46 +0200 Subject: added new function to get number of commits ahead of remote --- lib/git.zsh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib') diff --git a/lib/git.zsh b/lib/git.zsh index 3eca8a6c6..d6cee37c3 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -59,6 +59,13 @@ function git_prompt_ahead() { fi } +# Gets the number of commits ahead from remote +function git_commits_ahead() { + if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then + echo "$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ')" + fi +} + # Formats prompt string for current git commit short SHA function git_prompt_short_sha() { SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" -- cgit v1.2.3-70-g09d2 From 514693125b12d4b4cd099dcb09174f7bfd9a5b0e Mon Sep 17 00:00:00 2001 From: r3dDoX Date: Mon, 26 May 2014 10:47:51 +0200 Subject: added prefix/suffix variable for customizability --- lib/git.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/git.zsh b/lib/git.zsh index d6cee37c3..a52f82de0 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -62,7 +62,8 @@ function git_prompt_ahead() { # Gets the number of commits ahead from remote function git_commits_ahead() { if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then - echo "$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ')" + COMMITS=$(command git log @{upstream}..HEAD | grep '^commit' | wc -l | tr -d ' ') + echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$COMMITS$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX" fi } -- cgit v1.2.3-70-g09d2 From 12324856c6645c2e71c4dfcf5ef12313c989b387 Mon Sep 17 00:00:00 2001 From: Andrea De Pasquale Date: Tue, 24 Sep 2013 11:11:35 +0200 Subject: Added ssh-like mosh window title Display the hostname when running Mosh (http://mosh.mit.edu/). Same thing as displaying "hostname" when running "ssh hostname". --- lib/termsupport.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 9c0a430fb..30410c1fd 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -28,7 +28,7 @@ function omz_termsupport_preexec { setopt extended_glob # cmd name only, or if this is sudo or ssh, the next cmd - local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]:gs/%/%%} + local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%} local LINE="${2:gs/%/%%}" title '$CMD' '%100>...>$LINE%<<' -- cgit v1.2.3-70-g09d2 From 7fbbf28e6e37e604c7821a24993d32a478d857f8 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Tue, 10 Jun 2014 09:50:53 +0200 Subject: return 0 when not a git repo before, 128 was returned, which could display an error, but out of a git repo this should exit silently fixes #2226 --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/git.zsh b/lib/git.zsh index 305a77aff..df7722721 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -2,7 +2,7 @@ function git_prompt_info() { if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ - ref=$(command git rev-parse --short HEAD 2> /dev/null) || return + ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" fi } -- cgit v1.2.3-70-g09d2 From 09fdf763114fc571debff96b48c85ecfaeb7a2e4 Mon Sep 17 00:00:00 2001 From: Will Boyce Date: Mon, 28 Apr 2014 23:12:49 +0100 Subject: ignore usernames beginning with underscore --- lib/completion.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/completion.zsh b/lib/completion.zsh index c54249c52..fa1d97f48 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -44,7 +44,7 @@ zstyle ':completion:*:*:*:users' ignored-patterns \ named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \ operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \ rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \ - usbmux uucp vcsa wwwrun xfs + usbmux uucp vcsa wwwrun xfs '_*' # ... unless we really want to. zstyle '*' single-ignored show -- cgit v1.2.3-70-g09d2 From 49161e78472b484015c2080f7a724e95d42b4987 Mon Sep 17 00:00:00 2001 From: "Mikhail S. Pobolovets" Date: Sun, 2 Feb 2014 13:24:35 +0300 Subject: Add missing `command` wrapper for git Signed-off-by: Mikhail S. Pobolovets --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/git.zsh b/lib/git.zsh index df7722721..883bba25c 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -1,6 +1,6 @@ # get the name of the branch we are on function git_prompt_info() { - if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then + if [[ "$(command git config --get oh-my-zsh.hide-status)" != "1" ]]; then ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" -- cgit v1.2.3-70-g09d2 From c5d9fc996819488801864407ad1b7624acf3c26c Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Tue, 24 Jun 2014 13:01:41 +0200 Subject: git_prompt_info: ignore git-config errors Merged from #2906 The function `git_prompt_info` calls `git config` for its stdout output, but doesn't handle the stderr output. This can lead to problems, e.g. if the git config file is unreadable for some reason (permissions etc). This fixes the issue by simply ignoring the stderr output. --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/git.zsh b/lib/git.zsh index 883bba25c..b0e73bf3a 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -1,6 +1,6 @@ # get the name of the branch we are on function git_prompt_info() { - if [[ "$(command git config --get oh-my-zsh.hide-status)" != "1" ]]; then + if [[ "$(command git config --get oh-my-zsh.hide-status 2>/dev/null)" != "1" ]]; then ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0 echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" -- cgit v1.2.3-70-g09d2 From 676fb4e4203eae0f3755a729a6582eb32fe9834f Mon Sep 17 00:00:00 2001 From: Simon Buchan Date: Thu, 3 Jul 2014 13:14:02 +1200 Subject: Fix parse_git_dirty() when status.branch is set. --- lib/git.zsh | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/git.zsh b/lib/git.zsh index b0e73bf3a..8742a857a 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -10,23 +10,20 @@ function git_prompt_info() { # Checks if working tree is dirty parse_git_dirty() { - local SUBMODULE_SYNTAX='' - local GIT_STATUS='' - local CLEAN_MESSAGE='nothing to commit (working directory clean)' + local STATUS='' + local FLAGS + FLAGS=('--porcelain') if [[ "$(command git config --get oh-my-zsh.hide-status)" != "1" ]]; then if [[ $POST_1_7_2_GIT -gt 0 ]]; then - SUBMODULE_SYNTAX="--ignore-submodules=dirty" + FLAGS+='--ignore-submodules=dirty' fi if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then - GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} -uno 2> /dev/null | tail -n1) - else - GIT_STATUS=$(command git status -s ${SUBMODULE_SYNTAX} 2> /dev/null | tail -n1) - fi - if [[ -n $GIT_STATUS ]]; then - echo "$ZSH_THEME_GIT_PROMPT_DIRTY" - else - echo "$ZSH_THEME_GIT_PROMPT_CLEAN" + FLAGS+='--untracked-files=no' fi + STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1) + fi + if [[ -n $STATUS ]]; then + echo "$ZSH_THEME_GIT_PROMPT_DIRTY" else echo "$ZSH_THEME_GIT_PROMPT_CLEAN" fi -- cgit v1.2.3-70-g09d2 From 2927ce37141d52a8b4e2ca1e60d0cf0688125781 Mon Sep 17 00:00:00 2001 From: Simon Buchan Date: Thu, 3 Jul 2014 14:45:49 +1200 Subject: Fix POST_1_7_2_GIT check for parse_git_dirty submodules. --- lib/git.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/git.zsh b/lib/git.zsh index 8742a857a..55ed94a3d 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -124,12 +124,16 @@ function git_compare_version() { INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]}); for i in {1..3}; do + if [[ $INSTALLED_GIT_VERSION[$i] -gt $INPUT_GIT_VERSION[$i] ]]; then + echo 1 + return 0 + fi if [[ $INSTALLED_GIT_VERSION[$i] -lt $INPUT_GIT_VERSION[$i] ]]; then echo -1 return 0 fi done - echo 1 + echo 0 } #this is unlikely to change so make it all statically assigned -- cgit v1.2.3-70-g09d2 From 5e328e3a9c0784521ae4170f7958183c352bae83 Mon Sep 17 00:00:00 2001 From: Moinak Ghosh Date: Fri, 11 Jul 2014 18:41:49 +0530 Subject: Solaris portability tweaks. --- lib/completion.zsh | 7 ++++++- oh-my-zsh.sh | 1 + plugins/colored-man/colored-man.plugin.zsh | 21 +++++++++++++++++++++ tools/check_for_upgrade.sh | 8 +++++++- 4 files changed, 35 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/completion.zsh b/lib/completion.zsh index fa1d97f48..faea36118 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -25,7 +25,12 @@ bindkey -M menuselect '^o' accept-and-infer-next-history zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' -zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" +if [ "$PLAT" = "SunOS" ] +then + zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm" +else + zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" +fi # disable named-directories autocompletion zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c217b91bb..4683c2bc0 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,3 +1,4 @@ +PLAT=`uname -s` # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then /usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh diff --git a/plugins/colored-man/colored-man.plugin.zsh b/plugins/colored-man/colored-man.plugin.zsh index 56056284a..4956f4346 100644 --- a/plugins/colored-man/colored-man.plugin.zsh +++ b/plugins/colored-man/colored-man.plugin.zsh @@ -1,3 +1,21 @@ +if [ "${PLAT}" = "SunOS" ] +then + if [ ! -x ${HOME}/bin/nroff ] + then + mkdir -p ${HOME}/bin + cat > ${HOME}/bin/nroff < Date: Wed, 20 Aug 2014 23:52:05 +0200 Subject: Replace /usr/bin/env with env Some environments (such as Android) does not have /usr/bin. --- lib/functions.zsh | 4 ++-- oh-my-zsh.sh | 2 +- tools/check_for_upgrade.sh | 2 +- tools/install.sh | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/functions.zsh b/lib/functions.zsh index fda84a953..17f5f9cbf 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -3,11 +3,11 @@ function zsh_stats() { } function uninstall_oh_my_zsh() { - /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh + env ZSH=$ZSH /bin/sh $ZSH/tools/uninstall.sh } function upgrade_oh_my_zsh() { - /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh + env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh } function take() { diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c217b91bb..a90b3e98a 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,6 +1,6 @@ # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then - /usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh + env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh fi # Initializes Oh My Zsh diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 8b8ecae03..35e074297 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -9,7 +9,7 @@ function _update_zsh_update() { } function _upgrade_zsh() { - /usr/bin/env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh + env ZSH=$ZSH /bin/sh $ZSH/tools/upgrade.sh # update the zsh file _update_zsh_update } diff --git a/tools/install.sh b/tools/install.sh index fc7ad70cf..7efab10b9 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -10,7 +10,7 @@ if [ -d "$ZSH" ]; then fi echo "\033[0;34mCloning Oh My Zsh...\033[0m" -hash git >/dev/null 2>&1 && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { +hash git >/dev/null 2>&1 && env git clone https://github.com/robbyrussell/oh-my-zsh.git $ZSH || { echo "git not installed" exit } @@ -43,5 +43,5 @@ echo "\033[0;32m"'\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/ '"\033[0m echo "\033[0;32m"' /____/ ....is now installed!'"\033[0m" echo "\n\n \033[0;32mPlease look over the ~/.zshrc file to select plugins, themes, and options.\033[0m" echo "\n\n \033[0;32mp.s. Follow us at http://twitter.com/ohmyzsh.\033[0m" -/usr/bin/env zsh +env zsh . ~/.zshrc -- cgit v1.2.3-70-g09d2 From dc9e1764cfd0987f104f57bac0b974e0941f1e42 Mon Sep 17 00:00:00 2001 From: Jingwen Owen Ou Date: Fri, 22 Aug 2014 15:59:17 -0700 Subject: Fix missing add-zsh-hook In older version of zsh, `add-zsh-hook` is not available, causing issues like: ``` /Users/hugo/.oh-my-zsh/lib/termsupport.zsh:32: add-zsh-hook: function definition file not found /Users/hugo/.oh-my-zsh/lib/termsupport.zsh:33: add-zsh-hook: function definition file not found ``` See https://github.com/robbyrussell/oh-my-zsh/issues/748. This patch pulls in the changes suggested in https://github.com/robbyrussell/oh-my-zsh/issues/748#issuecomment-37862691 by @mcornella and I have tested it on RHEL 5. --- lib/termsupport.zsh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 9c0a430fb..9d6681603 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -34,6 +34,5 @@ function omz_termsupport_preexec { title '$CMD' '%100>...>$LINE%<<' } -autoload -U add-zsh-hook -add-zsh-hook precmd omz_termsupport_precmd -add-zsh-hook preexec omz_termsupport_preexec +precmd_functions+=(omz_termsupport_precmd) +preexec_functions+=(omz_termsupport_preexec) -- cgit v1.2.3-70-g09d2 From ac053f4211ef2da6b66bd148a930cfdddd12991f Mon Sep 17 00:00:00 2001 From: sachin21 Date: Sun, 24 Aug 2014 00:50:02 +0900 Subject: This alias is conflict cause --- lib/aliases.zsh | 1 - 1 file changed, 1 deletion(-) (limited to 'lib') diff --git a/lib/aliases.zsh b/lib/aliases.zsh index 3044c9660..aae865046 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -30,7 +30,6 @@ alias lsa='ls -lah' alias l='ls -lah' alias ll='ls -lh' alias la='ls -lAh' -alias sl=ls # often screw this up alias afind='ack-grep -il' -- cgit v1.2.3-70-g09d2 From 5f38a537cef0d79c9d53c01e8f88d150e985c70a Mon Sep 17 00:00:00 2001 From: Moinak Ghosh Date: Tue, 16 Sep 2014 22:29:52 +0530 Subject: Update Solaris changes to use OSTYPE and zsh datetime module. --- lib/completion.zsh | 2 +- oh-my-zsh.sh | 1 - plugins/colored-man/colored-man.plugin.zsh | 2 +- tools/check_for_upgrade.sh | 12 ++++-------- 4 files changed, 6 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/completion.zsh b/lib/completion.zsh index faea36118..83b6efb66 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -25,7 +25,7 @@ bindkey -M menuselect '^o' accept-and-infer-next-history zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' -if [ "$PLAT" = "SunOS" ] +if [ "$OSTYPE[0,7]" = "solaris" ] then zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm" else diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index 4683c2bc0..c217b91bb 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -1,4 +1,3 @@ -PLAT=`uname -s` # Check for updates on initial load... if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then /usr/bin/env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh diff --git a/plugins/colored-man/colored-man.plugin.zsh b/plugins/colored-man/colored-man.plugin.zsh index 4956f4346..5c613f49d 100644 --- a/plugins/colored-man/colored-man.plugin.zsh +++ b/plugins/colored-man/colored-man.plugin.zsh @@ -1,4 +1,4 @@ -if [ "${PLAT}" = "SunOS" ] +if [ "$OSTYPE[0,7]" = "solaris" ] then if [ ! -x ${HOME}/bin/nroff ] then diff --git a/tools/check_for_upgrade.sh b/tools/check_for_upgrade.sh index 1aba9a272..0e8845ab4 100644 --- a/tools/check_for_upgrade.sh +++ b/tools/check_for_upgrade.sh @@ -1,13 +1,9 @@ -#!/bin/sh +#!/usr/bin/env zsh + +zmodload zsh/datetime -PLAT=`uname -s` function _current_epoch() { - if [ "$PLAT" = "SunOS" ] - then - echo $(($(perl -e 'print time') / 60 / 60 / 24)) - else - echo $(($(date +%s) / 60 / 60 / 24)) - fi + echo $EPOCHSECONDS } function _update_zsh_update() { -- cgit v1.2.3-70-g09d2 From 36e05e95adf6218eb8c154706a5a101b687d6368 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 22 Oct 2014 15:16:15 +0200 Subject: Don't set auto_name_dirs because it messes up prompts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From http://zsh.sourceforge.net/Doc/Release/Options.html#Completion-4 > AUTO_NAME_DIRS > Any parameter that is set to the absolute name of a directory immediately > becomes a name for that directory, that will be used by the ‘%~’ and > related prompt sequences, and will be available when completion is performed > on a word starting with ‘~’. > (Otherwise, the parameter must be used in the form ‘~param’ first.) Explained in more detail in https://github.com/wayneeseguin/rvm/issues/3091#issuecomment-60083194 Related issues: https://github.com/robbyrussell/oh-my-zsh/issues/2857 https://github.com/robbyrussell/oh-my-zsh/issues/3238 https://github.com/wayneeseguin/rvm/issues/3091 --- lib/directories.zsh | 1 - 1 file changed, 1 deletion(-) (limited to 'lib') diff --git a/lib/directories.zsh b/lib/directories.zsh index 1896945f4..02743e0c7 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -1,5 +1,4 @@ # Changing/making/removing directory -setopt auto_name_dirs setopt auto_pushd setopt pushd_ignore_dups setopt pushdminus -- cgit v1.2.3-70-g09d2 From 74177c5320b2a1b2f8c4c695c05984b57fd7c6ea Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Thu, 9 Oct 2014 13:44:54 +0200 Subject: Change all whoami calls for $USER variable This avoid spawning additional processes, as the $USER variable will **always** contain the current logged-in user. --- lib/completion.zsh | 4 ++-- plugins/systemadmin/systemadmin.plugin.zsh | 2 +- themes/adben.zsh-theme | 5 ++--- themes/agnoster.zsh-theme | 6 ++---- themes/flazz.zsh-theme | 2 +- themes/obraun.zsh-theme | 2 +- themes/re5et.zsh-theme | 2 +- themes/sunrise.zsh-theme | 2 +- themes/ys.zsh-theme | 2 +- 9 files changed, 12 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/completion.zsh b/lib/completion.zsh index 83b6efb66..3a19a4eba 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -27,9 +27,9 @@ zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' if [ "$OSTYPE[0,7]" = "solaris" ] then - zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm" + zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm" else - zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w" + zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w" fi # disable named-directories autocompletion diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh index f5e44c66f..e0b1773ad 100644 --- a/plugins/systemadmin/systemadmin.plugin.zsh +++ b/plugins/systemadmin/systemadmin.plugin.zsh @@ -30,7 +30,7 @@ function retlog() { } alias ping='ping -c 5' -alias clr='clear;echo "Currently logged in on $(tty), as $(whoami) in directory $(pwd)."' +alias clr='clear;echo "Currently logged in on $(tty), as $USER in directory $(pwd)."' alias path='echo -e ${PATH//:/\\n}' alias mkdir='mkdir -pv' # get top process eating memory diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme index aa3093f64..6869c8a20 100644 --- a/themes/adben.zsh-theme +++ b/themes/adben.zsh-theme @@ -89,9 +89,8 @@ function precmd { # Context: user@directory or just directory prompt_context () { - local user=`whoami` - if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then - echo -n "${PR_RESET}${PR_RED}$user@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" + if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then + echo -n "${PR_RESET}${PR_RED}$USER@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" else echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" fi diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 2b33c48bc..7a62bd860 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -60,10 +60,8 @@ prompt_end() { # Context: user@hostname (who am I and where am I) prompt_context() { - local user=`whoami` - - if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then - prompt_segment black default "%(!.%{%F{yellow}%}.)$user@%m" + if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then + prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m" fi } diff --git a/themes/flazz.zsh-theme b/themes/flazz.zsh-theme index 280794f2b..c0a7fb5d0 100644 --- a/themes/flazz.zsh-theme +++ b/themes/flazz.zsh-theme @@ -1,4 +1,4 @@ -if [ "$(whoami)" = "root" ] +if [ "$USER" = "root" ] then CARETCOLOR="red" else CARETCOLOR="blue" fi diff --git a/themes/obraun.zsh-theme b/themes/obraun.zsh-theme index 08d137665..7af44056f 100644 --- a/themes/obraun.zsh-theme +++ b/themes/obraun.zsh-theme @@ -1,4 +1,4 @@ -if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi +if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" diff --git a/themes/re5et.zsh-theme b/themes/re5et.zsh-theme index 5bded76a3..95af1e2ee 100644 --- a/themes/re5et.zsh-theme +++ b/themes/re5et.zsh-theme @@ -1,4 +1,4 @@ -if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi +if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})" diff --git a/themes/sunrise.zsh-theme b/themes/sunrise.zsh-theme index 4bea20a1b..28befd01b 100644 --- a/themes/sunrise.zsh-theme +++ b/themes/sunrise.zsh-theme @@ -10,7 +10,7 @@ Y=$fg_no_bold[yellow] B=$fg_no_bold[blue] RESET=$reset_color -if [ "$(whoami)" = "root" ]; then +if [ "$USER" = "root" ]; then PROMPTCOLOR="%{$R%}" PREFIX="-!-"; else PROMPTCOLOR="" PREFIX="---"; diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme index a44f295f4..65448964d 100644 --- a/themes/ys.zsh-theme +++ b/themes/ys.zsh-theme @@ -33,7 +33,7 @@ ${git_info} \ %{$fg[white]%}[%*] %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" -if [[ "$(whoami)" == "root" ]]; then +if [[ "$USER" == "root" ]]; then PROMPT=" %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ %{$bg[yellow]%}%{$fg[cyan]%}%n%{$reset_color%} \ -- cgit v1.2.3-70-g09d2 From 00ec11d3c0a2b2b7413ad84940ddec299aafbb04 Mon Sep 17 00:00:00 2001 From: DanielFGray Date: Sun, 16 Nov 2014 02:47:35 -0600 Subject: ignore any grep aliases that might be defined --- lib/git.zsh | 2 +- plugins/mercurial/mercurial.plugin.zsh | 2 +- plugins/svn-fast-info/svn-fast-info.plugin.zsh | 12 ++++++------ plugins/svn/svn.plugin.zsh | 4 ++-- themes/agnoster.zsh-theme | 4 ++-- themes/bureau.zsh-theme | 2 +- themes/mortalscumbag.zsh-theme | 6 +++--- 7 files changed, 16 insertions(+), 16 deletions(-) (limited to 'lib') diff --git a/lib/git.zsh b/lib/git.zsh index aba095422..913a642b3 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -78,7 +78,7 @@ function git_prompt_long_sha() { git_prompt_status() { INDEX=$(command git status --porcelain -b 2> /dev/null) STATUS="" - if $(echo "$INDEX" | grep -E '^\?\? ' &> /dev/null); then + if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS" fi if $(echo "$INDEX" | grep '^A ' &> /dev/null); then diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index ff95d5e40..ed4d23713 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -42,7 +42,7 @@ $ZSH_THEME_REPO_NAME_COLOR$_DISPLAY$ZSH_PROMPT_BASE_COLOR$ZSH_THEME_HG_PROMPT_SU function hg_dirty_choose { if [ $(in_hg) ]; then - hg status 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]' + hg status 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]' if [ $pipestatus[-1] -eq 0 ]; then # Grep exits with 0 when "One or more lines were selected", return "dirty". echo $1 diff --git a/plugins/svn-fast-info/svn-fast-info.plugin.zsh b/plugins/svn-fast-info/svn-fast-info.plugin.zsh index ea19bcea0..9ea7f641d 100644 --- a/plugins/svn-fast-info/svn-fast-info.plugin.zsh +++ b/plugins/svn-fast-info/svn-fast-info.plugin.zsh @@ -63,11 +63,11 @@ function svn_current_revision() { function svn_status_info() { local svn_status_string="$ZSH_THEME_SVN_PROMPT_CLEAN" local svn_status="$(svn status 2> /dev/null)"; - if grep -E '^\s*A' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"; fi - if grep -E '^\s*D' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DELETIONS:-✖}"; fi - if grep -E '^\s*M' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-✎}"; fi - if grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-∿}"; fi - if grep -E '^\s*\?' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"; fi - if grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DIRTY:-'!'}"; fi + if command grep -E '^\s*A' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_ADDITIONS:-+}"; fi + if command grep -E '^\s*D' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DELETIONS:-✖}"; fi + if command grep -E '^\s*M' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_MODIFICATIONS:-✎}"; fi + if command grep -E '^\s*[R~]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_REPLACEMENTS:-∿}"; fi + if command grep -E '^\s*\?' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_UNTRACKED:-?}"; fi + if command grep -E '^\s*[CI!L]' &> /dev/null <<< $svn_status; then svn_status_string="$svn_status_string ${ZSH_THEME_SVN_PROMPT_DIRTY:-'!'}"; fi echo $svn_status_string } diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh index ba281d790..9f7a4c6eb 100644 --- a/plugins/svn/svn.plugin.zsh +++ b/plugins/svn/svn.plugin.zsh @@ -61,7 +61,7 @@ function svn_get_rev_nr() { function svn_dirty_choose() { if in_svn; then root=`svn info 2> /dev/null | sed -n 's/^Working Copy Root Path: //p'` - if $(svn status $root 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'); then + if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then # Grep exits with 0 when "One or more lines were selected", return "dirty". echo $1 else @@ -78,7 +78,7 @@ function svn_dirty() { function svn_dirty_choose_pwd () { if in_svn; then root=$PWD - if $(svn status $root 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'); then + if $(svn status $root 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]'); then # Grep exits with 0 when "One or more lines were selected", return "dirty". echo $1 else diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 7a62bd860..8c7be6e01 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -123,10 +123,10 @@ prompt_hg() { st="" rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g') branch=$(hg id -b 2>/dev/null) - if `hg st | grep -Eq "^\?"`; then + if `hg st | grep -q "^\?"`; then prompt_segment red black st='±' - elif `hg st | grep -Eq "^(M|A)"`; then + elif `hg st | grep -q "^(M|A)"`; then prompt_segment yellow black st='±' else diff --git a/themes/bureau.zsh-theme b/themes/bureau.zsh-theme index 443d1d5ee..148abec10 100644 --- a/themes/bureau.zsh-theme +++ b/themes/bureau.zsh-theme @@ -31,7 +31,7 @@ bureau_git_status () { if $(echo "$_INDEX" | grep '^.[MTD] ' &> /dev/null); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" fi - if $(echo "$_INDEX" | grep -E '^\?\? ' &> /dev/null); then + if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" fi if $(echo "$_INDEX" | grep '^UU ' &> /dev/null); then diff --git a/themes/mortalscumbag.zsh-theme b/themes/mortalscumbag.zsh-theme index 5dbf2e4f6..ccce4197a 100644 --- a/themes/mortalscumbag.zsh-theme +++ b/themes/mortalscumbag.zsh-theme @@ -10,12 +10,12 @@ function my_git_prompt() { fi # is anything staged? - if $(echo "$INDEX" | grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then + if $(echo "$INDEX" | command grep -E -e '^(D[ M]|[MARC][ MD]) ' &> /dev/null); then STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED" fi # is anything unstaged? - if $(echo "$INDEX" | grep -E -e '^[ MARC][MD] ' &> /dev/null); then + if $(echo "$INDEX" | command grep -E -e '^[ MARC][MD] ' &> /dev/null); then STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" fi @@ -25,7 +25,7 @@ function my_git_prompt() { fi # is anything unmerged? - if $(echo "$INDEX" | grep -E -e '^(A[AU]|D[DU]|U[ADU]) ' &> /dev/null); then + if $(echo "$INDEX" | command grep -E -e '^(A[AU]|D[DU]|U[ADU]) ' &> /dev/null); then STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" fi -- cgit v1.2.3-70-g09d2 From a301f567e3a7ac2eb0b1f77d6ff97f50d63ba864 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 19 Nov 2014 18:33:00 +0100 Subject: Switch back to oh-my-zsh.hide-dirty setting again Commit 81004dfaba509ff62a13ba303ab941938d619326 reverted the change in 9b811fb625c03c30a766191cdf65a1c7c1fd96b2 when editing the merge conflict from #2928. This commit fixes that so that we don't make the same mistake again. First seen in http://git.io/Cdaj5Q --- lib/git.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/git.zsh b/lib/git.zsh index aba095422..748520a6f 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -13,7 +13,7 @@ parse_git_dirty() { local STATUS='' local FLAGS FLAGS=('--porcelain') - if [[ "$(command git config --get oh-my-zsh.hide-status)" != "1" ]]; then + if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then if [[ $POST_1_7_2_GIT -gt 0 ]]; then FLAGS+='--ignore-submodules=dirty' fi -- cgit v1.2.3-70-g09d2 From 1ebc98b9ede5ad5084b3e504e4fc8c01cb93be71 Mon Sep 17 00:00:00 2001 From: Joe Block Date: Sun, 30 Nov 2014 17:37:47 -0800 Subject: Don't clobber HISTSIZE or SAVEHIST if they're already set --- lib/history.zsh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/history.zsh b/lib/history.zsh index 1d83e56e3..12dbcf4ee 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -1,9 +1,13 @@ ## Command history configuration -if [ -z $HISTFILE ]; then +if [ -z "$HISTFILE" ]; then HISTFILE=$HOME/.zsh_history fi -HISTSIZE=10000 -SAVEHIST=10000 +if [ -z "$HISTSIZE" ]; then + HISTSIZE=10000 +fi +if [ -z "$SAVEHIST" ]; then + SAVEHIST=10000 +fi setopt extended_history setopt hist_expire_dups_first -- cgit v1.2.3-70-g09d2 From 5bf715787a4483cafd70461417cb9a1bf8d1509f Mon Sep 17 00:00:00 2001 From: Joe Block Date: Sun, 30 Nov 2014 17:39:21 -0800 Subject: Existing code indents with spaces, not tabs, conform. --- lib/history.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/history.zsh b/lib/history.zsh index 12dbcf4ee..179c22848 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -3,10 +3,10 @@ if [ -z "$HISTFILE" ]; then HISTFILE=$HOME/.zsh_history fi if [ -z "$HISTSIZE" ]; then - HISTSIZE=10000 + HISTSIZE=10000 fi if [ -z "$SAVEHIST" ]; then - SAVEHIST=10000 + SAVEHIST=10000 fi setopt extended_history -- cgit v1.2.3-70-g09d2 From 0bd3c9996fa58494fbefaad483abbe60ed332889 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 13 Dec 2014 19:13:27 +0100 Subject: Extract VCS folders definition to avoid repetition --- lib/grep.zsh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/grep.zsh b/lib/grep.zsh index 276fec382..ad38ec6fc 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -6,18 +6,17 @@ GREP_OPTIONS="--color=auto" # avoid VCS folders (if the necessary grep flags are available) +VCS_FOLDERS="{.cvs,.git,.hg,.svn}" + grep-flag-available() { echo | grep $1 "" >/dev/null 2>&1 } if grep-flag-available --exclude-dir=.cvs; then - for PATTERN in .cvs .git .hg .svn; do - GREP_OPTIONS+=" --exclude-dir=$PATTERN" - done + GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS" elif grep-flag-available --exclude=.cvs; then - for PATTERN in .cvs .git .hg .svn; do - GREP_OPTIONS+=" --exclude=$PATTERN" - done + GREP_OPTIONS+=" --exclude=$VCS_FOLDERS" fi +unset VCS_FOLDERS unfunction grep-flag-available export GREP_OPTIONS="$GREP_OPTIONS" -- cgit v1.2.3-70-g09d2 From cf586b54b8aacd7fad7afc74d4f395da56e828b6 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 13 Dec 2014 19:14:23 +0100 Subject: Ignore .bzr folders in grep too --- lib/grep.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/grep.zsh b/lib/grep.zsh index ad38ec6fc..4a44113e1 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -6,7 +6,7 @@ GREP_OPTIONS="--color=auto" # avoid VCS folders (if the necessary grep flags are available) -VCS_FOLDERS="{.cvs,.git,.hg,.svn}" +VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}" grep-flag-available() { echo | grep $1 "" >/dev/null 2>&1 -- cgit v1.2.3-70-g09d2 From 0190eb084bfb39bfa5920f85c2fc33730236217c Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 13 Dec 2014 19:18:11 +0100 Subject: Use unaliased grep in flag check --- lib/grep.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/grep.zsh b/lib/grep.zsh index 4a44113e1..06751db1a 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -9,7 +9,7 @@ GREP_OPTIONS="--color=auto" VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}" grep-flag-available() { - echo | grep $1 "" >/dev/null 2>&1 + echo | command grep $1 "" >/dev/null 2>&1 } if grep-flag-available --exclude-dir=.cvs; then GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS" -- cgit v1.2.3-70-g09d2 From 711843153d6e53a89d37931217f59c4f6a3a35db Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 13 Dec 2014 19:36:57 +0100 Subject: Tidy up the grep.zsh library --- lib/grep.zsh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/grep.zsh b/lib/grep.zsh index 06751db1a..4e55464c5 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -1,23 +1,24 @@ -# -# Color grep results -# Examples: http://rubyurl.com/ZXv -# +# is x grep argument available? +grep-flag-available() { + echo | grep $1 "" >/dev/null 2>&1 +} +# color grep results GREP_OPTIONS="--color=auto" -# avoid VCS folders (if the necessary grep flags are available) +# ignore VCS folders (if the necessary grep flags are available) VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}" -grep-flag-available() { - echo | command grep $1 "" >/dev/null 2>&1 -} if grep-flag-available --exclude-dir=.cvs; then GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS" elif grep-flag-available --exclude=.cvs; then GREP_OPTIONS+=" --exclude=$VCS_FOLDERS" fi -unset VCS_FOLDERS -unfunction grep-flag-available +# export grep settings export GREP_OPTIONS="$GREP_OPTIONS" export GREP_COLOR='1;32' + +# clean up +unset VCS_FOLDERS +unfunction grep-flag-available -- cgit v1.2.3-70-g09d2 From dd270878053a73600382de1c3592c04d985e5e08 Mon Sep 17 00:00:00 2001 From: Ondřej Súkup Date: Mon, 24 Nov 2014 13:08:39 +0100 Subject: Change to alias and remove deprecated GREP_COLOR --- lib/grep.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/grep.zsh b/lib/grep.zsh index 4e55464c5..348ebe623 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -16,9 +16,9 @@ elif grep-flag-available --exclude=.cvs; then fi # export grep settings -export GREP_OPTIONS="$GREP_OPTIONS" -export GREP_COLOR='1;32' +alias grep="grep $GREP_OPTIONS" # clean up +unset GREP_OPTIONS unset VCS_FOLDERS unfunction grep-flag-available -- cgit v1.2.3-70-g09d2 From 1978a0923c864cacdc520adff83ed63f62c91073 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 15 Dec 2014 08:11:04 -0800 Subject: Revert PR #3359 as this is breaking stuff for many folks. Need to rethink how we handle system defaults differently on this --- lib/history.zsh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/history.zsh b/lib/history.zsh index 179c22848..e78a98e9e 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -2,12 +2,9 @@ if [ -z "$HISTFILE" ]; then HISTFILE=$HOME/.zsh_history fi -if [ -z "$HISTSIZE" ]; then - HISTSIZE=10000 -fi -if [ -z "$SAVEHIST" ]; then - SAVEHIST=10000 -fi + +HISTSIZE=10000 +SAVEHIST=10000 setopt extended_history setopt hist_expire_dups_first -- cgit v1.2.3-70-g09d2 From 16d07683058719811a7871cbf7bed066ac8fc784 Mon Sep 17 00:00:00 2001 From: Joe Block Date: Sun, 14 Dec 2014 21:10:48 -0800 Subject: Quote path in case $HOME has a space in it. I've seen stranger things on OS X, unfortunately. This reverts commit 1f5cecee4768be192e439a72a873a6cfe8720927. --- lib/nvm.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/nvm.zsh b/lib/nvm.zsh index 5cadf7061..61d997fc0 100644 --- a/lib/nvm.zsh +++ b/lib/nvm.zsh @@ -1,6 +1,6 @@ # get the node.js version function nvm_prompt_info() { - [ -f $HOME/.nvm/nvm.sh ] || return + [ -f "$HOME/.nvm/nvm.sh" ] || return local nvm_prompt nvm_prompt=$(node -v 2>/dev/null) [[ "${nvm_prompt}x" == "x" ]] && return -- cgit v1.2.3-70-g09d2 From 7295e38885080b0650cbb274f03efca737552116 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Sun, 21 Dec 2014 15:05:22 -0500 Subject: termsupport: add chpwd hook for setting pwd in Apple Terminal.app --- lib/termsupport.zsh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 9d6681603..d9f2b64d4 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -1,7 +1,6 @@ #usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title #http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 #Fully support screen, iterm, and probably most modern xterm and rxvt -#Limited support for Apple Terminal (Terminal can't set window or tab separately) function title { if [[ "$DISABLE_AUTO_TITLE" == "true" ]] || [[ "$EMACS" == *term* ]]; then return @@ -10,7 +9,7 @@ function title { 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 (will override window name on broken terminal) + print -Pn "\e]1;$1:q\a" #set icon (=tab) name fi } @@ -34,5 +33,18 @@ function omz_termsupport_preexec { title '$CMD' '%100>...>$LINE%<<' } +#Appears each time pwd is changed +function omz_termsupport_chpwd { + #Notify Terminal.app of current directory using undocumented OSC sequence + #found in OS X 10.10's /etc/bashrc + if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then + local PWD_URL="file://$HOSTNAME${PWD// /%20}" + printf '\e]7;%s\a' "$PWD_URL" + fi +} +#Fire it once so the pwd is set properly upon shell startup +omz_termsupport_chpwd + precmd_functions+=(omz_termsupport_precmd) preexec_functions+=(omz_termsupport_preexec) +chpwd_functions+=(omz_termsupport_chpwd) -- cgit v1.2.3-70-g09d2 From bf7b9165fd725d2bdf45ca7e639b2c91f5ef65bb Mon Sep 17 00:00:00 2001 From: Stephen Date: Thu, 8 Jan 2015 16:01:16 +0000 Subject: Allow custom cache dir We are running oh-my-zsh on a shared install and the only issue is each user having a custom cache dir. This will allow us to set the cache dir to ZSH_CACHE_DIR=~/oh-my-zsh/cache/ . --- lib/completion.zsh | 2 +- oh-my-zsh.sh | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/completion.zsh b/lib/completion.zsh index 3a19a4eba..ea6139fde 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -38,7 +38,7 @@ cdpath=(.) # Use caching so that commands like apt and dpkg complete are useable zstyle ':completion::complete:*' use-cache 1 -zstyle ':completion::complete:*' cache-path $ZSH/cache/ +zstyle ':completion::complete:*' cache-path $ZSH_CACHE_DIR # Don't complete uninteresting users zstyle ':completion:*:*:*:users' ignored-patterns \ diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index d75b521c7..bc7a8e496 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -14,6 +14,13 @@ if [[ -z "$ZSH_CUSTOM" ]]; then ZSH_CUSTOM="$ZSH/custom" fi +# Set ZSH_CACHE_DIR to the path where cache files sould be created +# or else we will use the default cache/ +if [[ -z "$ZSH_CACHE_DIR" ]]; then + ZSH_CACHE_DIR="$ZSH/cache/" +fi + + # Load all of the config files in ~/oh-my-zsh that end in .zsh # TIP: Add files you don't want in git to .gitignore for config_file ($ZSH/lib/*.zsh); do -- cgit v1.2.3-70-g09d2 From 5f79ab5547f51bd32dcd0a1b21fc26c8720711ba Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Tue, 27 Jan 2015 21:00:07 -0600 Subject: Move chpwd update output from chpwd hook to precmd to avoid contaminating script/function output --- lib/termsupport.zsh | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index d9f2b64d4..ce36f229f 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -16,12 +16,19 @@ function title { ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" -#Appears when you have the prompt +# Runs when you have the prompt function omz_termsupport_precmd { title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE + + # Notify Terminal.app of current directory using undocumented OSC sequence + # found in OS X 10.9 and 10.10's /etc/bashrc + if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then + local PWD_URL="file://$HOSTNAME${PWD// /%20}" + printf '\e]7;%s\a' "$PWD_URL" + fi } -#Appears at the beginning of (and during) of command execution +# Runs at the beginning of (and during) of command execution function omz_termsupport_preexec { emulate -L zsh setopt extended_glob @@ -33,18 +40,5 @@ function omz_termsupport_preexec { title '$CMD' '%100>...>$LINE%<<' } -#Appears each time pwd is changed -function omz_termsupport_chpwd { - #Notify Terminal.app of current directory using undocumented OSC sequence - #found in OS X 10.10's /etc/bashrc - if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then - local PWD_URL="file://$HOSTNAME${PWD// /%20}" - printf '\e]7;%s\a' "$PWD_URL" - fi -} -#Fire it once so the pwd is set properly upon shell startup -omz_termsupport_chpwd - precmd_functions+=(omz_termsupport_precmd) preexec_functions+=(omz_termsupport_preexec) -chpwd_functions+=(omz_termsupport_chpwd) -- cgit v1.2.3-70-g09d2 From f2130fa1a3f440418a6c48f9bace43ce7443117f Mon Sep 17 00:00:00 2001 From: The Linux Kitten Date: Mon, 2 Feb 2015 20:49:24 +0100 Subject: Test if --color=auto is a valid option for grep --- lib/grep.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/grep.zsh b/lib/grep.zsh index 348ebe623..3fa103d19 100644 --- a/lib/grep.zsh +++ b/lib/grep.zsh @@ -3,8 +3,12 @@ grep-flag-available() { echo | grep $1 "" >/dev/null 2>&1 } +GREP_OPTIONS="" + # color grep results -GREP_OPTIONS="--color=auto" +if grep-flag-available --color=auto; then + GREP_OPTIONS+=" --color=auto" +fi # ignore VCS folders (if the necessary grep flags are available) VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}" -- cgit v1.2.3-70-g09d2 From be7028012ecc97bf8976d5de0aed51869720be2a Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Wed, 4 Feb 2015 01:00:51 -0500 Subject: Reword comments on termsupport internal functions. --- lib/termsupport.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index ce36f229f..bd0cf6ffe 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -16,7 +16,7 @@ function title { ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" -# Runs when you have the prompt +# Runs before showing the prompt function omz_termsupport_precmd { title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE @@ -28,7 +28,7 @@ function omz_termsupport_precmd { fi } -# Runs at the beginning of (and during) of command execution +# Runs before executing the command function omz_termsupport_preexec { emulate -L zsh setopt extended_glob -- cgit v1.2.3-70-g09d2 From 25b1cd687b28cb8d05229130ee5a0e2494276894 Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Fri, 10 Jan 2014 23:32:20 +0100 Subject: Brings all directory stuff to directories.zsh - Cleans out aliases.zsh. - Removes unneeded cd function. --- lib/aliases.zsh | 13 ------------- lib/directories.zsh | 38 +++++++++++++++----------------------- 2 files changed, 15 insertions(+), 36 deletions(-) (limited to 'lib') diff --git a/lib/aliases.zsh b/lib/aliases.zsh index aae865046..c67f854a7 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -1,11 +1,3 @@ -# Push and pop directories on directory stack -alias pu='pushd' -alias po='popd' - -# Basic directory operations -alias ...='cd ../..' -alias -- -='cd -' - # Super user alias _='sudo' alias please='sudo' @@ -25,11 +17,6 @@ then else alias history='fc -l 1' fi -# List direcory contents -alias lsa='ls -lah' -alias l='ls -lah' -alias ll='ls -lh' -alias la='ls -lAh' alias afind='ack-grep -il' diff --git a/lib/directories.zsh b/lib/directories.zsh index 02743e0c7..1693d5dd1 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -3,12 +3,10 @@ setopt auto_pushd setopt pushd_ignore_dups setopt pushdminus -alias ..='cd ..' -alias cd..='cd ..' -alias cd...='cd ../..' -alias cd....='cd ../../..' -alias cd.....='cd ../../../..' -alias cd/='cd /' +alias -g ...='../..' +alias -g ....='../../..' +alias -g .....='../../../..' +alias -g ......='../../../../..' alias 1='cd -' alias 2='cd -2' @@ -20,23 +18,17 @@ alias 7='cd -7' alias 8='cd -8' alias 9='cd -9' -cd () { - if [[ "x$*" == "x..." ]]; then - cd ../.. - elif [[ "x$*" == "x...." ]]; then - cd ../../.. - elif [[ "x$*" == "x....." ]]; then - cd ../../../.. - elif [[ "x$*" == "x......" ]]; then - cd ../../../../.. - elif [ -d ~/.autoenv ]; then - source ~/.autoenv/activate.sh - autoenv_cd "$@" - else - builtin cd "$@" - fi -} - alias md='mkdir -p' alias rd=rmdir alias d='dirs -v | head -10' + +# List direcory contents +alias lsa='ls -lah' +alias l='ls -la' +alias ll='ls -l' +alias la='ls -lA' +alias sl=ls # often screw this up + +# Push and pop directories on directory stack +alias pu='pushd' +alias po='popd' -- cgit v1.2.3-70-g09d2 From d33b0aae917c62012bf203538ba86d6236869834 Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Fri, 10 Jan 2014 23:50:19 +0100 Subject: Refactors history alias and moves it. More compact case statement instead of the ugly if elif... else statement. Moves it to history.zsh --- lib/aliases.zsh | 14 -------------- lib/history.zsh | 9 +++++++++ 2 files changed, 9 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/aliases.zsh b/lib/aliases.zsh index c67f854a7..da29fde58 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -4,19 +4,5 @@ alias please='sudo' #alias g='grep -in' -# Show history -if [ "$HIST_STAMPS" = "mm/dd/yyyy" ] -then - alias history='fc -fl 1' -elif [ "$HIST_STAMPS" = "dd.mm.yyyy" ] -then - alias history='fc -El 1' -elif [ "$HIST_STAMPS" = "yyyy-mm-dd" ] -then - alias history='fc -il 1' -else - alias history='fc -l 1' -fi - alias afind='ack-grep -il' diff --git a/lib/history.zsh b/lib/history.zsh index e78a98e9e..5de71c2d3 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -6,6 +6,15 @@ fi HISTSIZE=10000 SAVEHIST=10000 +# Show history +case $HIST_STAMPS in + "mm/dd/yyyy") alias history='fc -fl 1' ;; + "dd.mm.yyyy") alias history='fc -El 1' ;; + "yyyy-mm-dd") alias history='fc -il 1' ;; + *) alias history='fc -l 1' ;; +esac + +setopt append_history setopt extended_history setopt hist_expire_dups_first setopt hist_ignore_dups # ignore duplication command history list -- cgit v1.2.3-70-g09d2 From 101149b1ae6fb5ce0b982289fca901b2feab5439 Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Fri, 10 Jan 2014 23:53:14 +0100 Subject: Moves remaining aliases to misc and deletes file. There were only three aliases left in aliases.zsh File deleted! --- lib/aliases.zsh | 8 -------- lib/misc.zsh | 7 +++++++ 2 files changed, 7 insertions(+), 8 deletions(-) delete mode 100644 lib/aliases.zsh (limited to 'lib') diff --git a/lib/aliases.zsh b/lib/aliases.zsh deleted file mode 100644 index da29fde58..000000000 --- a/lib/aliases.zsh +++ /dev/null @@ -1,8 +0,0 @@ -# Super user -alias _='sudo' -alias please='sudo' - -#alias g='grep -in' - -alias afind='ack-grep -il' - diff --git a/lib/misc.zsh b/lib/misc.zsh index a8678b8ec..892d78ef3 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -13,3 +13,10 @@ export PAGER="less" export LESS="-R" export LC_CTYPE=$LANG + +## super user alias +alias _='sudo' +alias please='sudo' + +## more intelligent acking for ubuntu users +alias afind='ack-grep -il' -- cgit v1.2.3-70-g09d2 From 83c4e0620689d2410056bddcdfbf8e300673e982 Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Fri, 10 Jan 2014 23:55:10 +0100 Subject: Moves a bindkey call from misc to key-bindings. --- lib/key-bindings.zsh | 3 +++ lib/misc.zsh | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/key-bindings.zsh b/lib/key-bindings.zsh index 9063c6a18..eb2b58058 100644 --- a/lib/key-bindings.zsh +++ b/lib/key-bindings.zsh @@ -64,6 +64,9 @@ autoload -U edit-command-line zle -N edit-command-line bindkey '\C-x\C-e' edit-command-line +# file rename magick +bindkey "^[m" copy-prev-shell-word + # consider emacs keybindings: #bindkey -e ## emacs key bindings diff --git a/lib/misc.zsh b/lib/misc.zsh index 892d78ef3..ea8a05fcb 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -2,9 +2,6 @@ autoload -U url-quote-magic zle -N self-insert url-quote-magic -## file rename magick -bindkey "^[m" copy-prev-shell-word - ## jobs setopt long_list_jobs -- cgit v1.2.3-70-g09d2 From 4b4292a496c139039807f082425cc5507f762c0d Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Sat, 15 Mar 2014 00:00:14 +0100 Subject: Fix a typo --- lib/directories.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/directories.zsh b/lib/directories.zsh index 1693d5dd1..b7a53ecfe 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -22,7 +22,7 @@ alias md='mkdir -p' alias rd=rmdir alias d='dirs -v | head -10' -# List direcory contents +# List directory contents alias lsa='ls -lah' alias l='ls -la' alias ll='ls -l' -- cgit v1.2.3-70-g09d2 From 51946eb3ce8021aebe940f879225828d89c12317 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 9 Feb 2015 20:29:10 +0100 Subject: Implement deletion of sl alias as per #3055 --- lib/directories.zsh | 1 - 1 file changed, 1 deletion(-) (limited to 'lib') diff --git a/lib/directories.zsh b/lib/directories.zsh index b7a53ecfe..1a9698544 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -27,7 +27,6 @@ alias lsa='ls -lah' alias l='ls -la' alias ll='ls -l' alias la='ls -lA' -alias sl=ls # often screw this up # Push and pop directories on directory stack alias pu='pushd' -- cgit v1.2.3-70-g09d2 From 2193135ebc4ce0778ff6949b448e4526dbd34284 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 9 Feb 2015 20:43:48 +0100 Subject: Clean up appearance lib file and redundant `colors` calls in other files --- lib/theme-and-appearance.zsh | 8 +++----- plugins/git-prompt/git-prompt.plugin.zsh | 3 --- plugins/jump/jump.plugin.zsh | 1 - themes/adben.zsh-theme | 15 ++++++--------- themes/apple.zsh-theme | 1 - themes/gnzh.zsh-theme | 3 +-- themes/half-life.zsh-theme | 2 -- themes/jonathan.zsh-theme | 5 +---- themes/kolo.zsh-theme | 2 -- themes/mikeh.zsh-theme | 2 -- themes/simonoff.zsh-theme | 5 +---- themes/steeef.zsh-theme | 2 -- themes/zhann.zsh-theme | 2 -- 13 files changed, 12 insertions(+), 39 deletions(-) (limited to 'lib') diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh index 0353f9db4..926303ca4 100644 --- a/lib/theme-and-appearance.zsh +++ b/lib/theme-and-appearance.zsh @@ -1,14 +1,13 @@ # ls colors -autoload colors; colors; +autoload -U colors && colors export LSCOLORS="Gxfxcxdxbxegedabagacad" -#export LS_COLORS # Enable ls colors if [ "$DISABLE_LS_COLORS" != "true" ] then # Find the option for using colors in ls, depending on the version: Linux or BSD if [[ "$(uname -s)" == "NetBSD" ]]; then - # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); + # On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors); # otherwise, leave ls as is, because NetBSD's ls doesn't support -G gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty' elif [[ "$(uname -s)" == "OpenBSD" ]]; then @@ -23,7 +22,7 @@ fi #setopt no_beep setopt auto_cd setopt multios -setopt cdablevarS +setopt cdablevars if [[ x$WINDOW != x ]] then @@ -43,4 +42,3 @@ ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is c # Setup the prompt with pretty colors setopt prompt_subst - diff --git a/plugins/git-prompt/git-prompt.plugin.zsh b/plugins/git-prompt/git-prompt.plugin.zsh index 01b8a88d9..d868a5fe1 100644 --- a/plugins/git-prompt/git-prompt.plugin.zsh +++ b/plugins/git-prompt/git-prompt.plugin.zsh @@ -2,9 +2,6 @@ # http://github.com/olivierverdier/zsh-git-prompt # export __GIT_PROMPT_DIR=$ZSH/plugins/git-prompt -# Initialize colors. -autoload -U colors -colors # Allow for functions in the prompt. setopt PROMPT_SUBST diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh index b16814fe4..d082c11e5 100644 --- a/plugins/jump/jump.plugin.zsh +++ b/plugins/jump/jump.plugin.zsh @@ -27,7 +27,6 @@ unmark() { rm -i "$MARKPATH/$1" } -autoload colors marks() { for link in $MARKPATH/*(@); do local markname="$fg[cyan]${link:t}$reset_color" diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme index 6869c8a20..212b823a5 100644 --- a/themes/adben.zsh-theme +++ b/themes/adben.zsh-theme @@ -69,17 +69,17 @@ function precmd { #Choose from all databases, regardless of whether they are considered "offensive" fortune -a } - #obtains the tip + #obtains the tip ps1_command_tip () { wget -qO - http://www.commandlinefu.com/commands/random/plaintext | sed 1d | sed '/^$/d' - } + } prompt_header () { if [[ "true" == "$ENABLE_COMMAND_TIP" ]]; then ps1_command_tip else ps1_fortune - fi - } + fi + } PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}" # set a simple variable to show when in screen if [[ -n "${WINDOW}" ]]; then @@ -99,11 +99,8 @@ prompt_context () { set_prompt () { # required for the prompt setopt prompt_subst - autoload colors zsh/terminfo - if [[ "$terminfo[colors]" -gt 8 ]]; then - colors - fi - + autoload zsh/terminfo + # ######### PROMPT ######### PROMPT='${PROMPT_HEAD} ${RED_START}$(prompt_context) diff --git a/themes/apple.zsh-theme b/themes/apple.zsh-theme index 275341dc6..95e6249fa 100644 --- a/themes/apple.zsh-theme +++ b/themes/apple.zsh-theme @@ -7,7 +7,6 @@ get_git_dirty() { } autoload -Uz vcs_info -autoload -U colors && colors zstyle ':vcs_info:*' check-for-changes true zstyle ':vcs_info:*' unstagedstr '%F{red}*' # display this when there are unstaged changes zstyle ':vcs_info:*' stagedstr '%F{yellow}+' # display this when there are staged changes diff --git a/themes/gnzh.zsh-theme b/themes/gnzh.zsh-theme index 0519fbefb..ab154c1e5 100644 --- a/themes/gnzh.zsh-theme +++ b/themes/gnzh.zsh-theme @@ -2,8 +2,7 @@ # Based on bira theme # load some modules -autoload -U colors zsh/terminfo # Used in the colour alias below -colors +autoload -U zsh/terminfo # Used in the colour alias below setopt prompt_subst # make some aliases for the colours: (could use normal escape sequences too) diff --git a/themes/half-life.zsh-theme b/themes/half-life.zsh-theme index 942affa94..a3c505706 100644 --- a/themes/half-life.zsh-theme +++ b/themes/half-life.zsh-theme @@ -13,8 +13,6 @@ function virtualenv_info { PR_GIT_UPDATE=1 setopt prompt_subst -autoload colors -colors autoload -U add-zsh-hook autoload -Uz vcs_info diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme index bca92970c..2f0e77431 100644 --- a/themes/jonathan.zsh-theme +++ b/themes/jonathan.zsh-theme @@ -44,10 +44,7 @@ setprompt () { ### # See if we can use colors. - autoload colors zsh/terminfo - if [[ "$terminfo[colors]" -ge 8 ]]; then - colors - fi + autoload zsh/terminfo for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' diff --git a/themes/kolo.zsh-theme b/themes/kolo.zsh-theme index e743289c3..51b0af724 100644 --- a/themes/kolo.zsh-theme +++ b/themes/kolo.zsh-theme @@ -1,5 +1,3 @@ -autoload -U colors && colors - autoload -Uz vcs_info zstyle ':vcs_info:*' stagedstr '%F{green}●' diff --git a/themes/mikeh.zsh-theme b/themes/mikeh.zsh-theme index 943f04d38..a95383ba5 100644 --- a/themes/mikeh.zsh-theme +++ b/themes/mikeh.zsh-theme @@ -1,6 +1,4 @@ setopt prompt_subst -autoload colors -colors autoload -U add-zsh-hook autoload -Uz vcs_info diff --git a/themes/simonoff.zsh-theme b/themes/simonoff.zsh-theme index fb4d32e24..63ce4261b 100644 --- a/themes/simonoff.zsh-theme +++ b/themes/simonoff.zsh-theme @@ -63,10 +63,7 @@ setprompt () { ### # See if we can use colors. - autoload colors zsh/terminfo - if [[ "$terminfo[colors]" -ge 8 ]]; then - colors - fi + autoload zsh/terminfo for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index e38188d35..13728ca9a 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -15,8 +15,6 @@ function virtualenv_info { PR_GIT_UPDATE=1 setopt prompt_subst -autoload colors -colors autoload -U add-zsh-hook autoload -Uz vcs_info diff --git a/themes/zhann.zsh-theme b/themes/zhann.zsh-theme index 5c0854730..27597ec6c 100644 --- a/themes/zhann.zsh-theme +++ b/themes/zhann.zsh-theme @@ -1,5 +1,3 @@ -autoload -U colors && colors - autoload -Uz vcs_info zstyle ':vcs_info:*' stagedstr '%F{green}●' -- cgit v1.2.3-70-g09d2 From 4fc6dccb4286828c7cd53d3612ec69b0c0d9aaf2 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Sat, 20 Dec 2014 02:24:26 -0500 Subject: term: Move DISABLE_AUTO_TITLE check to hooks Move the DISABLE_AUTO_TITLE check from title() to the preX hook functions that call it, to allow the title() function to be used directly by user or other callers. --- lib/termsupport.zsh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index bd0cf6ffe..2fa61c431 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -1,8 +1,16 @@ -#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title -#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 -#Fully support screen, iterm, and probably most modern xterm and rxvt +# Set terminal window and tab/icon title +# +# usage: title short_tab_title [long_window_title] +# +# See: http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 +# Fully supports screen, iterm, and probably most modern xterm and rxvt +# (In screen, only short_tab_title is used) +# Limited support for Apple Terminal (Terminal can't set window and tab separately) function title { - if [[ "$DISABLE_AUTO_TITLE" == "true" ]] || [[ "$EMACS" == *term* ]]; then + if [[ $2 == "" ]]; then + 2="$1" + fi + if [[ "$EMACS" == *term* ]]; then return fi if [[ "$TERM" == screen* ]]; then @@ -18,6 +26,10 @@ ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" # Runs before showing the prompt function omz_termsupport_precmd { + if [[ $DISABLE_AUTO_TITLE == true ]]; then + return + fi + title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE # Notify Terminal.app of current directory using undocumented OSC sequence @@ -30,6 +42,10 @@ function omz_termsupport_precmd { # Runs before executing the command function omz_termsupport_preexec { + if [[ $DISABLE_AUTO_TITLE == true ]]; then + return + fi + emulate -L zsh setopt extended_glob -- cgit v1.2.3-70-g09d2 From b7e5dd35efb0750634eb16b7040337ce80f67684 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 10 Feb 2015 19:43:25 +0100 Subject: Quick-fix code style --- lib/termsupport.zsh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 2fa61c431..f21b0b041 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -7,12 +7,12 @@ # (In screen, only short_tab_title is used) # Limited support for Apple Terminal (Terminal can't set window and tab separately) function title { - if [[ $2 == "" ]]; then - 2="$1" - fi - if [[ "$EMACS" == *term* ]]; then - return - fi + [[ "$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 -- cgit v1.2.3-70-g09d2 From 2e41d06b7655067272cee1e54d2d66693136a90f Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 10 Feb 2015 19:53:40 +0100 Subject: Use quoted $TERM value everywhere --- lib/termsupport.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index f21b0b041..58c6203a0 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -15,7 +15,7 @@ function title { 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 + 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 -- cgit v1.2.3-70-g09d2 From 448e966129bb5c08c7b2da4636491f0f890cf0ab Mon Sep 17 00:00:00 2001 From: frozen_dude Date: Mon, 29 Jul 2013 20:04:23 +0200 Subject: Fix for bad LC_CTYPE entry LANG is a colon-separated list of prefered locales; LC_CTYPE is single entry, therefore we need to remove all but one entry. Also, there is no need setting it if it is already set (LC_ALL also sets LC_CTYPE, so we check it too). --- lib/misc.zsh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/misc.zsh b/lib/misc.zsh index ea8a05fcb..6987c099c 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -9,11 +9,21 @@ setopt long_list_jobs export PAGER="less" export LESS="-R" -export LC_CTYPE=$LANG - ## super user alias alias _='sudo' alias please='sudo' ## more intelligent acking for ubuntu users alias afind='ack-grep -il' + +## how to interpret text characters +if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then # only define if undefined + export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG + [[ -z "$LC_CTYPE" ]] && \ + export LC_CTYPE=`locale -a | grep en_US.utf8 | head -1` + [[ -z "$LC_CTYPE" ]] && \ + export LC_CTYPE=`locale -a | grep en_US | head -1` + [[ -z "$LC_CTYPE" ]] && \ + export LC_CTYPE=C # default to internal encoding. +fi + -- cgit v1.2.3-70-g09d2 From 0edf416bea1a180e82a8f5f96444d74fabb5867f Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 9 Feb 2015 18:57:23 +0100 Subject: Temporarily delete over-engineered solution --- lib/misc.zsh | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/misc.zsh b/lib/misc.zsh index 6987c099c..0b7cb2696 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -16,14 +16,7 @@ alias please='sudo' ## more intelligent acking for ubuntu users alias afind='ack-grep -il' -## how to interpret text characters -if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then # only define if undefined - export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG - [[ -z "$LC_CTYPE" ]] && \ - export LC_CTYPE=`locale -a | grep en_US.utf8 | head -1` - [[ -z "$LC_CTYPE" ]] && \ - export LC_CTYPE=`locale -a | grep en_US | head -1` - [[ -z "$LC_CTYPE" ]] && \ - export LC_CTYPE=C # default to internal encoding. +# only define LC_CTYPE if undefined +if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then + export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG fi - -- cgit v1.2.3-70-g09d2 From 3704fbb71eb4d886aff11cdaff79a1a23a895cd6 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 11 Feb 2015 19:58:33 +0100 Subject: Extract CWD notifier back out of auto-title hooks --- lib/termsupport.zsh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index 58c6203a0..e1c2e2f93 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -31,13 +31,6 @@ function omz_termsupport_precmd { fi title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE - - # Notify Terminal.app of current directory using undocumented OSC sequence - # found in OS X 10.9 and 10.10's /etc/bashrc - if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then - local PWD_URL="file://$HOSTNAME${PWD// /%20}" - printf '\e]7;%s\a' "$PWD_URL" - fi } # Runs before executing the command @@ -58,3 +51,16 @@ function omz_termsupport_preexec { precmd_functions+=(omz_termsupport_precmd) preexec_functions+=(omz_termsupport_preexec) + + +# Runs before showing the prompt, to update the current directory in Terminal.app +function omz_termsupport_cwd { + # Notify Terminal.app of current directory using undocumented OSC sequence + # found in OS X 10.9 and 10.10's /etc/bashrc + if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then + local PWD_URL="file://$HOSTNAME${PWD// /%20}" + printf '\e]7;%s\a' "$PWD_URL" + fi +} + +precmd_functions+=(omz_termsupport_cwd) -- cgit v1.2.3-70-g09d2 From 2790a5e565ecf1a695c25c7ef0d5aa23f8bb5239 Mon Sep 17 00:00:00 2001 From: Zhiming Wang Date: Sun, 15 Feb 2015 11:37:28 -0800 Subject: Bring back -h option to ls variants The -h options in l, ll, and la were lost in 25b1cd6. There's no reason to remove them. --- lib/directories.zsh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/directories.zsh b/lib/directories.zsh index 1a9698544..3bffa9fd9 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -24,9 +24,9 @@ alias d='dirs -v | head -10' # List directory contents alias lsa='ls -lah' -alias l='ls -la' -alias ll='ls -l' -alias la='ls -lA' +alias l='ls -lah' +alias ll='ls -lh' +alias la='ls -lAh' # Push and pop directories on directory stack alias pu='pushd' -- cgit v1.2.3-70-g09d2 From 6ccf67a077e07bc57cdca6980dcdf346cbd2138e Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Mon, 16 Feb 2015 10:24:22 -0500 Subject: Do not put explicit dot in $cdpath, since it causes problems on Cygwin due to an underlying zsh bug. --- lib/completion.zsh | 1 - 1 file changed, 1 deletion(-) (limited to 'lib') diff --git a/lib/completion.zsh b/lib/completion.zsh index ea6139fde..4b1bb0a62 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -34,7 +34,6 @@ fi # disable named-directories autocompletion zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories -cdpath=(.) # Use caching so that commands like apt and dpkg complete are useable zstyle ':completion::complete:*' use-cache 1 -- cgit v1.2.3-70-g09d2 From 66052e2d07fc4e6205bf7f14adfa12d53d9ad487 Mon Sep 17 00:00:00 2001 From: Jordan Klassen Date: Wed, 29 Apr 2015 15:37:39 -0700 Subject: Add hyphen insensitivity --- lib/completion.zsh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/completion.zsh b/lib/completion.zsh index 4b1bb0a62..452c0dfe7 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -15,7 +15,12 @@ if [ "x$CASE_SENSITIVE" = "xtrue" ]; then zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' unset CASE_SENSITIVE else - zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' + if [ "x$HYPHEN_INSENSITIVE" = "xtrue" ]; then + zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' + unset HYPHEN_INSENSITIVE + else + zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' + fi fi zstyle ':completion:*' list-colors '' -- cgit v1.2.3-70-g09d2 From 16535452829d36f5382b176216a9ad312b2be1e5 Mon Sep 17 00:00:00 2001 From: Tejas Bubane Date: Tue, 23 Dec 2014 12:48:09 +0530 Subject: Recognize comments by default. --- lib/misc.zsh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/misc.zsh b/lib/misc.zsh index 0b7cb2696..c9a8e9e8f 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -20,3 +20,6 @@ alias afind='ack-grep -il' if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG fi + +# recognize comments +setopt interactivecomments -- cgit v1.2.3-70-g09d2 From 70c4a27fd6048c3213dd2f3bae21bff26005bc16 Mon Sep 17 00:00:00 2001 From: "leif.hanack" Date: Wed, 4 Jun 2014 00:37:33 +0200 Subject: Added a possibility to display the remote branch and the number of commits you are ahead or behind --- lib/git.zsh | 20 +++++++++++++++----- themes/strug.zsh-theme | 25 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 themes/strug.zsh-theme (limited to 'lib') diff --git a/lib/git.zsh b/lib/git.zsh index 118841f06..733492ba0 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -36,16 +36,26 @@ git_remote_status() { ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l) behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l) - if [ $ahead -eq 0 ] && [ $behind -gt 0 ] + if [ $ahead -gt 0 ] && [ $behind -eq 0 ] then - echo "$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE" - elif [ $ahead -gt 0 ] && [ $behind -eq 0 ] + git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE" + git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}" + elif [ $behind -gt 0 ] && [ $ahead -eq 0 ] then - echo "$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE" + git_remote_status="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE" + git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}" elif [ $ahead -gt 0 ] && [ $behind -gt 0 ] then - echo "$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE" + git_remote_status="$ZSH_THEME_GIT_PROMPT_DIVERGED_REMOTE" + git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE$((behind))%{$reset_color%}" fi + + if [ $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ] + then + git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX" + fi + + echo $git_remote_status fi } diff --git a/themes/strug.zsh-theme b/themes/strug.zsh-theme new file mode 100644 index 000000000..89b56b008 --- /dev/null +++ b/themes/strug.zsh-theme @@ -0,0 +1,25 @@ +# terminal coloring +export CLICOLOR=1 +export LSCOLORS=dxFxCxDxBxegedabagacad + +local git_branch='$(git_prompt_info)%{$reset_color%}$(git_remote_status)' + +PROMPT="%{$fg[green]%}╭─%n@%m %{$reset_color%}%{$fg[yellow]%}in %~ %{$reset_color%}${git_branch} +%{$fg[green]%}╰\$ %{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%}on " +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_DIRTY="%{$reset_color%}%{$fg[red]%} ✘ %{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%} ✔ %{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED=true +ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX="%{$fg[yellow]%}(" +ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX="%{$fg[yellow]%})%{$reset_color%}" + +ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE=" +" +ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR=%{$fg[green]%} + +ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE=" -" +ZSH_THEME_GIT_PROMPT_BEHIND_REMOTE_COLOR=%{$fg[red]%} + -- cgit v1.2.3-70-g09d2 From 2d40cc0bb315a92368e35c15c92f955bd901c7c3 Mon Sep 17 00:00:00 2001 From: Adam Lindberg Date: Wed, 16 Apr 2014 10:34:45 +0200 Subject: Add git_prompt_behind and git_prompt_exists This adds two new theme functions for git: * `git_prompt_behind` works in a identical fashion to `git_prompt_ahead` and will output a format variable (`ZSH_THEME_GIT_PROMPT_BEHIND`) if the branch is behind. * `git_prompt_remote` will output one format variable if the branch exists on remote (`ZSH_THEME_GIT_PROMPT_REMOTE_EXISTS`), and another if the branch is unpublished (`ZSH_THEME_GIT_PROMPT_REMOTE_MISSING`). The old `git_prompt_ahead` has been changed. Using git log is subject to formatting in .gitconfig, which can be overridden and will break this function. Relying on rev-list is much more stable. --- lib/git.zsh | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/git.zsh b/lib/git.zsh index 733492ba0..caa7e6329 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -59,13 +59,6 @@ git_remote_status() { fi } -# Checks if there are commits ahead from remote -function git_prompt_ahead() { - if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then - echo "$ZSH_THEME_GIT_PROMPT_AHEAD" - fi -} - # Gets the number of commits ahead from remote function git_commits_ahead() { if $(echo "$(command git log @{upstream}..HEAD 2> /dev/null)" | grep '^commit' &> /dev/null); then @@ -74,6 +67,29 @@ function git_commits_ahead() { fi } +# Outputs if current branch is ahead of remote +function git_prompt_ahead() { + if [[ -n "$(command git rev-list origin/$(current_branch)..HEAD 2> /dev/null)" ]]; then + echo "$ZSH_THEME_GIT_PROMPT_AHEAD" + fi +} + +# Outputs if current branch is behind remote +function git_prompt_behind() { + if [[ -n "$(command git rev-list HEAD..origin/$(current_branch) 2> /dev/null)" ]]; then + echo "$ZSH_THEME_GIT_PROMPT_BEHIND" + fi +} + +# Outputs if current branch exists on remote or not +function git_prompt_remote() { + if [[ -n "$(command git show-ref origin/$(current_branch) 2> /dev/null)" ]]; then + echo "$ZSH_THEME_GIT_PROMPT_REMOTE_EXISTS" + else + echo "$ZSH_THEME_GIT_PROMPT_REMOTE_MISSING" + fi +} + # Formats prompt string for current git commit short SHA function git_prompt_short_sha() { SHA=$(command git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" -- cgit v1.2.3-70-g09d2 From 2fb326513a9e2cec473cff88669da890ad4ae834 Mon Sep 17 00:00:00 2001 From: Dan Mills Date: Wed, 10 Jun 2015 15:49:47 -0700 Subject: Only load url-quote-magic if it is available. Partially fixes #3614 --- lib/misc.zsh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/misc.zsh b/lib/misc.zsh index 0b7cb2696..92e336b64 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -1,6 +1,10 @@ -## smart urls -autoload -U url-quote-magic -zle -N self-insert url-quote-magic +## Load smart urls if available +for d in $fpath; do + if [[ -e "$d/url-quote-magic"]]; then + autoload -U url-quote-magic + zle -N self-insert url-quote-magic + fi +done ## jobs setopt long_list_jobs -- cgit v1.2.3-70-g09d2 From f66a54fb7862b396e3fc09e7041ca6fee4b42a4a Mon Sep 17 00:00:00 2001 From: Ali Afshar Date: Sun, 14 Jun 2015 22:29:11 -0700 Subject: Add missing space causing parse error. --- lib/misc.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/misc.zsh b/lib/misc.zsh index e90836475..6d1a64e8d 100644 --- a/lib/misc.zsh +++ b/lib/misc.zsh @@ -1,6 +1,6 @@ ## Load smart urls if available for d in $fpath; do - if [[ -e "$d/url-quote-magic"]]; then + if [[ -e "$d/url-quote-magic" ]]; then autoload -U url-quote-magic zle -N self-insert url-quote-magic fi -- cgit v1.2.3-70-g09d2 From 90ea67edf0982923f82905d87bda5b685089f219 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Fri, 31 Jul 2015 22:23:12 -0400 Subject: termsupport: protect title() with `emulate -L zsh` This prevents it from malfunctioning when `setopt prompt_subst` is off. --- lib/termsupport.zsh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index e1c2e2f93..973c4dcf6 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -7,6 +7,9 @@ # (In screen, only short_tab_title is used) # Limited support for Apple Terminal (Terminal can't set window and tab separately) function title { + emulate -L zsh + setopt prompt_subst + [[ "$EMACS" == *term* ]] && return # if $2 is unset use $1 as default -- cgit v1.2.3-70-g09d2 From 2d0bfcf81846ea4cb0fe2a42f3dac7f2c60e77b7 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 5 Aug 2015 00:27:51 +0200 Subject: Implement cross-platform open function open_command() For now this supports: - Mac OS X - Linux (presumably works on all versions) - Cygwin (Windows) --- lib/functions.zsh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib') diff --git a/lib/functions.zsh b/lib/functions.zsh index 17f5f9cbf..0d632a268 100644 --- a/lib/functions.zsh +++ b/lib/functions.zsh @@ -15,6 +15,22 @@ function take() { cd $1 } +function open_command() { + local open_cmd + + # define the open command + case "$OSTYPE" in + darwin*) open_cmd="open" ;; + cygwin*) open_cmd="cygstart" ;; + linux*) open_cmd="xdg-open" ;; + *) echo "Platform $OSTYPE not supported" + return 1 + ;; + esac + + nohup $open_cmd "$@" &>/dev/null +} + # # Get the value of an alias. # -- cgit v1.2.3-70-g09d2 From 17da983442f8872e147381db215266735751abc8 Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Sun, 9 Aug 2015 15:15:12 -0400 Subject: termsupport: avoid repeated dir in window title in Terminal.app --- lib/termsupport.zsh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh index e1c2e2f93..ecca516f2 100644 --- a/lib/termsupport.zsh +++ b/lib/termsupport.zsh @@ -23,6 +23,10 @@ function title { 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 + ZSH_THEME_TERM_TITLE_IDLE="%n@%m" +fi # Runs before showing the prompt function omz_termsupport_precmd { -- cgit v1.2.3-70-g09d2