From 76c102944c8c164f2cf8908712b6c6a1d9fe5d70 Mon Sep 17 00:00:00 2001 From: Ilyes Kechidi Date: Wed, 23 Nov 2016 02:21:18 +0100 Subject: added a transfer.sh plugin created a function to easily upload files to transfer.sh file sharing site Usage : transfer file.txt --- plugins/transfer/transfer.plugin.zsh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 plugins/transfer/transfer.plugin.zsh diff --git a/plugins/transfer/transfer.plugin.zsh b/plugins/transfer/transfer.plugin.zsh new file mode 100644 index 000000000..7d0d84bea --- /dev/null +++ b/plugins/transfer/transfer.plugin.zsh @@ -0,0 +1,7 @@ +# transfer.sh Easy file sharing from the command line +# transfer Plugin +# Usage Example : +# > transfer file.txt + +transfer() { if [ $# -eq 0 ]; then echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi +tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; } \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 8013d3d8a933b6bae3ed9ceb37bebb42cf28ea56 Mon Sep 17 00:00:00 2001 From: Ilyes Kechidi Date: Tue, 7 Feb 2017 14:40:21 +0100 Subject: added README for transfer.sh plugin --- plugins/transfer/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 plugins/transfer/README.md diff --git a/plugins/transfer/README.md b/plugins/transfer/README.md new file mode 100644 index 000000000..e14b94aa9 --- /dev/null +++ b/plugins/transfer/README.md @@ -0,0 +1,7 @@ +# `transfer.sh` plugin +transfer.sh is an easy file sharing service from the command line + +## Usage +Example +> transfer file.txt + -- cgit v1.2.3-70-g09d2 From 845fdfaae0a913143d1ff03220a1bf1596871225 Mon Sep 17 00:00:00 2001 From: Ilyes Kechidi Date: Thu, 9 Feb 2017 02:28:33 +0100 Subject: replaced transfer function with @nl5887 version --- plugins/transfer/transfer.plugin.zsh | 62 ++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/plugins/transfer/transfer.plugin.zsh b/plugins/transfer/transfer.plugin.zsh index 7d0d84bea..796faa9a2 100644 --- a/plugins/transfer/transfer.plugin.zsh +++ b/plugins/transfer/transfer.plugin.zsh @@ -2,6 +2,64 @@ # transfer Plugin # Usage Example : # > transfer file.txt +# > transfer directory/ -transfer() { if [ $# -eq 0 ]; then echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi -tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; } \ No newline at end of file + + +# Author: +# Remco Verhoef +# https://gist.github.com/nl5887/a511f172d3fb3cd0e42d +# + +curl --version 2>&1 > /dev/null +if [ $? -ne 0 ]; then + echo "Could not find curl." + return 1 +fi + +transfer() { + # check arguments + if [ $# -eq 0 ]; + then + echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md" + return 1 + fi + + # get temporarily filename, output is written to this file show progress can be showed + tmpfile=$( mktemp -t transferXXX ) + + # upload stdin or file + file=$1 + + if tty -s; + then + basefile=$(basename "$file" | sed -e 's/[^a-zA-Z0-9._-]/-/g') + + if [ ! -e $file ]; + then + echo "File $file doesn't exists." + return 1 + fi + + if [ -d $file ]; + then + # zip directory and transfer + zipfile=$( mktemp -t transferXXX.zip ) + cd $(dirname $file) && zip -r -q - $(basename $file) >> $zipfile + curl --progress-bar --upload-file "$zipfile" "https://transfer.sh/$basefile.zip" >> $tmpfile + rm -f $zipfile + else + # transfer file + curl --progress-bar --upload-file "$file" "https://transfer.sh/$basefile" >> $tmpfile + fi + else + # transfer pipe + curl --progress-bar --upload-file "-" "https://transfer.sh/$file" >> $tmpfile + fi + + # cat output link + cat $tmpfile + + # cleanup + rm -f $tmpfile +} \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 6cefe70ffc8f5d827a9b4341129114a843ceb248 Mon Sep 17 00:00:00 2001 From: Ilyes Kechidi Date: Thu, 9 Feb 2017 02:29:24 +0100 Subject: updated transfer README.md --- plugins/transfer/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/transfer/README.md b/plugins/transfer/README.md index e14b94aa9..9bf488d4e 100644 --- a/plugins/transfer/README.md +++ b/plugins/transfer/README.md @@ -4,4 +4,5 @@ transfer.sh is an easy file sharing service from the command line ## Usage Example > transfer file.txt +> transfer directory/ -- cgit v1.2.3-70-g09d2 From c36474b7dfbe19c0628f6f21d8da40b535eeb5fb Mon Sep 17 00:00:00 2001 From: Ilyes Kechidi Date: Thu, 9 Feb 2017 19:41:09 +0100 Subject: modified the script to use tar command instead of zip --- plugins/transfer/transfer.plugin.zsh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/transfer/transfer.plugin.zsh b/plugins/transfer/transfer.plugin.zsh index 796faa9a2..7a7cd85ec 100644 --- a/plugins/transfer/transfer.plugin.zsh +++ b/plugins/transfer/transfer.plugin.zsh @@ -9,6 +9,7 @@ # Author: # Remco Verhoef # https://gist.github.com/nl5887/a511f172d3fb3cd0e42d +# Modified to use tar command instead of zip # curl --version 2>&1 > /dev/null @@ -43,11 +44,12 @@ transfer() { if [ -d $file ]; then - # zip directory and transfer - zipfile=$( mktemp -t transferXXX.zip ) - cd $(dirname $file) && zip -r -q - $(basename $file) >> $zipfile - curl --progress-bar --upload-file "$zipfile" "https://transfer.sh/$basefile.zip" >> $tmpfile - rm -f $zipfile + echo $file + # tar directory and transfer + tarfile=$( mktemp -t transferXXX.tar.gz ) + cd $(dirname $file) && tar -czf $tarfile $(basename $file) + curl --progress-bar --upload-file "$tarfile" "https://transfer.sh/$basefile.tar.gz" >> $tmpfile + rm -f $tarfile else # transfer file curl --progress-bar --upload-file "$file" "https://transfer.sh/$basefile" >> $tmpfile -- cgit v1.2.3-70-g09d2 From 2956e7820ee1dd7111084a291722c12aea01bb5c Mon Sep 17 00:00:00 2001 From: Lorenzo Bolla Date: Sun, 20 May 2018 13:46:27 +0100 Subject: Fix 6843 Cache kubectl completion script to file to speed up sourcing --- plugins/kubectl/kubectl.plugin.zsh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index ec1321d8b..f4062186a 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -2,8 +2,15 @@ # # Author: https://github.com/pstadler +KUBECTL_COMPLETION_FILENAME="$TMPPREFIX-kubectl-completion-zsh" + +if [[ ! -f "$KUBECTL_COMPLETION_FILENAME" ]] +then + kubectl completion zsh > "$KUBECTL_COMPLETION_FILENAME" +fi + if [ $commands[kubectl] ]; then - source <(kubectl completion zsh) + source "$KUBECTL_COMPLETION_FILENAME" fi # This command is used ALOT both below and in daily life -- cgit v1.2.3-70-g09d2 From ee96d0cf9634f25abb69a5cec68073a015dab0a5 Mon Sep 17 00:00:00 2001 From: Lorenzo Bolla Date: Mon, 21 May 2018 00:01:55 +0100 Subject: Fix 6840 Check emacsclient version instead of emacs's (#6841) This is much faster. --- plugins/emacs/emacs.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh index c102a5a1e..db0ab13af 100644 --- a/plugins/emacs/emacs.plugin.zsh +++ b/plugins/emacs/emacs.plugin.zsh @@ -10,7 +10,7 @@ # - Configuration changes made at runtime are applied to all frames. -if "$ZSH/tools/require_tool.sh" emacs 24 2>/dev/null ; then +if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh" # set EDITOR if not already defined. -- cgit v1.2.3-70-g09d2 From 2642f0a8b4d037cd178356132e5dc59c9e90c631 Mon Sep 17 00:00:00 2001 From: Chuan Jin Date: Mon, 21 May 2018 01:02:53 +0200 Subject: Add git log with date (#6789) --- plugins/git/git.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index fd55be138..34598fb35 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -181,6 +181,8 @@ alias glgga='git log --graph --decorate --all' alias glgm='git log --graph --max-count=10' alias glo='git log --oneline --decorate' alias glol="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'" +alias glod="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'" +alias glods="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short" alias glola="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all" alias glog='git log --oneline --decorate --graph' alias gloga='git log --oneline --decorate --graph --all' -- cgit v1.2.3-70-g09d2 From 8f3737f45b4c3c05e1488a28f79c6bc29ad8fb32 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 23 May 2018 11:33:34 +0200 Subject: Revert fbcda4d The PROMPT building method clashes with other themes and plugins that modify the PROMPT variable. Also reverted the $jobstates trick due to it not working inside $PROMPT. --- themes/agnoster.zsh-theme | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) mode change 100755 => 100644 themes/agnoster.zsh-theme diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme old mode 100755 new mode 100644 index 292551f44..b0a794f4d --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -29,7 +29,6 @@ # A few utility functions to make it easy and re-usable to draw segmented prompts CURRENT_BG='NONE' -zmodload zsh/parameter # Special Powerline characters @@ -56,23 +55,23 @@ prompt_segment() { [[ -n $1 ]] && bg="%K{$1}" || bg="%k" [[ -n $2 ]] && fg="%F{$2}" || fg="%f" if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then - PROMPT+=" %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} " + echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} " else - PROMPT+="%{$bg%}%{$fg%} " + echo -n "%{$bg%}%{$fg%} " fi CURRENT_BG=$1 - [[ -n $3 ]] && PROMPT+=$3 + [[ -n $3 ]] && echo -n $3 } # End the prompt, closing any open segments prompt_end() { if [[ -n $CURRENT_BG ]]; then - PROMPT+=" %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR" + echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR" else - PROMPT+="%{%k%}" + echo -n "%{%k%}" fi - PROMPT+="%{%f%}" - CURRENT_BG='NONE' + echo -n "%{%f%}" + CURRENT_BG='' } ### Prompt components @@ -124,7 +123,7 @@ prompt_git() { zstyle ':vcs_info:*' formats ' %u%c' zstyle ':vcs_info:*' actionformats ' %u%c' vcs_info - PROMPT+="${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}" + echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}" fi } @@ -136,15 +135,15 @@ prompt_bzr() { revision=`bzr log | head -n2 | tail -n1 | sed 's/^revno: //'` if [[ $status_mod -gt 0 ]] ; then prompt_segment yellow black - PROMPT+="bzr@$revision ✚ " + echo -n "bzr@"$revision "✚ " else if [[ $status_all -gt 0 ]] ; then prompt_segment yellow black - PROMPT+="bzr@$revision" + echo -n "bzr@"$revision else prompt_segment green black - PROMPT+="bzr@$revision" + echo -n "bzr@"$revision fi fi fi @@ -158,30 +157,30 @@ prompt_hg() { if [[ $(hg prompt "{status|unknown}") = "?" ]]; then # if files are not added prompt_segment red white - st=' ±' + st='±' elif [[ -n $(hg prompt "{status|modified}") ]]; then # if any modification prompt_segment yellow black - st=' ±' + st='±' else # if working copy is clean prompt_segment green black fi - PROMPT+="$(hg prompt "☿ {rev}@{branch}")$st" + echo -n $(hg prompt "☿ {rev}@{branch}") $st else st="" rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g') branch=$(hg id -b 2>/dev/null) if `hg st | grep -q "^\?"`; then prompt_segment red black - st=' ±' + st='±' elif `hg st | grep -q "^[MA]"`; then prompt_segment yellow black - st=' ±' + st='±' else prompt_segment green black fi - PROMPT+="☿ $rev@$branch$st" + echo -n "☿ $rev@$branch" $st fi fi } @@ -208,7 +207,7 @@ prompt_status() { symbols=() [[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘" [[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡" - [[ ${#jobstates} -ne 0 ]] && symbols+="%{%F{cyan}%}⚙" + [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙" [[ -n "$symbols" ]] && prompt_segment black default "$symbols" } @@ -216,7 +215,6 @@ prompt_status() { ## Main prompt build_prompt() { RETVAL=$? - PROMPT='%{%f%b%k%}' prompt_status prompt_virtualenv prompt_context @@ -225,8 +223,6 @@ build_prompt() { prompt_bzr prompt_hg prompt_end - PROMPT+=' ' } -autoload -U add-zsh-hook -add-zsh-hook precmd build_prompt +PROMPT='%{%f%b%k%}$(build_prompt) ' -- cgit v1.2.3-70-g09d2 From 3d8ee47c7a55119318d698a90f523e04fffb878d Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Fri, 25 May 2018 20:44:56 +0200 Subject: Update README formatting --- plugins/transfer/README.md | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/plugins/transfer/README.md b/plugins/transfer/README.md index 9bf488d4e..5fa064445 100644 --- a/plugins/transfer/README.md +++ b/plugins/transfer/README.md @@ -1,8 +1,24 @@ -# `transfer.sh` plugin -transfer.sh is an easy file sharing service from the command line +# `transfer` plugin + +[`transfer.sh`](https://transfer.sh) is an easy to use file sharing service from the command line ## Usage -Example -> transfer file.txt -> transfer directory/ +Add `transfer` to your plugins array in your zshrc file: +```zsh +plugins=(... transfer) +``` + +Then you can: + +- transfer a file: + +```zsh +transfer file.txt +``` + +- transfer a whole directory (it will be automatically compressed): + +```zsh +transfer directory/ +``` -- cgit v1.2.3-70-g09d2 From de8ef8286a88f82976bb6d4c89de0757272c7bcc Mon Sep 17 00:00:00 2001 From: Nathan Robinson Date: Fri, 25 May 2018 23:46:18 -0400 Subject: Remove po alias https://github.com/robbyrussell/oh-my-zsh/issues/6761 --- lib/directories.zsh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/directories.zsh b/lib/directories.zsh index a50a692c8..14064b86f 100644 --- a/lib/directories.zsh +++ b/lib/directories.zsh @@ -28,7 +28,3 @@ alias lsa='ls -lah' alias l='ls -lah' alias ll='ls -lh' alias la='ls -lAh' - -# Push and pop directories on directory stack -alias pu='pushd' -alias po='popd' -- cgit v1.2.3-70-g09d2 From 9b11b7e9388dc8c736c321e56e29440dedfa6152 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 26 May 2018 18:25:47 +0200 Subject: Update logic to follow npm plugin convention --- plugins/kubectl/kubectl.plugin.zsh | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/plugins/kubectl/kubectl.plugin.zsh b/plugins/kubectl/kubectl.plugin.zsh index f4062186a..c4e30dacd 100644 --- a/plugins/kubectl/kubectl.plugin.zsh +++ b/plugins/kubectl/kubectl.plugin.zsh @@ -1,16 +1,13 @@ -# Autocompletion for kubectl, the command line interface for Kubernetes -# -# Author: https://github.com/pstadler +if (( $+commands[kubectl] )); then + __KUBECTL_COMPLETION_FILE="${ZSH_CACHE_DIR}/kubectl_completion" -KUBECTL_COMPLETION_FILENAME="$TMPPREFIX-kubectl-completion-zsh" + if [[ ! -f $__KUBECTL_COMPLETION_FILE ]]; then + kubectl completion zsh >! $__KUBECTL_COMPLETION_FILE + fi -if [[ ! -f "$KUBECTL_COMPLETION_FILENAME" ]] -then - kubectl completion zsh > "$KUBECTL_COMPLETION_FILENAME" -fi + [[ -f $__KUBECTL_COMPLETION_FILE ]] && source $__KUBECTL_COMPLETION_FILE -if [ $commands[kubectl] ]; then - source "$KUBECTL_COMPLETION_FILENAME" + unset __KUBECTL_COMPLETION_FILE fi # This command is used ALOT both below and in daily life -- cgit v1.2.3-70-g09d2 From d6aeaad83d73855776f7c937ef51428523295352 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Sat, 26 May 2018 21:09:32 +0430 Subject: [plugin] update NPX docs (#6849) --- plugins/npx/README.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/plugins/npx/README.md b/plugins/npx/README.md index 2c94e4515..1c052930b 100644 --- a/plugins/npx/README.md +++ b/plugins/npx/README.md @@ -11,7 +11,21 @@ This plugin automatically registers npx command-not-found handler if `npx` exist plugins=(.... npx) ``` -- Globally install npx binary (you need node.js installed too!) +- Globally install npx binary (npx will be auto installed with recent versions of Node.js) ```bash sudo npm install -g npx -``` \ No newline at end of file +``` + +## Note + +The shell auto-fallback doesn't auto-install plain packages. In order to get it to install something, you need to add `@`: + +``` +➜ jasmine@latest # or just `jasmine@` +npx: installed 13 in 1.896s +Randomized with seed 54385 +Started +``` + +It does it this way so folks using the fallback don't accidentally try to install regular typoes. + -- cgit v1.2.3-70-g09d2 From c09783c2554e505cc04ef0fc7465341475050947 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 26 May 2018 19:02:03 +0200 Subject: Revert "unset chpwd_functions before running cd ... (#6830)" This reverts commit 3dab7e46e8815838c8099040e11a7ae9a30ba03d. --- plugins/shrink-path/shrink-path.plugin.zsh | 5 ----- 1 file changed, 5 deletions(-) diff --git a/plugins/shrink-path/shrink-path.plugin.zsh b/plugins/shrink-path/shrink-path.plugin.zsh index 6dd6a930f..f111962a5 100644 --- a/plugins/shrink-path/shrink-path.plugin.zsh +++ b/plugins/shrink-path/shrink-path.plugin.zsh @@ -94,11 +94,6 @@ shrink_path () { (( tilde )) && dir=${dir/$HOME/\~} tree=(${(s:/:)dir}) ( - # unset chpwd_functions since we'll be calling `cd` and don't - # want any side-effects (eg., if the user was using auto-ls) - chpwd_functions=() - # unset chpwd since even if chpwd_functions is (), zsh will - # attempt to execute chpwd unfunction chpwd 2> /dev/null if [[ $tree[1] == \~* ]] { cd ${~tree[1]} -- cgit v1.2.3-70-g09d2 From 66cb4005ab6cfcd6b092c1b482e767af214e83bb Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Wed, 1 Mar 2017 15:32:00 -0800 Subject: Update shrink-path to use cd -q for bypassing the chpwd callbacks --- plugins/shrink-path/shrink-path.plugin.zsh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/shrink-path/shrink-path.plugin.zsh b/plugins/shrink-path/shrink-path.plugin.zsh index f111962a5..e7eed1705 100644 --- a/plugins/shrink-path/shrink-path.plugin.zsh +++ b/plugins/shrink-path/shrink-path.plugin.zsh @@ -94,13 +94,12 @@ shrink_path () { (( tilde )) && dir=${dir/$HOME/\~} tree=(${(s:/:)dir}) ( - unfunction chpwd 2> /dev/null if [[ $tree[1] == \~* ]] { - cd ${~tree[1]} + cd -q ${~tree[1]} result=$tree[1] shift tree } else { - cd / + cd -q / } for dir in $tree; { if (( lastfull && $#tree == 1 )) { @@ -117,7 +116,7 @@ shrink_path () { (( short )) && break done result+="/$part" - cd $dir + cd -q $dir shift tree } echo ${result:-/} -- cgit v1.2.3-70-g09d2 From 5896c87155f9346a2926786c6d578d0a5696d712 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 26 May 2018 19:31:17 +0200 Subject: shrink-path: match only the beginning of the directory (#6862) Fixes #6317 --- plugins/shrink-path/shrink-path.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/shrink-path/shrink-path.plugin.zsh b/plugins/shrink-path/shrink-path.plugin.zsh index e7eed1705..29e6f0deb 100644 --- a/plugins/shrink-path/shrink-path.plugin.zsh +++ b/plugins/shrink-path/shrink-path.plugin.zsh @@ -88,10 +88,10 @@ shrink_path () { if (( named )) { for part in ${(k)nameddirs}; { - [[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/${nameddirs[$part]}/\~$part} + [[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/#${nameddirs[$part]}/\~$part} } } - (( tilde )) && dir=${dir/$HOME/\~} + (( tilde )) && dir=${dir/#$HOME/\~} tree=(${(s:/:)dir}) ( if [[ $tree[1] == \~* ]] { -- cgit v1.2.3-70-g09d2 From 90a5bd06ca76aff04f76a5d43a432ed9340dd78d Mon Sep 17 00:00:00 2001 From: Lorenzo Bolla Date: Sat, 26 May 2018 19:44:49 +0100 Subject: Prefer virtualenvwrapper_lazy (#6842) This gives much faster start up times and only loads virtualenvwrapper when needed. Fix #6839 --- plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh index 484f18c91..2a7c0b92a 100644 --- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh +++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh @@ -1,6 +1,14 @@ virtualenvwrapper='virtualenvwrapper.sh' +virtualenvwrapper_lazy='virtualenvwrapper_lazy.sh' -if (( $+commands[$virtualenvwrapper] )); then +if (( $+commands[$virtualenvwrapper_lazy] )); then + function { + setopt local_options + unsetopt equals + virtualenvwrapper=${${virtualenvwrapper_lazy}:c} + source ${${virtualenvwrapper_lazy}:c} + } +elif (( $+commands[$virtualenvwrapper] )); then function { setopt local_options unsetopt equals -- cgit v1.2.3-70-g09d2 From 77b924b8394344175aab0c4d78bec670ef721d93 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Sat, 26 May 2018 21:23:35 +0200 Subject: Give more helpful message and disable purge of caches This error message will give information on what exactly has happened and how to either solve ownership and permissions or disable the check entirely. Also gets rid of the purge of compinit caches since with the current logic insecure completion directories are ignored and therefore haven't tainted the cached files. --- lib/compfix.zsh | 44 ++++++++++++++------------------------------ 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/lib/compfix.zsh b/lib/compfix.zsh index 208aaadb1..68decc1ed 100644 --- a/lib/compfix.zsh +++ b/lib/compfix.zsh @@ -2,10 +2,6 @@ # insecure ownership or permissions) by: # # * Human-readably notifying the user of these insecurities. -# * Moving away all existing completion caches to a temporary directory. Since -# any of these caches may have been generated from insecure directories, they -# are all suspect now. Failing to do so typically causes subsequent compinit() -# calls to fail with "command not found: compdef" errors. (That's bad.) function handle_completion_insecurities() { # List of the absolute paths of all unique insecure directories, split on # newline from compaudit()'s output resembling: @@ -22,39 +18,27 @@ function handle_completion_insecurities() { insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} ) # If no such directories exist, get us out of here. - if (( ! ${#insecure_dirs} )); then - print "[oh-my-zsh] No insecure completion-dependent directories detected." - return - fi + (( ! ${#insecure_dirs} )) && return # List ownership and permissions of all insecure directories. print "[oh-my-zsh] Insecure completion-dependent directories detected:" ls -ld "${(@)insecure_dirs}" - print "[oh-my-zsh] For safety, completions will be disabled until you manually fix all" - print "[oh-my-zsh] insecure directory permissions and ownership and restart oh-my-zsh." - print "[oh-my-zsh] See the above list for directories with group or other writability.\n" - # Locally enable the "NULL_GLOB" option, thus removing unmatched filename - # globs from argument lists *AND* printing no warning when doing so. Failing - # to do so prints an unreadable warning if no completion caches exist below. - setopt local_options null_glob + cat < Date: Sat, 26 May 2018 21:26:49 +0200 Subject: Always load secure completion directories --- oh-my-zsh.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh index c0e2ba8f6..72527362f 100644 --- a/oh-my-zsh.sh +++ b/oh-my-zsh.sh @@ -63,15 +63,14 @@ if [ -z "$ZSH_COMPDUMP" ]; then fi if [[ $ZSH_DISABLE_COMPFIX != true ]]; then - # If completion insecurities exist, warn the user without enabling completions. + # If completion insecurities exist, warn the user if ! compaudit &>/dev/null; then - # This function resides in the "lib/compfix.zsh" script sourced above. handle_completion_insecurities - # Else, enable and cache completions to the desired file. - else - compinit -d "${ZSH_COMPDUMP}" fi + # Load only from secure directories + compinit -i -d "${ZSH_COMPDUMP}" else + # If the user wants it, load from all found directories compinit -u -d "${ZSH_COMPDUMP}" fi -- cgit v1.2.3-70-g09d2 From 8bbef9180e3ba16e717a9587d0c965ab901c1226 Mon Sep 17 00:00:00 2001 From: Erwan ROUSSEL Date: Sat, 26 May 2018 22:22:22 +0200 Subject: Npm's plugin documentation (#6864) * Documentation for Npm plugin added * Fix style and add alias descriptions --- plugins/npm/README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 plugins/npm/README.md diff --git a/plugins/npm/README.md b/plugins/npm/README.md new file mode 100644 index 000000000..202e2b0a4 --- /dev/null +++ b/plugins/npm/README.md @@ -0,0 +1,26 @@ +## npm plugin + +The npm plugin provides completion as well as adding many useful aliases. + +To use it, add npm to the plugins array of your zshrc file: +``` +plugins=(... npm) +``` + +## Aliases + +| Alias | Command | Descripton | +|:------ |:-----------------------------|:----------------------------------------------------------------| +| `npmg` | `npm i -g` | Install dependencies globally | +| `npmS` | `npm i -S` | Install and save to dependencies in your package.json | +| `npmD` | `npm i -D` | Install and save to dev-dependencies in your package.json | +| `npmE` | `PATH="$(npm bin)":"$PATH"` | Run command from node_modules folder based on current directory | +| `npmO` | `npm outdated` | Check which npm modules are outdated | +| `npmV` | `npm -v` | Check package versions | +| `npmL` | `npm list` | List installed packages | +| `npmL0` | `npm ls --depth=0` | List top-level installed packages | +| `npmst` | `npm start` | Run npm start | +| `npmt` | `npm test` | Run npm test | +| `npmR` | `npm run` | Run npm scripts | +| `npmP` | `npm publish` | Run npm publish | +| `npmI` | `npm init` | Run npm init | -- cgit v1.2.3-70-g09d2 From ce2890bef95b4b0a5b14ed8dd50ad2f78f8dee72 Mon Sep 17 00:00:00 2001 From: Michael Fladischer Date: Mon, 28 May 2018 11:23:05 +0200 Subject: [plugins/vundle] Use HTTPS to clone repository. (#6857) The git protocol is likely to be blocked in some networks while HTTPS usually works. --- plugins/vundle/vundle.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/vundle/vundle.plugin.zsh b/plugins/vundle/vundle.plugin.zsh index 0f071597a..c84cacd0e 100644 --- a/plugins/vundle/vundle.plugin.zsh +++ b/plugins/vundle/vundle.plugin.zsh @@ -6,7 +6,7 @@ function vundle-init () { if [ ! -d ~/.vim/bundle/Vundle.vim/.git ] && [ ! -f ~/.vim/bundle/Vundle.vim/.git ] then - git clone git://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim + git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim echo "\n\tRead about vim configuration for vundle at https://github.com/VundleVim/Vundle.vim\n" fi } -- cgit v1.2.3-70-g09d2 From ebda8af870acc295388ed187f0139a8bffa83196 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 28 May 2018 17:09:53 +0200 Subject: Clarify ssh-agent settings position --- plugins/ssh-agent/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/ssh-agent/README.md b/plugins/ssh-agent/README.md index 00af42f01..85d8c8a85 100644 --- a/plugins/ssh-agent/README.md +++ b/plugins/ssh-agent/README.md @@ -11,6 +11,8 @@ plugins=(... ssh-agent) ## Instructions +**IMPORTANT: put these settings _before_ the line that sources oh-my-zsh** + To enable **agent forwarding support** add the following to your zshrc file: ```zsh -- cgit v1.2.3-70-g09d2 From 6ace3cd18dd3cbc0e2631fa98051194b703fe4d7 Mon Sep 17 00:00:00 2001 From: Paul Ossenbruggen Date: Tue, 5 Jun 2018 06:37:20 -0700 Subject: add xx command to Xcode plugin. Allows quick opening of files in Xcode. (#6812) --- plugins/xcode/README.md | 6 +++++- plugins/xcode/xcode.plugin.zsh | 13 ++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/plugins/xcode/README.md b/plugins/xcode/README.md index c12ce047f..37f882638 100644 --- a/plugins/xcode/README.md +++ b/plugins/xcode/README.md @@ -19,7 +19,7 @@ plugins=(... xcode) | xcdd | Purge all temporary build information | rm -rf ~/Library/Developer/Xcode/DerivedData/* | | xcp | Show currently selected Xcode directory | xcode-select --print-path | | xcsel | Select different Xcode directory by path | sudo xcode-select --switch | - +| xx | Opens the files listed in Xcode | open -a "Xcode.app" | ## Functions @@ -29,6 +29,10 @@ plugins=(... xcode) Opens the current directory in Xcode as an Xcode project. This will open one of the `.xcworkspace` and `.xcodeproj` files that it can find in the current working directory. You can also specify a directory to look in for the Xcode files. Returns 1 if it didn't find any relevant files. +### `xx` + +Opens the files listed in Xcode, multiple files are opened in a multi-file browser. + ### `simulator` Opens the iOS Simulator from your command line, dependent on whichever is the active developer directory for Xcode. (That is, it respects the `xcsel` setting.) diff --git a/plugins/xcode/xcode.plugin.zsh b/plugins/xcode/xcode.plugin.zsh index f711c39fb..b46e05f2f 100644 --- a/plugins/xcode/xcode.plugin.zsh +++ b/plugins/xcode/xcode.plugin.zsh @@ -27,6 +27,17 @@ function xc { fi } +# Opens a file or files in the Xcode IDE. Multiple files are opened in multi-file browser +# original author: @possen +function xx { + if [[ $# == 0 ]]; then + echo "Specify file(s) to open in xcode." + return 1 + fi + echo "${xcode_files}" + open -a "Xcode.app" "$@" +} + # "XCode-SELect by Version" - select Xcode by just version number # Uses naming convention: # - different versions of Xcode are named Xcode-.app or stored @@ -70,7 +81,7 @@ function xcselv { function _omz_xcode_print_xcselv_usage { cat << EOF >&2 -Usage: +Usage: xcselv xcselv [options] -- cgit v1.2.3-70-g09d2 From f461d21de1bd0c1394e57a2e3af69778692e4ba4 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Wed, 6 Jun 2018 17:14:19 +0200 Subject: virtualenvwrapper: set $WORKON_HOME if undefined This uses the default that virtualenvwrapper.sh would set if it was called. If the user changes its value after the plugin is loaded, the plugin will work all the same. Fixes #6882 Closes #6870 Closes #6883 --- plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh index 2a7c0b92a..e27c6bb76 100644 --- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh +++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh @@ -7,6 +7,7 @@ if (( $+commands[$virtualenvwrapper_lazy] )); then unsetopt equals virtualenvwrapper=${${virtualenvwrapper_lazy}:c} source ${${virtualenvwrapper_lazy}:c} + [[ -z "$WORKON_HOME" ]] && WORKON_HOME="$HOME/.virtualenvs" } elif (( $+commands[$virtualenvwrapper] )); then function { -- cgit v1.2.3-70-g09d2