"That feeling you've run this command here before?"
A Zsh plugin that logs and retrieves command history based on the directory it was run in. Never forget that complex docker or git command you ran in a project folder weeks ago.
- Logs commands with their directory: Silently in the background.
djvu: A command to show history for the current directory, just likehistory.djvu <path>: Lets you query the history for any directory.djvi: An interactive fuzzy finder (usingfzf) to search your entire directory history.- Automatic Keybinding: Binds
Ctrl+Fto the interactive search out of the box.
- fzf: Required for the interactive search (
djvi). Install fzf here.
-
Clone this repository into your plugin manager's custom plugin directory.
Oh My Zsh:
git clone [https://github.com/justyntemme/zsh-deja-vu.git](https://github.com/justyntemme/zsh-deja-vu.git) \ ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-deja-vu -
Add
zsh-deja-vuto thepluginslist in your~/.zshrcfile:plugins=( # ... other plugins zsh-deja-vu )
-
Clone this repository somewhere:
git clone [https://github.com/justyntemme/zsh-deja-vu.git](https://github.com/justyntemme/zsh-deja-vu.git) \ ~/.zsh/zsh-deja-vu -
Add this line to your
~/.zshrc:source ~/.zsh/zsh-deja-vu/zsh-deja-vu.plugin.zsh
-
Restart your shell (
exec zsh).
- Current Directory: Just type
djvu.~/projects/my-app > djvu --- Déjà Vu for . (~/projects/my-app) --- 1 ls -la 2 docker-compose up -d 3 git status
- Another Directory: Pass any path as an argument.
> djvu ~/docs --- Déjà Vu for ~/docs (~/docs) --- 1 mkdocs serve 2 ls
The plugin automatically binds djvi to Ctrl+F.
Just press Ctrl+F to open the interactive fuzzy finder ("F" for "Find"). You can type to filter all commands from all directories.
If you want to use a different key (like Ctrl+R to replace the default), just add your own bindkey command to your ~/.zshrc file. Make sure to place it after your plugins are loaded. Your setting will override the default.
Example: to bind Ctrl+R:
# Put this in your ~/.zshrc (after the 'plugins=' line)
bindkey '^R' djvi-widgetYou can change the location of the history log file by setting this variable in your ~/.zshrc before the plugin is sourced:
export ZSH_DEJA_VU_HISTORY_FILE="~/.my-custom-location"MIT