From d9465307d619a35e0a7c3e9b024fa2c8426afe1f Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Tue, 29 Oct 2019 13:50:51 +0000 Subject: [PATCH] zsh changes --- shells/shared/aliases | 2 +- shells/zsh/STOW/.zshrc | 21 ++++++++++---------- shells/zsh/oh-my-zsh-custom/promptconfig.zsh | 9 ++++----- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/shells/shared/aliases b/shells/shared/aliases index 7e9325ac..4a4fa02c 100644 --- a/shells/shared/aliases +++ b/shells/shared/aliases @@ -14,7 +14,7 @@ alias tree='tree -F -C' # Make qmv open on 1 column mode alias qmv='qmv -f do' -alias msfconsole="msfconsole --quiet -x \"db_connect msf@msf\"" +alias msfconsole="( systemctl status --no-pager postgresql.service > /dev/null || (echo \"Statring postgres\"; sudo systemctl start postgresql.service) ); ( pass show system/metasploit/database.yaml > database.yaml; msfconsole -y database.yaml; rm database.yaml )" #Start cups alias cups='sudo systemctl start org.cups.cupsd.service' diff --git a/shells/zsh/STOW/.zshrc b/shells/zsh/STOW/.zshrc index e319ca56..f3eedaa2 100644 --- a/shells/zsh/STOW/.zshrc +++ b/shells/zsh/STOW/.zshrc @@ -53,7 +53,8 @@ ZSH_CUSTOM=$HOME/.dotfiles/shells/zsh/oh-my-zsh-custom # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. -plugins=(git zsh-better-npm-completion zsh-autosuggestions) +plugins=(navi git zsh-better-npm-completion zsh-autosuggestions) + source $ZSH/oh-my-zsh.sh @@ -108,16 +109,14 @@ TRAPWINCH(){ #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 +local current="$(project current --path)" +if [ -n "$current" ]; then + local script="/usr/bin/script" + 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 diff --git a/shells/zsh/oh-my-zsh-custom/promptconfig.zsh b/shells/zsh/oh-my-zsh-custom/promptconfig.zsh index dd26c69c..9093297c 100644 --- a/shells/zsh/oh-my-zsh-custom/promptconfig.zsh +++ b/shells/zsh/oh-my-zsh-custom/promptconfig.zsh @@ -24,9 +24,8 @@ 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 + current_project_full="$(project current --path)" + if [ -n "$current_project_full" ]; 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" @@ -102,9 +101,9 @@ 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)" + local current_project_full="$(project current --path)" + local current_project_name="$(project current)" # If there is a current project if [ -n "$current_project_name" ]; then segment_content="$current_project_name"