Persist dirstack across sessions
This commit is contained in:
parent
4f19700919
commit
cc93645f10
3 changed files with 32 additions and 0 deletions
|
@ -24,6 +24,15 @@ Aliases
|
|||
- `d` prints the contents of the directory stack.
|
||||
- `1 ... 9` changes the directory to the **n** previous one.
|
||||
|
||||
Settings
|
||||
--------
|
||||
|
||||
### Persist Dirstack
|
||||
|
||||
To persist the dirstack across sessions, add the following to *zpreztorc*:
|
||||
|
||||
zstyle ':prezto:module:directory' persist-dirstack 'yes'
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
|
|
|
@ -28,3 +28,19 @@ unsetopt CLOBBER # Do not overwrite existing files with > and >>.
|
|||
|
||||
alias d='dirs -v'
|
||||
for index ({1..9}) alias "$index"="cd +${index}"; unset index
|
||||
|
||||
if (is-at-least 4.1) \
|
||||
&& zstyle -t ':prezto:module:directory' persist-dirstack
|
||||
then
|
||||
if [[ -f ~/.zdirs ]] && [[ ${#dirstack[*]} -eq 0 ]]; then
|
||||
echo "\n" >> ~/.zdirs
|
||||
dirstack=( ${(uf)"$(< ~/.zdirs)"//"$HOME"[[:space:]]/} )
|
||||
fi
|
||||
|
||||
function _persist_dirstack {
|
||||
dirs -pl >! ~/.zdirs
|
||||
}
|
||||
|
||||
autoload -Uz add-zsh-hook
|
||||
add-zsh-hook chpwd _persist_dirstack
|
||||
fi
|
||||
|
|
|
@ -41,6 +41,13 @@ zstyle ':prezto:load' pmodule \
|
|||
# Set the query found color.
|
||||
# zstyle ':prezto:module:autosuggestions:color' found ''
|
||||
|
||||
#
|
||||
# Directory
|
||||
#
|
||||
|
||||
# Persist dirstack
|
||||
# zstyle ':prezto:module:directory' persist-dirstack 'yes'
|
||||
|
||||
#
|
||||
# Editor
|
||||
#
|
||||
|
|
Loading…
Add table
Reference in a new issue