From 3638bb33558cf105ef031c668eace0e6fafc0637 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Tue, 11 Jul 2017 10:12:36 +0100 Subject: [PATCH] Tweaks --- custom-oh-my-zsh/aliases.zsh | 5 +++++ custom-oh-my-zsh/functions.zsh | 32 ++++++++++++++++++++++++++++++- custom-oh-my-zsh/promptconfig.zsh | 4 ++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/custom-oh-my-zsh/aliases.zsh b/custom-oh-my-zsh/aliases.zsh index 117ff769..b29db18d 100644 --- a/custom-oh-my-zsh/aliases.zsh +++ b/custom-oh-my-zsh/aliases.zsh @@ -57,6 +57,9 @@ alias s="cd ~/Sites" alias documents="cd ~/Documents/" alias d="cd ~/Documents/" +# Shortcuts to documents folder +alias db="cd ~/Dropbox/" + # Shortcuts to home folder alias home="cd ~/" alias ~="cd ~/" @@ -112,3 +115,5 @@ alias jq="jq -C" alias debugBuild='node --inspect-brk /usr/bin/grunt build' alias lc="colorls -r" + + diff --git a/custom-oh-my-zsh/functions.zsh b/custom-oh-my-zsh/functions.zsh index d7aec3de..4b7cedb1 100644 --- a/custom-oh-my-zsh/functions.zsh +++ b/custom-oh-my-zsh/functions.zsh @@ -19,7 +19,7 @@ function old() { function cdlc() { cd "$@" - /home/jonathan/.gem/ruby/2.4.0/bin/colorls --report | tail -n +2 + /home/jonathan/.gem/ruby/2.4.0/bin/colorls | tail -n +2 } alias cd="cdlc" @@ -54,6 +54,36 @@ function theme() { fi } +#Takes you to the plugin directory +function plugins() { + public_html=${PWD%/public_html*}/public_html + if [ -d $public_html ]; then + plugins=$public_html/wp-content/plugins + if [ -d $plugins ]; then + cdlc $plugins + else + echo " Can't find plugins folder " + fi + else + echo " Can't find public_html folder." + fi +} + +#Takes you to the theme directory +function themes() { + public_html=${PWD%/public_html*}/public_html + if [ -d $public_html ]; then + themes=$public_html/wp-content/themes + if [ -d $themes ]; then + cdlc $themes + else + echo " Can't find plugins folder " + fi + else + echo " Can't find public_html folder." + fi +} + ######################################## ## ## ## Search Functions ## diff --git a/custom-oh-my-zsh/promptconfig.zsh b/custom-oh-my-zsh/promptconfig.zsh index 70d36cea..595e9665 100644 --- a/custom-oh-my-zsh/promptconfig.zsh +++ b/custom-oh-my-zsh/promptconfig.zsh @@ -6,6 +6,7 @@ function my_dir(){ wpPluginsIcon="  " wpThemesIcon="" siteIcon=" " + dropboxIcon=" " # Gets the path. local current_path="$(print -P "%~")" @@ -20,6 +21,9 @@ function my_dir(){ #If in a site folder, replace home/Sites//public_html with siteIcon current_path=$(echo $current_path | sed -r -e "s/$homeIcon\/Sites\/([a-z_\-]*)\/public_html/$siteIcon\1/") + + #Replace Dropbox with icon + current_path=$(echo $current_path | sed -r -e "s/$homeIcon\/Dropbox/$dropboxIcon/") echo $current_path