diff --git a/.gitignore b/.gitignore index d462f6c..03642a3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.swp *.map install.sh -.zcompdump \ No newline at end of file +.zcompdump +.zsh_history \ No newline at end of file diff --git a/nix/env.nix b/nix/env.nix index acaf41a..c52b566 100644 --- a/nix/env.nix +++ b/nix/env.nix @@ -29,5 +29,6 @@ pkgs.mkShell { export ZDOTDIR=$PWD/nix/zsh export XDG_CONFIG_HOME=$PWD/nix export PATH=$PWD:$PATH + export SOURCE_DIR=$(./shx sourceDir) ''; } \ No newline at end of file diff --git a/nix/zsh/.zshrc b/nix/zsh/.zshrc index aacfa79..4d8c30c 100644 --- a/nix/zsh/.zshrc +++ b/nix/zsh/.zshrc @@ -7,7 +7,7 @@ bindkey -e # Keep 1000 lines of history within the shell and save it to ~/.zsh_history: HISTSIZE=1000 SAVEHIST=1000 -HISTFILE=~/.zsh_history +HISTFILE=$SOURCE_DIR/.zsh_history # Use modern completion system autoload -Uz compinit compinit diff --git a/sh/sh.sh b/sh/sh.sh index 49e302a..4d121c8 100644 --- a/sh/sh.sh +++ b/sh/sh.sh @@ -6,7 +6,8 @@ if [ -e "$(which nix-shell)" ]; then echo "Preparing Nix shell with: ${useNix}.nix..." nix-shell nix/${useNix}.nix --quiet --pure --command zsh echo "Quitting Nix shell..." - rm nix/zsh/.zcompdump + rm nix/.zcompdump 2> /dev/null + rm nix/zsh/.zcompdump 2> /dev/null else echo "${useNix}.nix does not exist." fi diff --git a/sh/sourceDir.sh b/sh/sourceDir.sh new file mode 100644 index 0000000..6a183b0 --- /dev/null +++ b/sh/sourceDir.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# This script is to display the project directory. +# It is solely used to support shell history isolation. +echo $SOURCE_DIR +exit \ No newline at end of file