diff --git a/plugins/go/_go b/plugins/go/_go new file mode 100644 index 000000000..37006f964 --- /dev/null +++ b/plugins/go/_go @@ -0,0 +1,4 @@ +#compdef go +#autoload + +_arguments "1: :(`grep "|" $HOME/.zshbookmarks | cut -d\| -f2`)" \ No newline at end of file diff --git a/plugins/go/go.plugin.zsh b/plugins/go/go.plugin.zsh new file mode 100644 index 000000000..10ca81204 --- /dev/null +++ b/plugins/go/go.plugin.zsh @@ -0,0 +1,50 @@ +# ------------------------------------------------------------------------------ +# FILE: go.plugin.zsh +# DESCRIPTION: oh-my-zsh plugin file. +# AUTHOR: Jocelyn Mallon (jocelyn.e.mallon@gmail.com) +# VERSION: 1.0 +# ------------------------------------------------------------------------------ + +bookmarks_file="$HOME/.zshbookmarks" + +# Create bookmarks_file it if it doesn't exist +if [[ ! -f $bookmarks_file ]]; then + touch $bookmarks_file +fi + +function bookmark() { + bookmark_name=$1 + if [[ -z $bookmark_name ]]; then + echo 'Invalid name, please provide a name for your bookmark. For example:' + echo ' bookmark foo' + else + bookmark="$(pwd)|$bookmark_name" # Store the bookmark as folder|name + if [[ -z $(grep "$bookmark" $bookmarks_file) ]]; then + echo $bookmark >> $bookmarks_file + echo "Bookmark '$bookmark_name' saved" + else + echo "Bookmark already existed" + fi + fi +} + +function go() { + bookmark_name=$1 + bookmark="$(grep "|$bookmark_name$" "$bookmarks_file")" + if [[ -z $bookmark ]]; then + echo "Invalid name, please provide a valid bookmark name. For example:" + echo " go foo" + echo + echo "To bookmark a folder, go to the folder then do this (naming the bookmark 'foo'):" + echo " bookmark foo" + else + dir="${bookmark%%|*}" + cd "${dir}" + dir="" + fi +} + +# Show a list of the bookmarks +function bookmarksshow(){ + cat ~/.bookmarks | awk '{ printf "%-40s%-40s%s\n",$1,$2,$3}' FS=\| +} \ No newline at end of file diff --git a/themes/jocelyn.zsh-theme b/themes/jocelyn.zsh-theme new file mode 100644 index 000000000..708770a09 --- /dev/null +++ b/themes/jocelyn.zsh-theme @@ -0,0 +1,7 @@ +PROMPT='(%{$fg_bold[magenta]%}%n%{$reset_color%}@%{$fg_bold[blue]%}%m%{$reset_color%}) - (%{$fg_bold[blue]%}%T%{$reset_color%}) - (%{$fg[green]%}%~%{$reset_color%}%) +$(git_prompt_info)%{$reset_color%}$fg_bold[green]%}➜ %{$reset_color%}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:%{$reset_color%}(%{$fg_bold[yellow]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$reset_color%}) %{$fg_bold[red]%}✗%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}) "