Hacker News new | ask | show | jobs
by nodar86 485 days ago
You can do this with a zsh plugin: https://github.com/jimhester/per-directory-history
1 comments

This looks promising, thanks!
For bash, you may be able to do something like:

  function set_histfile {
    export HISTFILE="$HOME/.bash_history_$(pwd | tr '/' '_')"
  }

  PROMPT_COMMAND="set_histfile; $PROMPT_COMMAND"
There may be other ways, but probably can't do it without PROMPT_COMMAND.

Someone else mentioned "direnv", too.