Many changes

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

View file

@ -172,3 +172,17 @@ alias rs="rofi-reverse-shells"
ARMORY="$HOME/GitRepos/armoury"
alias surecheckImport="$JAVA_HOME/bin/java -jar $ARMORY/host_build_reviews/windows/SurecheckImport/SurecheckImport_v0.2.jar "
alias rot13="tr 'A-Za-z' 'N-ZA-Mn-za-m'"
# These aliases are related to projects
# Make sqlmap put output in the current project folder
alias sqlmap="[ -L ~/Projects/current ] && sqlmap --output-dir=\"~/Projects/current/sqlmap\""
# Cd into the current project
alias pp="[ -L ~/Projects/current ] && cd \$(readlink ~/Projects/current) || cd ~/Projects"
# Automatically switch project based on current location
alias pa="project switch --auto"
# Change project using fzf
alias pc="project switch --fzf"
# Create a new project
alias pn="project new"

View file

@ -1,7 +1,7 @@
export LANG="en_GB.UTF-8"
export TERMINAL=/usr/local/bin/st
export TERM=xterm-256color
export PATH=~/.bin:$PATH:/opt/lampp/bin:~/.config/composer/vendor/bin:.
export PATH=~/Projects/current/bin:~/.bin:$PATH:.
export EDITOR='vim'
export READER='zathura'
export CDPATH=.:~:~/Sites

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