4310a15de5d0587ef135f9e12857620c4788dec2

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

Change all pwd calls for $PWD variable

This avoids spawning additional processes as $PWD **always** contains
the current working directory.

Diff

  1diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh
  2index 504d7ec14b3817631b2aff8d36fd8a6c8d227c24..d101cfcae6a435ac0d78398f23cb1aac809a0efc 100644
  3--- a/plugins/dirhistory/dirhistory.plugin.zsh
  4+++ b/plugins/dirhistory/dirhistory.plugin.zsh
  5@@ -3,7 +3,7 @@
  6 #   that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT.
  7 # 
  8 
  9-dirhistory_past=(`pwd`)
 10+dirhistory_past=($PWD)
 11 dirhistory_future=()
 12 export dirhistory_past
 13 export dirhistory_future
 14@@ -50,7 +50,7 @@ function push_future() {
 15 
 16 # Called by zsh when directory changes
 17 function chpwd() {
 18-  push_past `pwd`
 19+  push_past $PWD
 20   # If DIRHISTORY_CD is not set...
 21   if [[ -z "${DIRHISTORY_CD+x}" ]]; then
 22     # ... clear future.
 23@@ -73,7 +73,7 @@ function dirhistory_back() {
 24   pop_past cw 
 25   if [[ "" == "$cw" ]]; then
 26     # Someone overwrote our variable. Recover it.
 27-    dirhistory_past=(`pwd`)
 28+    dirhistory_past=($PWD)
 29     return
 30   fi
 31 
 32diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh
 33index 1b23b5d427937f103ec948a09735b63952fbf8ab..b16814fe4d12b9935a046e745ab46169090c3446 100644
 34--- a/plugins/jump/jump.plugin.zsh
 35+++ b/plugins/jump/jump.plugin.zsh
 36@@ -14,12 +14,12 @@ jump() {
 37 
 38 mark() {
 39 	if (( $# == 0 )); then
 40-		MARK=$(basename "$(pwd)")
 41+		MARK=$(basename "$PWD")
 42 	else
 43 		MARK="$1"
 44 	fi
 45-	if read -q \?"Mark $(pwd) as ${MARK}? (y/n) "; then
 46-		mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$MARK"
 47+	if read -q \?"Mark $PWD as ${MARK}? (y/n) "; then
 48+		mkdir -p "$MARKPATH"; ln -s "$PWD" "$MARKPATH/$MARK"
 49 	fi
 50 }
 51 
 52diff --git a/plugins/pow/pow.plugin.zsh b/plugins/pow/pow.plugin.zsh
 53index d85c8877777a44e57924eda79315fdfae38c9de0..ded3336a738932d250360da7819bc4a1e9f93aa6 100644
 54--- a/plugins/pow/pow.plugin.zsh
 55+++ b/plugins/pow/pow.plugin.zsh
 56@@ -21,13 +21,13 @@
 57 
 58 rack_root(){
 59   setopt chaselinks
 60-  local orgdir="$(pwd)"
 61-  local basedir="$(pwd)"
 62+  local orgdir="$PWD"
 63+  local basedir="$PWD"
 64 
 65   while [[ $basedir != '/' ]]; do
 66     test -e "$basedir/config.ru" && break
 67     builtin cd ".." 2>/dev/null
 68-    basedir="$(pwd)"
 69+    basedir="$PWD"
 70   done
 71 
 72   builtin cd "$orgdir" 2>/dev/null
 73@@ -56,7 +56,7 @@ kapow(){
 74 compctl -W ~/.pow -/ kapow
 75 
 76 powit(){
 77-  local basedir="$(pwd)"
 78+  local basedir="$PWD"
 79   local vhost=$1
 80   [ ! -n "$vhost" ] && vhost=$(rack_root_detect)
 81   if [ ! -h ~/.pow/$vhost ]
 82diff --git a/plugins/svn/svn.plugin.zsh b/plugins/svn/svn.plugin.zsh
 83index ef6da5bd3cb6e6447e59c224fc8a158ecc1ac590..ba281d7909499529a6fcbd4e988078b2f32a22d5 100644
 84--- a/plugins/svn/svn.plugin.zsh
 85+++ b/plugins/svn/svn.plugin.zsh
 86@@ -77,7 +77,7 @@ function svn_dirty() {
 87 
 88 function svn_dirty_choose_pwd () {
 89   if in_svn; then
 90-    root=`pwd`
 91+    root=$PWD
 92     if $(svn status $root 2> /dev/null | grep -Eq '^\s*[ACDIM!?L]'); then
 93       # Grep exits with 0 when "One or more lines were selected", return "dirty".
 94       echo $1
 95diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh
 96index e0b1773ada238a971ecc4d78294c145071ddc5a7..4ae70dfa751dc124c3cb47b83eb1f6c57c34b203 100644
 97--- a/plugins/systemadmin/systemadmin.plugin.zsh
 98+++ b/plugins/systemadmin/systemadmin.plugin.zsh
 99@@ -30,7 +30,7 @@ function retlog() {
100 }
101 
102 alias ping='ping -c 5'
103-alias clr='clear;echo "Currently logged in on $(tty), as $USER in directory $(pwd)."'
104+alias clr='clear;echo "Currently logged in on $(tty), as $USER in directory $PWD."'
105 alias path='echo -e ${PATH//:/\\n}'
106 alias mkdir='mkdir -pv'
107 # get top process eating memory
108diff --git a/plugins/vim-interaction/vim-interaction.plugin.zsh b/plugins/vim-interaction/vim-interaction.plugin.zsh
109index 5142f1f9b586607ec17355c33161ef99c9c486f8..b0b9414cd2aac90e3403418c6b3e38e381cbcc6b 100644
110--- a/plugins/vim-interaction/vim-interaction.plugin.zsh
111+++ b/plugins/vim-interaction/vim-interaction.plugin.zsh
112@@ -9,7 +9,7 @@ function resolveFile
113   if [ -f "$1" ]; then
114     echo $(readlink -f "$1")
115   elif [[ "${1#/}" == "$1" ]]; then
116-    echo "$(pwd)/$1"
117+    echo "$PWD/$1"
118   else
119     echo $1
120   fi