mirror of
https://github.com/dcarrillo/prezto.git
synced 2024-12-22 13:58:00 +00:00
Use command_not_found_handler to change to the previous directory
This commit is contained in:
parent
c091f71283
commit
8d9ec24335
@ -22,7 +22,11 @@ Aliases
|
|||||||
-------
|
-------
|
||||||
|
|
||||||
- `d` prints the contents of the directory stack.
|
- `d` prints the contents of the directory stack.
|
||||||
- `1 ... 9` changes the directory to the **n** previous one.
|
|
||||||
|
Functions
|
||||||
|
---------
|
||||||
|
|
||||||
|
- `command_not_found_handler` changes the directory to the **n** previous one.
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
-------
|
-------
|
||||||
|
13
modules/directory/functions/command_not_found_handler
Normal file
13
modules/directory/functions/command_not_found_handler
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#
|
||||||
|
# Changes the directory to the n previous one.
|
||||||
|
#
|
||||||
|
# Authors:
|
||||||
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
|
#
|
||||||
|
|
||||||
|
if [[ "$1" == [[:digit:]]## ]]; then
|
||||||
|
builtin cd "+$1"
|
||||||
|
else
|
||||||
|
return 127
|
||||||
|
fi
|
||||||
|
|
@ -27,5 +27,4 @@ unsetopt CLOBBER # Do not overwrite existing files with > and >>.
|
|||||||
#
|
#
|
||||||
|
|
||||||
alias d='dirs -v'
|
alias d='dirs -v'
|
||||||
for index ({1..9}) alias "$index"="cd +${index}"; unset index
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user