From 370fed3a08dc93ffed212e2121ce2e22ad3cddda Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Tue, 25 Dec 2018 13:17:39 -0600 Subject: [PATCH 1/3] Added history dup option and altered a couple of defaults --- example_configs/zsh.conf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/example_configs/zsh.conf b/example_configs/zsh.conf index 2dddf62..114463e 100644 --- a/example_configs/zsh.conf +++ b/example_configs/zsh.conf @@ -2,9 +2,10 @@ BSD_MODE=false #Some options must be specified differently in BSD SYNTAX_HIGHLIGHT=true #On-the-fly syntax highlighting of commands that you type AUTO_CD=true #When true, if only a directory path is entered, you will cd to the directory +HISTORY_IGNORE_DUPS=true #Ignore duplicate back-to-back commands in shell history # Prompt Style -PROMPT_STYLE=bsd #Valid options: bsd, bsd2, ar5 +PROMPT_STYLE=bsd2 #Valid options: bsd, bsd2, ar5 COMPLETION_STYLE=bash #ZSH "automenu" option toggle - Valid options: bash, zsh (defaults to bash) # Example prompts: @@ -16,7 +17,7 @@ COMPLETION_STYLE=bash #ZSH "automenu" option toggle - Valid options: bash, zsh # Prompt Colours COLOR_USER=cyan COLOR_HOST=cyan -COLOR_PWD=cyan +COLOR_PWD=green COLOR_VCS=green ### Color Legend # From 6dc71c96f1a46fecc3c57d1a95863e9fad39fd2d Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Tue, 25 Dec 2018 13:42:51 -0600 Subject: [PATCH 2/3] Also added boolean for IGNORE_SPACE option --- example_configs/zsh.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example_configs/zsh.conf b/example_configs/zsh.conf index 114463e..2a5e567 100644 --- a/example_configs/zsh.conf +++ b/example_configs/zsh.conf @@ -2,7 +2,8 @@ BSD_MODE=false #Some options must be specified differently in BSD SYNTAX_HIGHLIGHT=true #On-the-fly syntax highlighting of commands that you type AUTO_CD=true #When true, if only a directory path is entered, you will cd to the directory -HISTORY_IGNORE_DUPS=true #Ignore duplicate back-to-back commands in shell history +HISTORY_HIDE_SPACE=true #Does not record to history any command starting with a space (good for passing sensitive data like passwords on the command line) +HISTORY_NO_DUPS=true #Ignore duplicate back-to-back commands in shell history # Prompt Style PROMPT_STYLE=bsd2 #Valid options: bsd, bsd2, ar5 From 62829f3d73f70a90745c8d24779d8631ee1dee92 Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Tue, 25 Dec 2018 13:43:27 -0600 Subject: [PATCH 3/3] Added IGNORE_SPACE and IGNORE_DUPS options, as well as sanity check for all options --- setopt | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/setopt b/setopt index a45f54c..8215731 100644 --- a/setopt +++ b/setopt @@ -2,12 +2,50 @@ autoload -U compinit promptinit autoload -U colors && colors compinit -d ${HOME}/.cache/.zcompdump promptinit + +#Check sanity of configuration values, and warn user if they are outdated/don't exist +if [ -z ${AUTO_CD+x} ] +then + printf "AUTO_CD is unset! Check example_configs/zsh.conf for the latest options.\nDefaulting $(tput setaf 2)$(tput bold)AUTO_CD$(tput sgr0) to $(tput setaf 3)$(tput bold)true$(tput sgr0).\n\n" + AUTO_CD=true +fi + +if [ -z ${HISTORY_HIDE_SPACE+x} ] +then + printf "HISTORY_HIDE_SPACE is unset! Check example_configs/zsh.conf for the latest options.\nDefaulting $(tput setaf 2)$(tput bold)HISTORY_HIDE_SPACE$(tput sgr0) to $(tput setaf 3)$(tput bold)true$(tput sgr0).\n\n" + HISTORY_HIDE_SPACE=true +fi + +if [ -z ${HISTORY_NO_DUPS+x} ] +then + printf "HISTORY_NO_DUPS is unset! Check example_configs/zsh.conf for the latest options.\nDefaulting $(tput setaf 2)$(tput bold)HISTORY_NO_DUPS$(tput sgr0) to $(tput setaf 3)$(tput bold)true$(tput sgr0).\n\n" + HISTORY_NO_DUPS=true +fi + +if [ -z ${COMPLETION_STYLE+x} ] +then + printf "COMPLETION_STYLE is unset! Check example_configs/zsh.conf for the latest options.\nDefaulting $(tput setaf 2)$(tput bold)COMPLETION_STYLE$(tput sgr0) to $(tput setaf 3)$(tput bold)bash$(tput sgr0).\n\n" + COMPLETION_STYLE=true +fi + + +#Set options if [ $AUTO_CD = true ] then setopt autocd fi + unsetopt beep -setopt HIST_IGNORE_SPACE +if [ $HISTORY_HIDE_SPACE = true ] +then + setopt HIST_IGNORE_SPACE +fi + +if [ $HISTORY_NO_DUPS = true ] +then + setopt HIST_IGNORE_DUPS +fi + if [ $COMPLETION_STYLE = bash ] then setopt noautomenu