diff --git a/Dockerfile b/Dockerfile index c78fc39..0582c16 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,8 +21,6 @@ RUN if [ "$MIN" = "no" ]; then \ sed -i '1 e cat /tmp/templates/zshrc_disable_flag.zsh' ~/.zshrc; \ fi && \ echo "" >> ~/.zshrc && \ - cat /tmp/templates/zshrc_successful_cmd_hist.zsh >> ~/.zshrc && \ - echo "" >> ~/.zshrc && \ cat /tmp/templates/gitpod_exports.zsh >> ~/.zshrc && \ echo 'for i in $(ls $HOME/.bashrc.d/ | grep -v python); do source $HOME/.bashrc.d/$i > /dev/null 2>&1; done' >> ~/.zshrc && \ echo "" >> ~/.zshrc && \ diff --git a/configs/nathaniel/config.toml b/configs/nathaniel/config.toml index 6546e24..a53f3b8 100644 --- a/configs/nathaniel/config.toml +++ b/configs/nathaniel/config.toml @@ -158,6 +158,7 @@ tags = [ "terminal" ] [ install_ohmyzsh_plugins ] tags = [ "terminal" ] options = [ + "https://github.com/nyoungstudios/zsh-history-on-success", "https://github.com/zsh-users/zsh-autosuggestions", "https://github.com/zsh-users/zsh-syntax-highlighting" ] @@ -170,6 +171,7 @@ options = [ "copyfile", "sudo", "zsh-autosuggestions", + "zsh-history-on-success", "zsh-syntax-highlighting" ] diff --git a/functions/zsh_successful_cmd_filter/README.md b/functions/zsh_successful_cmd_filter/README.md deleted file mode 100644 index 45f0301..0000000 --- a/functions/zsh_successful_cmd_filter/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Zsh Successful Cmd Filter - -Configuration for a `zsh_successful_cmd_filter` entry. - -## Description - -Appends a couple functions to your `.zshrc` file to only add successfully run command to your `.zsh_history` file by looking at its exit code. Also, saves multi-line commands as single-line commands in your history. - -## Options - -Accepts exactly 0 arguments - -## Example - -```toml -[ zsh_successful_cmd_filter ] -options = [] -``` diff --git a/functions/zsh_successful_cmd_filter/config.toml b/functions/zsh_successful_cmd_filter/config.toml deleted file mode 100644 index cd35535..0000000 --- a/functions/zsh_successful_cmd_filter/config.toml +++ /dev/null @@ -1 +0,0 @@ -install_function = "install_zsh_successful_cmd_filter" diff --git a/functions/zsh_successful_cmd_filter/install.sh b/functions/zsh_successful_cmd_filter/install.sh deleted file mode 100755 index be5e841..0000000 --- a/functions/zsh_successful_cmd_filter/install.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -install_zsh_successful_cmd_filter() { - # appends zshaddhistory and precmd hooks - echo "" >> ~/.zshrc - cat templates/zshrc_successful_cmd_hist.zsh >> ~/.zshrc -} diff --git a/templates/zshrc_successful_cmd_hist.zsh b/templates/zshrc_successful_cmd_hist.zsh deleted file mode 100644 index fb1bfcc..0000000 --- a/templates/zshrc_successful_cmd_hist.zsh +++ /dev/null @@ -1,18 +0,0 @@ -# credits: https://scarff.id.au/blog/2019/zsh-history-conditional-on-command-success/ -function zshaddhistory() { - # Remove line continuations since otherwise a "\" will eventually - # get written to history with no newline. - LASTHIST=${1//\\$'\n'/} - # Return value 2: "... the history line will be saved on the internal - # history list, but not written to the history file". - return 2 -} - -# zsh hook called before the prompt is printed. See man zshmisc(1). -function precmd() { - # Write the last command if successful and if the last command is not whitespace characters, - # using the history buffered by zshaddhistory(). - if [[ $? == 0 && -n ${LASTHIST//[[:space:]\n]/} && -n $HISTFILE ]] ; then - print -sr -- ${=${LASTHIST%%'\n'}} - fi -}