Work on zsh config
This commit is contained in:
parent
3638bb3355
commit
eec3f74fc6
3 changed files with 41 additions and 9 deletions
22
custom-oh-my-zsh/completion.zsh
Normal file
22
custom-oh-my-zsh/completion.zsh
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
compdef sshrc=ssh
|
||||||
|
|
||||||
|
autoload bashcompinit
|
||||||
|
bashcompinit
|
||||||
|
_wp_complete() {
|
||||||
|
local OLD_IFS="$IFS"
|
||||||
|
local cur=${COMP_WORDS[COMP_CWORD]}
|
||||||
|
IFS=$'\n'; # want to preserve spaces at the end
|
||||||
|
local opts="$(wp cli completions --line="$COMP_LINE" --point="$COMP_POINT")"
|
||||||
|
if [[ "$opts" =~ \<file\>\s* ]]
|
||||||
|
then
|
||||||
|
COMPREPLY=( $(compgen -f -- $cur) )
|
||||||
|
elif [[ $opts = "" ]]
|
||||||
|
then
|
||||||
|
COMPREPLY=( $(compgen -f -- $cur) )
|
||||||
|
else
|
||||||
|
COMPREPLY=( ${opts[*]} )
|
||||||
|
fi
|
||||||
|
IFS="$OLD_IFS"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
complete -o nospace -F _wp_complete wp
|
|
@ -19,7 +19,7 @@ function old() {
|
||||||
|
|
||||||
function cdlc() {
|
function cdlc() {
|
||||||
cd "$@"
|
cd "$@"
|
||||||
/home/jonathan/.gem/ruby/2.4.0/bin/colorls | tail -n +2
|
/home/jonathan/.gem/ruby/2.4.0/bin/colorls -sd | tail -n +2
|
||||||
}
|
}
|
||||||
alias cd="cdlc"
|
alias cd="cdlc"
|
||||||
|
|
||||||
|
@ -100,5 +100,5 @@ searchcss() {
|
||||||
grep -r -i -n --color="always" --include=\*.{css,less,scss,sass} --exclude=\*.min.css "$1" .
|
grep -r -i -n --color="always" --include=\*.{css,less,scss,sass} --exclude=\*.min.css "$1" .
|
||||||
}
|
}
|
||||||
searchphp() {
|
searchphp() {
|
||||||
grep -r -i -n --color="always" --include="*.php" "$1" .
|
grep -r -i -n --color="always" --include=\*.{php,phtml} "$1" .
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,28 +3,35 @@
|
||||||
# Custom dir command
|
# Custom dir command
|
||||||
function my_dir(){
|
function my_dir(){
|
||||||
homeIcon=" "
|
homeIcon=" "
|
||||||
wpPluginsIcon=" "
|
wpPluginsIcon=".p."
|
||||||
wpThemesIcon=""
|
wpThemesIcon=".t."
|
||||||
siteIcon=" "
|
siteIcon=" "
|
||||||
dropboxIcon=" "
|
dropboxIcon=" "
|
||||||
|
seperator=""
|
||||||
# Gets the path.
|
# Gets the path.
|
||||||
local current_path="$(print -P "%~")"
|
local current_path="$(print -P "%~")"
|
||||||
|
|
||||||
# Replace either ~ or ~/ with
|
# Replace either ~ or ~/ with
|
||||||
current_path=$(echo $current_path | sed -r -e "s/\~?/$homeIcon/")
|
current_path=$(echo $current_path | sed -r -e "s/\~/$homeIcon/")
|
||||||
|
|
||||||
# Replace wp-content/themes with theme icon if in theme
|
# Replace wp-content/themes with theme icon if in theme
|
||||||
current_path=$(echo $current_path | sed -r -e "s/wp\-content\/themes/$wpThemesIcon/")
|
# current_path=$(echo $current_path | sed -r -e "s/wp\-content\/themes/$wpThemesIcon/")
|
||||||
|
|
||||||
# Replace wp-content/plugins with plugin icon if in plugin
|
# Replace wp-content/plugins with plugin icon if in plugin
|
||||||
current_path=$(echo $current_path | sed -r -e "s/wp\-content\/plugins/$wpPluginsIcon/")
|
# current_path=$(echo $current_path | sed -r -e "s/wp\-content\/plugins/$wpPluginsIcon/")
|
||||||
|
|
||||||
#If in a site folder, replace home/Sites/<site-name>/public_html with siteIcon <site-name>
|
# If in a site folder, replace home/Sites/<site-name>/public_html with siteIcon <site-name>
|
||||||
current_path=$(echo $current_path | sed -r -e "s/$homeIcon\/Sites\/([a-z_\-]*)\/public_html/$siteIcon\1/")
|
current_path=$(echo $current_path | sed -r -e "s/$homeIcon\/Sites\/([a-z_\-]*)\/public_html/$siteIcon\1/")
|
||||||
|
|
||||||
#Replace Dropbox with icon
|
# Replace Dropbox with icon
|
||||||
current_path=$(echo $current_path | sed -r -e "s/$homeIcon\/Dropbox/$dropboxIcon/")
|
current_path=$(echo $current_path | sed -r -e "s/$homeIcon\/Dropbox/$dropboxIcon/")
|
||||||
|
|
||||||
|
# Change wp-content in sub folders
|
||||||
|
current_path=$(echo $current_path | sed -r -e "s/wp\-content\//wpc\//")
|
||||||
|
|
||||||
|
# Set the seperator
|
||||||
|
current_path=$(echo $current_path | sed -r -e "s/\//$seperator/g")
|
||||||
|
|
||||||
echo $current_path
|
echo $current_path
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,6 +39,9 @@ POWERLEVEL9K_CUSTOM_DIR="my_dir"
|
||||||
POWERLEVEL9K_CUSTOM_DIR_BACKGROUND="blue"
|
POWERLEVEL9K_CUSTOM_DIR_BACKGROUND="blue"
|
||||||
POWERLEVEL9K_CUSTOM_DIR_FOREGROUND="white"
|
POWERLEVEL9K_CUSTOM_DIR_FOREGROUND="white"
|
||||||
|
|
||||||
|
# POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR="\ue0c0"
|
||||||
|
# POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR="\ue0c2"
|
||||||
|
|
||||||
|
|
||||||
# Left Prompt
|
# Left Prompt
|
||||||
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_dir rbenv vcs)
|
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_dir rbenv vcs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue