https://github.com/ojroques/fzf-dirhistory
Use FZF to quickly jump to recently visited directories
https://github.com/ojroques/fzf-dirhistory
fzf shell
Last synced: 3 months ago
JSON representation
Use FZF to quickly jump to recently visited directories
- Host: GitHub
- URL: https://github.com/ojroques/fzf-dirhistory
- Owner: ojroques
- License: lgpl-2.1
- Created: 2021-06-10T14:42:47.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-27T09:47:09.000Z (over 1 year ago)
- Last Synced: 2025-02-27T17:26:50.280Z (3 months ago)
- Topics: fzf, shell
- Language: Python
- Homepage: https://pypi.org/project/fzf-dirhistory/
- Size: 14.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fzf-dirhistory
A small Python package that keeps a history of recently visited directories. It
is primarily intended for use by FZF to quickly jump to previous locations.## Installation
```bash
pip3 install --user fzf-dirhistory
```## Usage (with Bash)
Add this to your `.bashrc` to log directories as you visit them:
```bash
PROMPT_COMMAND='python3 -m fzfdirhist log "$(pwd)"'
```Then add this function to call FZF with the history file as input:
```bash
fdh() {
local dir=$(python3 -m fzfdirhist show | fzf --height=40% --reverse +m)
cd "$dir"
}
```Calling `fdh` will jump to the selected location. You may want to map that
function (here to `ALT-H` denoted by `\eh`):
```bash
bind '"\eh": "\C-k\C-u fdh\n"'
```## Configuration
The `DIR_HISTORY_FILE` environment variable points to the history file (by
default `~/.dirhistory`):
```bash
export DIR_HISTORY_FILE="~/.fzf_dirhistory"
```The `DIR_HISTORY_SIZE` environment variable sets the history maximum size (by
default `100`):
```bash
export DIR_HISTORY_SIZE=200
```## License
[GNU Lesser General Public License v2.1](https://github.com/ojroques/fzf-dirhistory/blob/main/LICENSE)