diff --git a/README.md b/README.md index dc57d71..6baba6a 100644 --- a/README.md +++ b/README.md @@ -4,17 +4,29 @@ ## Description -A ohmyzsh plugin to support bookmark for directories in cmdline. +Yet another ohmyzsh plugin to quick jump between cmdline directories. -## Usage -1. Ensure both sed & awk are already installed in you cmdline PATH. -2. Install plugin to ohmyzsh customer plugin dir -3. Add **bookmark** to the plugins array in your zshrc file - `plugins=(... bookmark)` +And the design concern is very simple + + Add path to bookmarks, return an ordered number. + and use the numbers to switch between dirs finally. +There are also lots of powerfull [FS Jumping](https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins-Overview#fs-jumping) plugins if this is too simple for your case. +But if you also prefer simple and intuitive solution. this plugin can also be a good alternative. -### Usage +## Install +1. Ensure both sed are already installed in you cmdline PATH. +1. Ensure [ohmyzsh](https://github.com/ohmyzsh/ohmyzsh) already installed. +1. Install plugin to ohmyzsh customer plugin dir. + ```zsh + curl -s https://raw.githubusercontent.com/calmzhu/ohmyzsh-plugin-bookmark/main/install.zsh >install.zsh + zsh install.zsh $ZSH_CUSTOM + ``` +1. Add **bookmark** to the plugins array in your zshrc file. + `plugins=(... bookmark)`. + +## Usage ```bash $ l -a ~ #Add home dir to bookmark diff --git a/install.zsh b/install.zsh new file mode 100755 index 0000000..0d8fd99 --- /dev/null +++ b/install.zsh @@ -0,0 +1,26 @@ + +export ZSH_CUSTOM=$1 + +function error { + local _message=$1 + echo -e "\033[31m$_message\033[0m" + exit 1 +} + +[[ `basename $SHELL` -eq "zsh" ]] || error "Please run in zsh" + +export DOC_URL="https://github.com/calmzhu/ohmyzsh-plugin-bookmark/tree/main?tab=readme-ov-file#install" +export VERSION=latest + +which sed>/dev/null || error "Cannot found sed in '\$PATH';see $DOC_URL" + +export INSTALL_DIR="$ZSH_CUSTOM/plugins" +[[ -d "$INSTALL_DIR" ]] || error "Error: Cannot found zsh plugin dir '\$ZSH_CUSTOM/plugins';\nsee $DOC_URL" + +download_url=`curl -s https://api.github.com/repos/calmzhu/ohmyzsh-plugin-bookmark/releases/$VERSION | \ + grep "browser_download_url" | \ + grep -o "http.*\.zip"` +temp=`mktemp` +curl -L $download_url --output $temp +unzip $temp -d $INSTALL_DIR +rm -rf $temp