forked from jocelynmallon/zshmarks
-
Notifications
You must be signed in to change notification settings - Fork 5
/
bookmarks.plugin.zsh
30 lines (24 loc) · 992 Bytes
/
bookmarks.plugin.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env zsh
# ------------------------------------------------------------------------------
# FILE: zshmarks.plugin.zsh
# DESCRIPTION: zsh plugin file.
# AUTHOR: Jocelyn Mallon
# VERSION: 2.0.0
# ------------------------------------------------------------------------------
# Standarized $0 handling, following:
# https://github.com/zdharma/Zsh-100-Commits-Club/blob/master/Zsh-Plugin-Standard.adoc
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
if [[ $PMSPEC != *f* ]] {
fpath+=( "${0:h}/functions" )
}
# Set BOOKMARKS_FILE if it doesn't exist to the default.
# Allows for a user-configured BOOKMARKS_FILE.
BOOKMARKS_FILE=${BOOKMARKS_FILE:-"$HOME/.bookmarks"}
# Normalize file path
BOOKMARKS_FILE=${BOOKMARKS_FILE:A}
# Create file it if it doesn't exist
if [[ ! -f $BOOKMARKS_FILE ]]; then
echo -n > $BOOKMARKS_FILE
fi
autoload -Uz mark marks c delmark @bookmark_path_colorize @bookmark_name_colorize @bookmark_join