Update zsh config
This commit is contained in:
parent
3a3210fc99
commit
3c0723433e
2 changed files with 65 additions and 45 deletions
|
@ -112,8 +112,7 @@ function ptheme() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#Takes you to the child theme
|
function get_theme() {
|
||||||
function theme() {
|
|
||||||
public_html=${PWD%/public_html*}/public_html
|
public_html=${PWD%/public_html*}/public_html
|
||||||
if [ -d $public_html ]; then
|
if [ -d $public_html ]; then
|
||||||
if [ -d $public_html/wp ]; then
|
if [ -d $public_html/wp ]; then
|
||||||
|
@ -123,62 +122,36 @@ function theme() {
|
||||||
fi
|
fi
|
||||||
theme=$(dirname $(wp --path="$wpPath" theme path $(wp --path="$wpPath" theme list | grep "active" | grep -v "inactive" | awk '{print $1}')))
|
theme=$(dirname $(wp --path="$wpPath" theme path $(wp --path="$wpPath" theme list | grep "active" | grep -v "inactive" | awk '{print $1}')))
|
||||||
if [ -d $theme ]; then
|
if [ -d $theme ]; then
|
||||||
cd $theme
|
echo $theme
|
||||||
else
|
else
|
||||||
echo " Can't find theme folder "
|
echo ""
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo " Can't find public_html folder."
|
echo ""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#Takes you to the child theme
|
||||||
|
function theme() {
|
||||||
|
ctheme=$(get_theme)
|
||||||
|
if [ ! -z "$ctheme" ]; then
|
||||||
|
cd $ctheme
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#Takes you to the js folder child theme
|
#Takes you to the js folder child theme
|
||||||
function js() {
|
function js() {
|
||||||
public_html=${PWD%/public_html*}/public_html
|
ctheme=$(get_theme)
|
||||||
if [ -d $public_html ]; then
|
if [ ! -z "$ctheme" ]; then
|
||||||
if [ -d $public_html/wp ]; then
|
cd $ctheme/js
|
||||||
wpPath=$public_html/wp;
|
|
||||||
else
|
|
||||||
wpPath=$public_html;
|
|
||||||
fi
|
|
||||||
theme=$(dirname $(wp --path="$wpPath" theme path $(wp --path="$wpPath" theme list | grep "active" | grep -v "inactive" | awk '{print $1}')))
|
|
||||||
if [ -d $theme ]; then
|
|
||||||
if [ -d "$theme/js" ]; then
|
|
||||||
cd "$theme/js"
|
|
||||||
else
|
|
||||||
echo "Can't find a JS folder. Here is the theme"
|
|
||||||
cd "$theme"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo " Can't find theme folder "
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo " Can't find public_html folder."
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#Takes you to the css folder child theme
|
#Takes you to the css folder child theme
|
||||||
function css() {
|
function css() {
|
||||||
public_html=${PWD%/public_html*}/public_html
|
ctheme=$(get_theme)
|
||||||
if [ -d $public_html ]; then
|
if [ ! -z "$ctheme" ]; then
|
||||||
if [ -d $public_html/wp ]; then
|
cd $ctheme/css
|
||||||
wpPath=$public_html/wp;
|
|
||||||
else
|
|
||||||
wpPath=$public_html;
|
|
||||||
fi
|
|
||||||
theme=$(dirname $(wp --path="$wpPath" theme path $(wp --path="$wpPath" theme list | grep "active" | grep -v "inactive" | awk '{print $1}')))
|
|
||||||
if [ -d $theme ]; then
|
|
||||||
if [ -d "$theme/css" ]; then
|
|
||||||
cd "$theme/css"
|
|
||||||
else
|
|
||||||
echo "Can't find a CSS folder. Here is the theme"
|
|
||||||
cd "$theme"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo " Can't find theme folder "
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo " Can't find public_html folder."
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,6 +170,40 @@ function plugins() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Copies a woo tepmplate file to the theme
|
||||||
|
function woocp() {
|
||||||
|
public_html=${PWD%/public_html*}/public_html
|
||||||
|
if [ -d $public_html ]; then
|
||||||
|
if [ -d $public_html/wp ]; then
|
||||||
|
wpPath=$public_html/wp;
|
||||||
|
else
|
||||||
|
wpPath=$public_html;
|
||||||
|
fi
|
||||||
|
woocommerce=$(dirname $(wp --path="$wpPath" plugin path woocommerce))
|
||||||
|
themes=$(dirname $(wp --path="$wpPath" theme path ))
|
||||||
|
if [ -d "$woocommerce" ]; then
|
||||||
|
#If we are here, we know what the woocommerce path is.
|
||||||
|
# If in WOO directory, we want to copy to the theme directory. If we are not in Woo directory, copy to the current directory
|
||||||
|
case $PWD/ in
|
||||||
|
$woocommerce/*)
|
||||||
|
theme=$(get_theme)
|
||||||
|
#if [[ $PWD = $woocommerce/templates
|
||||||
|
;;
|
||||||
|
$themes/*)
|
||||||
|
echo "in themes dir"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "soewhere else"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo "Can't find woocommerce"
|
||||||
|
fi;
|
||||||
|
else
|
||||||
|
echo " Can't find public_html folder."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#Takes you to the theme directory
|
#Takes you to the theme directory
|
||||||
function themes() {
|
function themes() {
|
||||||
public_html=${PWD%/public_html*}/public_html
|
public_html=${PWD%/public_html*}/public_html
|
||||||
|
|
13
shells/zsh/oh-my-zsh/shortcuts.zsh
Normal file
13
shells/zsh/oh-my-zsh/shortcuts.zsh
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
function append_date() {
|
||||||
|
# Prepend "info" to the command line and run it.
|
||||||
|
BUFFER="$BUFFER-$(date '+%Y-%m-%d')"
|
||||||
|
zle end-of-line
|
||||||
|
}
|
||||||
|
|
||||||
|
# Define a widget called "run_info", mapped to our function above.
|
||||||
|
zle -N append_date
|
||||||
|
|
||||||
|
# Bind it to ESC-i.
|
||||||
|
bindkey "" append_date
|
Loading…
Add table
Add a link
Reference in a new issue