Skip to main content

Log recently visited directories for FZF

Project description

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

pip3 install --user fzf-dirhistory

Usage (with Bash)

Add this to your .bashrc to log directories as you visit them:

PROMPT_COMMAND='python3 -m fzfdirhist log "$(pwd)"'

Then add this function to call FZF with the history file as input:

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):

bind '"\eh": "\C-k\C-u fdh\n"'

Configuration

The DIR_HISTORY_FILE environment variable points to the history file (by default ~/.dirhistory):

export DIR_HISTORY_FILE="~/.fzf_dirhistory"

The DIR_HISTORY_SIZE environment variable sets the history maximum size (by default 100):

export DIR_HISTORY_SIZE=200

License

GNU Lesser General Public License v2.1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fzf-dirhistory-0.1.1.tar.gz (11.9 kB view hashes)

Uploaded Source

Built Distribution

fzf_dirhistory-0.1.1-py3-none-any.whl (12.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page