Skip to main content
Make the answer better
Source Link

I just wrote a small plugin to handle this. Add an issue for the behavior you're interested in and I'll seethat does much of what I can do to implement it.

TakeJim Hester's plugin does, but uses a lookdifferent approach that fixes many of the issues listed in that plugin's GitHub repo:

https://github.com/ericfreese/zsh-cwd-history

It stores a separate HISTFILE for every directory you've executed commands in, and adds a chpwd hook to switch between HISTFILEs when you change directories.

It also provides a zle widget you can bind to a keypress that will toggle the HISTFILE between your original "global" HISTFILE and the HISTFILE for your current working directory.

So, my question: does a plugin/setting/something exist for zsh such that, when searching in history, commands invoked in the current directory are displayed first?

The zsh-cwd-history plugin doesn't currently support this, but I'm hoping to add support for it soon.

I just wrote a small plugin to handle this. Add an issue for the behavior you're interested in and I'll see what I can do to implement it.

Take a look:

https://github.com/ericfreese/zsh-cwd-history

I just wrote a small plugin that does much of what Jim Hester's plugin does, but uses a different approach that fixes many of the issues listed in that plugin's GitHub repo:

https://github.com/ericfreese/zsh-cwd-history

It stores a separate HISTFILE for every directory you've executed commands in, and adds a chpwd hook to switch between HISTFILEs when you change directories.

It also provides a zle widget you can bind to a keypress that will toggle the HISTFILE between your original "global" HISTFILE and the HISTFILE for your current working directory.

So, my question: does a plugin/setting/something exist for zsh such that, when searching in history, commands invoked in the current directory are displayed first?

The zsh-cwd-history plugin doesn't currently support this, but I'm hoping to add support for it soon.

Source Link

I just wrote a small plugin to handle this. Add an issue for the behavior you're interested in and I'll see what I can do to implement it.

Take a look:

https://github.com/ericfreese/zsh-cwd-history