mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-20 03:02:29 +01:00
Using $PWD directly for dirhistory
We can use the $PWD variable instead of executing pwd. This means we do not have to open an extra process on every directory change.
This commit is contained in:
parent
1be7bbbfbe
commit
ed36ba783a
1 changed files with 3 additions and 3 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
# that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT.
|
# that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT.
|
||||||
#
|
#
|
||||||
|
|
||||||
dirhistory_past=(`pwd`)
|
dirhistory_past=($PWD)
|
||||||
dirhistory_future=()
|
dirhistory_future=()
|
||||||
export dirhistory_past
|
export dirhistory_past
|
||||||
export dirhistory_future
|
export dirhistory_future
|
||||||
|
|
@ -50,7 +50,7 @@ function push_future() {
|
||||||
|
|
||||||
# Called by zsh when directory changes
|
# Called by zsh when directory changes
|
||||||
function chpwd() {
|
function chpwd() {
|
||||||
push_past "`pwd`"
|
push_past "$PWD"
|
||||||
# If DIRHISTORY_CD is not set...
|
# If DIRHISTORY_CD is not set...
|
||||||
if [[ -z "${DIRHISTORY_CD+x}" ]]; then
|
if [[ -z "${DIRHISTORY_CD+x}" ]]; then
|
||||||
# ... clear future.
|
# ... clear future.
|
||||||
|
|
@ -73,7 +73,7 @@ function dirhistory_back() {
|
||||||
pop_past cw
|
pop_past cw
|
||||||
if [[ "" == "$cw" ]]; then
|
if [[ "" == "$cw" ]]; then
|
||||||
# Someone overwrote our variable. Recover it.
|
# Someone overwrote our variable. Recover it.
|
||||||
dirhistory_past=(`pwd`)
|
dirhistory_past=($PWD)
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue