Skip to content

andrewferrier/memy

Repository files navigation

memy

Tests

memy is a modern, fast, and simple command-line tool to help you track and recall the files and directories you use most often. Many similar tools support only directories, but memy supports files too. Inspired by fasd, memy (with the aid of hooks into your favourite tools) remembers the paths you interact with, lists them back to you by a combination of frequency and recency ("frecency"), and makes it easy to build a workflow around them using standard Linux/Unix tools.

Unlike tools such as zoxide, memy is less focused on providing a direct "jump" command for navigating directories. Instead, memy is designed to be a flexible backend for tracking your usage, which you can combine with tools like fzf and cd to jump around directories if you wish. Crucially, memy also supports tracking files you use - not just directories - unlike most other tools in this space (except for fasd, which for a longer time was not maintained).

memy is ideal for developers, sysadmins, CLI power users, and anyone who works with many files and directories and wants a smarter way to recall them.

Currently, memy has been tested on Linux and MacOS (limited). It has not been tested on Windows, any testing or feedback would be appreciated.

Quick Start

  • Note a file or directory:

    memy note <path>

    You are free to note a path whenever you wish, although typically this is done by the supplied hooks (see more information below).

  • List all remembered paths (in frecency order):

    memy list

Many of these more advanced tricks would work well configured as shell aliases:

  • Change to a directory from your remembered paths using fzf as a wrapper:

    cd $(memy list -d | fzf)
  • Change to the most frecent directory containing the string 'download' (case-insensitive):

    cd $(memy list -d | grep -i download | tail -1)
  • Open a recently used file in your editor, selecting it using fzf (assuming your editor is vim).

    vim "$(memy list -f | fzf)"
  • (On Linux) Open a recently used path in your GUI file manager:

    xdg-open "$(memy list -d | fzf)"

memy will import your database from fasd and/or zoxide, if there is one, on first run (this behaviour can be disabled in the configuration file).

Noting files automatically using hooks

Hooks in memy are scripts or other configuration files provided with memy that can be embedded into other tools' configurations. These hooks allow you to automatically note files as they are used, opened, or interacted with, integrating memy seamlessly into your workflow.

For example, you might use a hook to automatically note files opened in your text editor or accessed via the command line, or directories you change to in your shell. Hooks are designed to be a starting point only and can be customized to suit your specific needs and preferences. Over time, we plan to grow the list of hooks available. Any contributions to the predefined hooks available would be very welcome as issues or pull requests on this repository.

Using Hooks

To see the list of current hooks provided by memy, type memy hook.

To see the contents of a hook, type memy hook <hookname>. In future, we'll provide an easier way to automatically install some hooks. For now, the provided hooks can be installed like this (please be careful to make sure you backup any configuration files etc. before running these commands to avoid mishaps):

Hook Name How to Install
bash Add eval $(memy hook bash) to ~/.bashrc or similar
fish.fish Run memy hook fish.fish >> ~/.config/fish/config.fish
lfrc Run memy hook lfrc >> ~/.config/lf/lfrc
neovim.lua Run memy hook neovim.lua > ~/.config/nvim/plugin/memy.lua
ranger.rc.conf Run memy hook ranger.rc.conf >> ~/.config/ranger/rc.conf
vim.vim Run memy hook vim.vim > ~/.vim/plugin/memy.vim
zsh Add source <(memy hook zsh) to ~/.zshrc or similar

Installation

Download Debian / Ubuntu .deb-based package

Install using dpkg or apt. Currently, Debian packages are not in a signed repository.

Download RHEL / Fedora / CentOS / OpenSUSE / SLES .rpm-based package

How to install RPMs.

Download Binaries for Linux or MacOS from GitHub

The binaries for MacOS are not currently signed, and so you will have to work around this.

Download the appropriate binary for your platform, place it somewhere in your $PATH, and make it executable if necessary. For example:

chmod +x memy-<platform-arch>
mv memy-<platform-arch> /usr/local/bin/memy

Install via Cargo (from Source)

If you have Cargo installed, you can install memy directly from the very latest source (main branch). This version may have more recent changes than the packaged versions linked above and so may be more unstable.

cargo install --git https://github.com/andrewferrier/memy

Don't have Cargo?

Cargo is Rust's package manager and build tool. The easiest way to get Cargo (and Rust) is to use rustup, which works on Linux, macOS, and Windows. See the official instructions.

Configuration & Under the Hood

By default, memy looks for its config file at $XDG_CONFIG_HOME/memy/memy.toml (typically ~/.config/memy/memy.toml). You can override the config location by setting the MEMY_CONFIG_DIR environment variable to a directory of your choice.

You can generate a default (template) config file on stdout like this:

memy generate-config

If you don't already have a config file, you can create one in the default location like this (be careful not to overwrite one that already exists):

memy generate-config > ~/.config/memy/memy.toml

The config file will be annotated with comments explaining what each option does.

By default, memy stores its cache data in $XDG_STATE_HOME/memy/memy.sqlite3 (typically ~/.local/state/memy/memy.sqlite3). You can override the database location by setting the MEMY_DB_DIR environment variable to a directory of your choice.

More Information

  • For a full list of commands and flags, run memy --help. If you are using one of the .deb-packaged versions of memy, you can also bring up the manpage: man memy.

  • For release notes, see CHANGELOG.md

  • Issues and contributions welcome at https://github.com/andrewferrier/memy

Comparison with Similar Tools

Here's how memy compares to other popular directory/file jump and tracking tools:

Feature memy zoxide autojump z fasd fasder
Platforms supported ✅ (Linux, macOS) ✅ (Linux, macOS, Windows) ✅ (Linux, macOS, Windows) ✅ (Linux, macOS, Windows) ✅ (Linux, macOS, Windows) ✅ (Linux, macOS, Windows)
Tracks Files
Tracks Directories
Actively Maintained Last commit Last commit Last commit Last commit Last commit Last commit
Customizable ✅ (TOML config) ✅ (config file & env vars) ✅ (Some) ❌ (Limited) ❌ (Limited) ✅ (config file & env vars)
Database Format SQLite SQLite Text Text Text Text
Written in Rust Rust Python Shell Shell Go

About

Track and recall frequently and recently used files or directories

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages