Many changes

This commit is contained in:
Jonathan Hodgson 2019-10-10 17:29:09 +01:00
parent d6c23ea057
commit dbfbbd2623
39 changed files with 1416 additions and 18 deletions

View file

@ -4,6 +4,7 @@
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.dotfiles/shells/zsh/oh-my-zsh-core
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
@ -106,4 +107,17 @@ TRAPWINCH(){
# exec tmux
#fi
#
local current="$(project current --path)"
if [ -n "$current" ]; then
echo "yay"
local script="/usr/bin/script"
echo "'$(ps -ocommand -p $PPID | grep -v 'COMMAND' | cut -d' ' -f1)'"
if [[ ! "$(ps -ocommand -p $PPID | grep -v 'COMMAND' | cut -d' ' -f1 )" == "$script" ]]; then
mkdir "$current/shell-logs"
/usr/bin/script -f "$current/shell-logs/$(date +"%d-%b-%y_%H-%M-%S")_shell.log"
fi
fi
clear
tldr --linux -r

View file

@ -20,3 +20,6 @@ _wp_complete() {
return 0
}
complete -o nospace -F _wp_complete wp
_comp_options+=(globdots)

View file

@ -11,7 +11,7 @@ function my_dir(){
dropboxIcon=""
seperator="  "
seperatorDual="  "
root="$seperator"
root="$seperator"
# Gets the path.
local current_path="$(print -P "%~")"
@ -24,6 +24,15 @@ function my_dir(){
# Replace wp-content/plugins with plugin icon if in plugin
# current_path=$(echo $current_path | sed -r -e "s/wp\-content\/plugins/$wpPluginsIcon/")
local current_project_full="$(project current --path)"
local current_project_name="$(project current)"
if [ -n "$current_project_name" ]; then
if echo "$PWD" | grep -q "$current_project_full"; then
current_path=$(echo $PWD | sed -r -e "s#$current_project_full##" | sed -r -e 's/^\///')
current_path="$current_path"
fi
fi
#
#This is used for checking if wp or magento
local ph=${PWD%/public_html*}/public_html
# If in a site folder and a wp site, replace home/Sites/<site-name>/public_html with siteIcon <site-url>
@ -90,9 +99,42 @@ POWERLEVEL9K_CUSTOM_CAPS="Capslock"
POWERLEVEL9K_CUSTOM_CAPS_BACKGROUND="red"
POWERLEVEL9K_CUSTOM_CAPS_FOREGROUND="white"
function prompt_project() {
local segment_content state icon
local current_project_name="$(project current)"
local current_project_full="$(project current --path)"
local parent_process="$(ps -ocommand -p $PPID | grep -v 'COMMAND' | cut -d' ' -f1)"
# If there is a current project
if [ -n "$current_project_name" ]; then
segment_content="$current_project_name"
if [[ "$parent_process" == "/usr/bin/script" ]]; then
segment_content="$segment_content"
fi
# If in the current project
if echo "$PWD" | grep -q "$current_project_full"; then
state="INSIDE"
elif echo "$PWD" | grep -q "$HOME/Projects/"; then
state="WRONG"
else
state="OUTSIDE"
fi
fi
if [ -n "$segment_content" ]; then
"$1_prompt_segment" "${0}_${state}" "$2" $DEFAULT_COLOR_INVERTED $DEFAULT_COLOR "$segment_content" "$icon"
fi
}
POWERLEVEL9K_PROJECT_DEFAULT_FOREGROUND="black"
POWERLEVEL9K_PROJECT_WRONG_BACKGROUND="red"
POWERLEVEL9K_PROJECT_OUTSIDE_BACKGROUND="yellow"
POWERLEVEL9K_PROJECT_INSIDE_BACKGROUND="green"
# Left Prompt
if [[ "$(basename "/"$(ps -f -p $(cat /proc/$(echo $$)/stat | cut -d \ -f 4) | tail -1 | sed 's/^.* //'))" != "$(echo $USER)" ]]; then
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(custom_dir vcs custom_caps)
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(project custom_dir vcs custom_caps)
fi
# Right Prompt

View file

@ -10,4 +10,4 @@ function append_date() {
zle -N append_date
# Bind it to ESC-i.
bindkey "" append_date
#bindkey "" append_date