wd.plugin.zsh
545 bytes
1#!/usr/bin/env zsh
2
3# WARP DIRECTORY
4# ==============
5# Jump to custom directories in terminal
6# because `cd` takes too long...
7#
8# @github.com/mfaerevaag/wd
9
10# Handle $0 according to the standard:
11# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
120="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
130="${${(M)0:#/*}:-$PWD/$0}"
14
15eval "wd() { source '${0:A:h}/wd.sh' }"
16wd > /dev/null
17zle -N wd_browse_widget
18zle -N wd_restore_buffer
19autoload -Uz add-zle-hook-widget
20add-zle-hook-widget line-init wd_restore_buffer