把如下配置放入 ~/.zshrc 或你正在用的zsh文件中
#quick move folder setting
export MARKPATH=$HOME/.marks
function go {
cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
}
function mark {
mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$1"
}
function unmark {
rm -i "$MARKPATH/$1"
}
function marks {
\ls -l "$MARKPATH" | tail -n +2 | sed 's/ / /g' | cut -d' ' -f9- | awk -F ' -> ' '{printf "%-10s -> %s\n", $1, $2}'
}
function _completemarks {
reply=($(ls $MARKPATH))
}
compctl -K _completemarks go
compctl -K _completemarks unmark
网友评论