#11198·ohmyzsh

per-directory-history doesn't save to both global and local

Author: CharlesARoyCreated Sep 27, 2022Updated Sep 18, 2026
LabelsBugHacktoberfest

Describe the bug

As stated in the original repository for this tool, whether you are in global history mode or per-directory history mode, the history should always be saved to both.

In my use I get the following behavior: When using local history, commands entered are not available when I switch to global history. When using global history, commands entered in a given directory do appear in the local history, but they show up at the back of the list even if typed more recently.

Steps to reproduce

  1. Enable plugin.
  2. Type some commands.
  3. Run per-directory-history-toggle-history to change modes.
  4. Run history | less to view the history. In my case, the commands entered in 2 don't show up.

Expected behavior

When I switch history modes, commands entered in the previous mode should be listed as the most recent commands in the history of the new mode (provided I haven't also changed directories or run commands in another session).

OS / Linux distribution

Ubuntu 20.04.4 LTS

Zsh version

5.8

Terminal emulator

Tmux in Windows Terminal