mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-08 04:34:00 +02:00
Merge 23f31f39f2 into 5667161d49
This commit is contained in:
commit
98edb9b1f3
2 changed files with 37 additions and 24 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
wd
|
# wd plugin
|
||||||
==
|
|
||||||
|
|
||||||
[](https://travis-ci.org/mfaerevaag/wd)
|
[](https://travis-ci.org/mfaerevaag/wd)
|
||||||
|
|
||||||
|
|
@ -68,6 +67,8 @@ Also, you may have to force a rebuild of `zcompdump` by running:
|
||||||
|
|
||||||
Note, a warp point cannot contain colons, or only consist of only spaces and dots. The first will conflict in how `wd` stores the warp points, and the second will conflict other features, as below.
|
Note, a warp point cannot contain colons, or only consist of only spaces and dots. The first will conflict in how `wd` stores the warp points, and the second will conflict other features, as below.
|
||||||
|
|
||||||
|
You can omit the point name to use the current directory's name instead.
|
||||||
|
|
||||||
* From an other directory (not necessarily), warp to `foo` with:
|
* From an other directory (not necessarily), warp to `foo` with:
|
||||||
|
|
||||||
$ wd foo
|
$ wd foo
|
||||||
|
|
@ -78,12 +79,14 @@ Also, you may have to force a rebuild of `zcompdump` by running:
|
||||||
$ wd ...
|
$ wd ...
|
||||||
|
|
||||||
This is a wrapper for the zsh `dirs` function.
|
This is a wrapper for the zsh `dirs` function.
|
||||||
(You might need `setopt AUTO_PUSHD` in your `.zshrc` if you hare not using [oh-my-zshell](https://github.com/robbyrussell/oh-my-zsh)).
|
(You might need `setopt AUTO_PUSHD` in your `.zshrc` if you are not using [Oh My Zsh](https://github.com/robbyrussell/oh-my-zsh)).
|
||||||
|
|
||||||
* Remove warp point test point:
|
* Remove warp point test point:
|
||||||
|
|
||||||
$ wd rm foo
|
$ wd rm foo
|
||||||
|
|
||||||
|
You can omit the point name to use the current directory's name instead.
|
||||||
|
|
||||||
* List all warp points (stored in `~/.warprc`):
|
* List all warp points (stored in `~/.warprc`):
|
||||||
|
|
||||||
$ wd list
|
$ wd list
|
||||||
|
|
|
||||||
|
|
@ -72,25 +72,28 @@ wd_print_msg()
|
||||||
wd_print_usage()
|
wd_print_usage()
|
||||||
{
|
{
|
||||||
cat <<- EOF
|
cat <<- EOF
|
||||||
Usage: wd [command] <point>
|
Usage: wd [command] [point]
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
add <point> Adds the current working directory to your warp points
|
add <point> Adds the current working directory to your warp points
|
||||||
add! <point> Overwrites existing warp point
|
add Adds the current working directory to your warp points with current directory's name
|
||||||
rm <point> Removes the given warp point
|
add! <point> Overwrites existing warp point
|
||||||
show Print warp points to current directory
|
add! Overwrites existing warp point with current directory's name
|
||||||
show <point> Print path to given warp point
|
rm <point> Removes the given warp point
|
||||||
list Print all stored warp points
|
rm Removes the given warp point with current directory's name
|
||||||
ls <point> Show files from given warp point
|
show <point> Print path to given warp point
|
||||||
path <point> Show the path to given warp point
|
show Print warp points to current directory
|
||||||
clean! Remove points warping to nonexistent directories
|
list Print all stored warp points
|
||||||
|
ls <point> Show files from given warp point (ls)
|
||||||
|
path <point> Show the path to given warp point (pwd)
|
||||||
|
clean! Remove points warping to nonexistent directories
|
||||||
|
|
||||||
-v | --version Print version
|
-v | --version Print version
|
||||||
-d | --debug Exit after execution with exit codes (for testing)
|
-d | --debug Exit after execution with exit codes (for testing)
|
||||||
-c | --config Specify config file (default ~/.warprc)
|
-c | --config Specify config file (default ~/.warprc)
|
||||||
-q | --quiet Suppress all output
|
-q | --quiet Suppress all output
|
||||||
|
|
||||||
help Show this extremely helpful text
|
help Show this extremely helpful text
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -154,6 +157,11 @@ wd_add()
|
||||||
local force=$1
|
local force=$1
|
||||||
local point=$2
|
local point=$2
|
||||||
|
|
||||||
|
if [[ $point == "" ]]
|
||||||
|
then
|
||||||
|
point=$(basename $(pwd))
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $point =~ "^[\.]+$" ]]
|
if [[ $point =~ "^[\.]+$" ]]
|
||||||
then
|
then
|
||||||
wd_exit_fail "Warp point cannot be just dots"
|
wd_exit_fail "Warp point cannot be just dots"
|
||||||
|
|
@ -163,9 +171,6 @@ wd_add()
|
||||||
elif [[ $point == *:* ]]
|
elif [[ $point == *:* ]]
|
||||||
then
|
then
|
||||||
wd_exit_fail "Warp point cannot contain colons"
|
wd_exit_fail "Warp point cannot contain colons"
|
||||||
elif [[ $point == "" ]]
|
|
||||||
then
|
|
||||||
wd_exit_fail "Warp point cannot be empty"
|
|
||||||
elif [[ ${points[$2]} == "" ]] || $force
|
elif [[ ${points[$2]} == "" ]] || $force
|
||||||
then
|
then
|
||||||
wd_remove $point > /dev/null
|
wd_remove $point > /dev/null
|
||||||
|
|
@ -183,7 +188,12 @@ wd_add()
|
||||||
|
|
||||||
wd_remove()
|
wd_remove()
|
||||||
{
|
{
|
||||||
local point=$1
|
local point=$2
|
||||||
|
|
||||||
|
if [[ $point == "" ]]
|
||||||
|
then
|
||||||
|
point=$(basename $(pwd))
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ${points[$point]} != "" ]]
|
if [[ ${points[$point]} != "" ]]
|
||||||
then
|
then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue