{"id":13414679,"url":"https://github.com/clvv/fasd","last_synced_at":"2025-03-14T22:32:00.229Z","repository":{"id":2004443,"uuid":"2938132","full_name":"clvv/fasd","owner":"clvv","description":"Command-line productivity booster, offers quick access to files and directories, inspired by autojump, z and v.","archived":true,"fork":false,"pushed_at":"2020-06-04T18:44:10.000Z","size":943,"stargazers_count":5892,"open_issues_count":114,"forks_count":222,"subscribers_count":79,"default_branch":"master","last_synced_at":"2024-07-31T21:53:11.603Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clvv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-12-08T05:48:07.000Z","updated_at":"2024-07-30T00:04:16.000Z","dependencies_parsed_at":"2022-08-08T04:00:02.220Z","dependency_job_id":null,"html_url":"https://github.com/clvv/fasd","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clvv%2Ffasd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clvv%2Ffasd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clvv%2Ffasd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clvv%2Ffasd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clvv","download_url":"https://codeload.github.com/clvv/fasd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243658054,"owners_count":20326459,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T21:00:32.714Z","updated_at":"2025-03-14T22:31:59.912Z","avatar_url":"https://github.com/clvv.png","language":"Shell","readme":"# Fasd\n\nFasd (pronounced similar to \"fast\") is a command-line productivity booster.\nFasd offers quick access to files and directories for POSIX shells. It is\ninspired by tools like [autojump](https://github.com/joelthelion/autojump),\n[z](http://github.com/rupa/z) and [v](https://github.com/rupa/v). Fasd keeps\ntrack of files and directories you have accessed, so that you can quickly\nreference them in the command line.\n\nThe name fasd comes from the default suggested aliases `f`(files),\n`a`(files/directories), `s`(show/search/select), `d`(directories).\n\nFasd ranks files and directories by \"frecency,\" that is, by both \"frequency\" and\n\"recency.\" The term \"frecency\" was first coined by Mozilla and used in Firefox\n([link](https://developer.mozilla.org/en/The_Places_frecency_algorithm)).\n\n# Introduction\n\nIf you use your shell to navigate and launch applications, fasd can help you do\nit more efficiently. With fasd, you can open files regardless of which\ndirectory you are in. Just with a few key strings, fasd can find a \"frecent\"\nfile or directory and open it with command you specify. Below are some\nhypothetical situations, where you can type in the command on the left and fasd\nwill \"expand\" your command into the right side. Pretty magic, huh?\n\n```\n  v def conf       =\u003e     vim /some/awkward/path/to/type/default.conf\n  j abc            =\u003e     cd /hell/of/a/awkward/path/to/get/to/abcdef\n  m movie          =\u003e     mplayer /whatever/whatever/whatever/awesome_movie.mp4\n  o eng paper      =\u003e     xdg-open /you/dont/remember/where/english_paper.pdf\n  vim `f rc lo`    =\u003e     vim /etc/rc.local\n  vim `f rc conf`  =\u003e     vim /etc/rc.conf\n```\n\nFasd comes with some useful aliases by default:\n\n```sh\nalias a='fasd -a'        # any\nalias s='fasd -si'       # show / search / select\nalias d='fasd -d'        # directory\nalias f='fasd -f'        # file\nalias sd='fasd -sid'     # interactive directory selection\nalias sf='fasd -sif'     # interactive file selection\nalias z='fasd_cd -d'     # cd, same functionality as j in autojump\nalias zz='fasd_cd -d -i' # cd with interactive selection\n```\n\nFasd will smartly detect when to display a list of files or just the best\nmatch. For instance, when you call fasd in a subshell with some search\nparameters, fasd will only return the best match. This enables you to do:\n\n```sh\nmv update.html `d www`\ncp `f mov` .\n```\n\n# Install\n\nFasd is available in various package managers. Please check\n[the wiki page](https://github.com/clvv/fasd/wiki/Installing-via-Package-Managers)\nfor an up-to-date list.\n\nYou can also manually obtain a copy of fasd.\n\nDownload fasd 1.0.1 from GitHub:\n[zip](https://github.com/clvv/fasd/zipball/1.0.1),\n[tar.gz](https://github.com/clvv/fasd/tarball/1.0.1).\n\nFasd is a self-contained POSIX shell script that can be either sourced or\nexecuted. A Makefile is provided to install `fasd` and `fasd.1` to desired\nplaces.\n\nSystem-wide install:\n\n    make install\n\nInstall to $HOME:\n\n    PREFIX=$HOME make install\n\nOr alternatively you can just copy `fasd` to anywhere you like (preferably\nunder some directory in `$PATH`).\n\nTo get fasd working in a shell, some initialization code must be run. Put the\nline below in your shell rc.\n\n```sh\neval \"$(fasd --init auto)\"\n```\n\nThis will setup a command hook that executes on every command and advanced tab\ncompletion for zsh and bash.\n\nIf you want more control over what gets into your shell environment, you can\npass customized set of arguments to `fasd --init`.\n\n```\nzsh-hook             # define _fasd_preexec and add it to zsh preexec array\nzsh-ccomp            # zsh command mode completion definitions\nzsh-ccomp-install    # setup command mode completion for zsh\nzsh-wcomp            # zsh word mode completion definitions\nzsh-wcomp-install    # setup word mode completion for zsh\nbash-hook            # add hook code to bash $PROMPT_COMMAND\nbash-ccomp           # bash command mode completion definitions\nbash-ccomp-install   # setup command mode completion for bash\nposix-alias          # define aliases that applies to all posix shells\nposix-hook           # setup $PS1 hook for shells that's posix compatible\ntcsh-alias           # define aliases for tcsh\ntcsh-hook            # setup tcsh precmd alias\n```\n\nExample for a minimal zsh setup (no tab completion):\n\n```sh\neval \"$(fasd --init posix-alias zsh-hook)\"\n```\n\nNote that this method will slightly increase your shell start-up time, since\ncalling binaries has overhead. You can cache fasd init code if you want minimal\noverhead. Example code for bash (to be put into .bashrc):\n\n```sh\nfasd_cache=\"$HOME/.fasd-init-bash\"\nif [ \"$(command -v fasd)\" -nt \"$fasd_cache\" -o ! -s \"$fasd_cache\" ]; then\n  fasd --init posix-alias bash-hook bash-ccomp bash-ccomp-install \u003e| \"$fasd_cache\"\nfi\nsource \"$fasd_cache\"\nunset fasd_cache\n```\n\nOptionally, if you can also source `fasd` if you want `fasd` to be a shell\nfunction instead of an executable.\n\nYou can tweak initialization code. For instance, if you want to use \"c\"\ninstead of \"z\" to do directory jumping, you can use the alias below:\n\n```sh\nalias c='fasd_cd -d'\n# `-d` option present for bash completion\n# function fasd_cd is defined in posix-alias\n```\n\nAfter you first installed fasd, open some files (with any program) or `cd`\naround in your shell. Then try some examples below.\n\n# Examples\n\n```sh\nf foo           # list frecent files matching foo\na foo bar       # list frecent files and directories matching foo and bar\nf js$           # list frecent files that ends in js\nf -e vim foo    # run vim on the most frecent file matching foo\nmplayer `f bar` # run mplayer on the most frecent file matching bar\nz foo           # cd into the most frecent directory matching foo\nopen `sf pdf`   # interactively select a file matching pdf and launch `open`\n```\n\nYou should add your own aliases to fully utilize the power of fasd. Here are\nsome examples to get you started:\n\n```sh\nalias v='f -e vim' # quick opening files with vim\nalias m='f -e mplayer' # quick opening files with mplayer\nalias o='a -e xdg-open' # quick opening files with xdg-open\n```\n\nIf you're using bash, you have to call `_fasd_bash_hook_cmd_complete` to make\ncompletion work. For instance:\n\n    _fasd_bash_hook_cmd_complete v m j o\n\nYou could select an entry in the list of matching files.\n\n# Matching\n\nFasd has three matching modes: default, case-insensitive, and fuzzy.\n\nFor a given set of queries (the set of command-line arguments passed to fasd),\na path is a match if and only if:\n\n1. Queries match the path *in order*.\n2. The last query matches the *last segment* of the path.\n\nIf no match is found, fasd will try the same process ignoring case. If still no\nmatch is found, fasd will allow extra characters to be placed between query\ncharacters for fuzzy matching.\n\nTips:\n\n* If you want your last query not to match the last segment of the path, append\n  `/` as the last query.\n* If you want your last query to match the end of the filename, append `$` to\n  the last query.\n\n# How It Works\n\nWhen you run fasd init code or source `fasd`, fasd adds a hook which will be\nexecuted whenever you execute a command. The hook will scan your commands'\narguments and determine if any of them refer to existing files or directories.\nIf yes, fasd will add them to the database.\n\n# Compatibility\n\nFasd's basic functionalities are POSIX compliant, meaning that you should be\nable to use fasd in all POSIX compliant shells. Your shell need to support\ncommand substitution in `$PS1` in order for fasd to automatically track your\ncommands and files. This feature is not specified by the POSIX standard, but\nit's nonetheless present in many POSIX compliant shells. In shells without\nprompt command or prompt command substitution (csh for instance), you can add\nentries manually with `fasd -A`. You are very welcomed to contribute shell\ninitialization code for not yet supported shells.\n\nFasd has been tested on the following shells: bash, zsh, mksh, pdksh, dash,\nbusybox ash, FreeBSD 9 /bin/sh and OpenBSD /bin/sh.\n\n# Synopsis\n\n    fasd [options] [query ...]\n    [f|a|s|d|z] [options] [query ...]\n      options:\n        -s         list paths with scores\n        -l         list paths without scores\n        -i         interactive mode\n        -e \u003ccmd\u003e   set command to execute on the result file\n        -b \u003cname\u003e  only use \u003cname\u003e backend\n        -B \u003cname\u003e  add additional backend \u003cname\u003e\n        -a         match files and directories\n        -d         match directories only\n        -f         match files only\n        -r         match by rank only\n        -t         match by recent access only\n        -R         reverse listing order\n        -h         show a brief help message\n        -[0-9]     select the nth entry\n\n    fasd [-A|-D] [paths ...]\n        -A    add paths\n        -D    delete paths\n\n# Tab Completion\n\nFasd offers two completion modes, command mode completion and word mode\ncompletion. Command mode completion works in bash and zsh. Word mode\ncompletion only works in zsh.\n\nCommand mode completion is just like completion for any other commands. It is\ntriggered when you hit tab on a `fasd` command or its aliases. Under this mode\nyour queries can be separated by a space. Tip: if you find that the completion\nresult overwrites your queries, type an extra space before you hit tab.\n\nWord mode completion can be triggered on *any* command. Word completion is\ntriggered by any command line argument that starts with `,` (all), `f,`\n(files), or `d,` (directories), or that ends with `,,` (all), `,,f` (files), or\n`,,d` (directories). Examples:\n\n    $ vim ,rc,lo\u003cTab\u003e\n    $ vim /etc/rc.local\n\n    $ mv index.html d,www\u003cTab\u003e\n    $ mv index.html /var/www/\n\nThere are also three zle widgets: `fasd-complete`, `fasd-complete-f`,\n`fasd-complete-d`. You can bind them to keybindings you like:\n\n```sh\nbindkey '^X^A' fasd-complete    # C-x C-a to do fasd-complete (files and directories)\nbindkey '^X^F' fasd-complete-f  # C-x C-f to do fasd-complete-f (only files)\nbindkey '^X^D' fasd-complete-d  # C-x C-d to do fasd-complete-d (only directories)\n```\n\n# Backends\n\nFasd can take advantage of different sources of recent / frequent files. Most\ndesktop environments (such as OS X and Gtk) and some editors (such as Vim) keep\na list of accessed files. Fasd can use them as additional backends if the data\ncan be converted into fasd's native format. Below is a list of available\nbackends.\n\n```\n`spotlight`\nOSX spotlight, provides entries that are changed today or opened within the\npast month\n\n`recently-used`\nGTK's recently-used file (Usually available on Linux)\n\n`current`\nProvides everything in $PWD (whereever you are executing `fasd`)\n\n`viminfo`\nVim's editing history, useful if you want to define an alias just for editing\nthings in vim\n```\n\nYou can define your own backend by declaring a function by that name in your\n`.fasdrc`. You can set default backend with `_FASD_BACKENDS` variable in our\n`.fasdrc`.\n\nFasd can mimic [v](http://github.com/rupa/v)'s behavior by this alias:\n\n```sh\nalias v='f -t -e vim -b viminfo'\n```\n\n# Tweaks\n\nSome shell variables that you can set before sourcing `fasd`. You can set them\nin `$HOME/.fasdrc`\n\n```\n$_FASD_DATA\nPath to the fasd data file, default \"$HOME/.fasd\".\n\n$_FASD_BLACKLIST\nList of blacklisted strings. Commands matching them will not be processed.\nDefault is \"--help\".\n\n$_FASD_SHIFT\nList of all commands that needs to be shifted, defaults to \"sudo busybox\".\n\n$_FASD_IGNORE\nList of all commands that will be ignored, defaults to \"fasd ls echo\".\n\n$_FASD_TRACK_PWD\nFasd defaults to track your \"$PWD\". Set this to 0 to disable this behavior.\n\n$_FASD_AWK\nWhich awk to use. Fasd can detect and use a compatible awk.\n\n$_FASD_SINK\nFile to log all STDERR to, defaults to \"/dev/null\".\n\n$_FASD_MAX\nMax total score / weight, defaults to 2000.\n\n$_FASD_SHELL\nWhich shell to execute. Some shells will run faster than others. fasd\nruns faster with dash and ksh variants.\n\n$_FASD_BACKENDS\nDefault backends.\n\n$_FASD_RO\nIf set to any non-empty string, fasd will not add or delete entries from\ndatabase. You can set and export this variable from command line.\n\n$_FASD_FUZZY\nLevel of \"fuzziness\" when doing fuzzy matching. More precisely, the number of\ncharacters that can be skipped to generate a match. Set to empty or 0 to\ndisable fuzzy matching. Default value is 2.\n\n$_FASD_VIMINFO\nPath to .viminfo file for viminfo backend, defaults to \"$HOME/.viminfo\"\n\n$_FASD_RECENTLY_USED_XBEL\nPath to XDG recently-used.xbel file for recently-used backend, defaults to\n\"$HOME/.local/share/recently-used.xbel\"\n\n```\n\n# Debugging\n\nIf fasd does not work as expected, please file a bug report describing the\nunexpected behavior along with your OS version, shell version, awk version, sed\nversion, and a log file.\n\nYou can set `_FASD_SINK` in your `.fasdrc` to obtain a log.\n\n```sh\n_FASD_SINK=\"$HOME/.fasd.log\"\n```\n\n# COPYING\n\nFasd is originally written based on code from [z](https://github.com/rupa/z) by\nrupa deadwyler under the WTFPL license. Most if not all of the code has been\nrewritten. Fasd is licensed under the \"MIT/X11\" license.\n\n","funding_links":[],"categories":["Shell","Terminal","Command-Line Productivity","Command Line","Directory Navigation","others","Uncategorized","Tools","\u003ca name=\"cd\"\u003e\u003c/a\u003eDirectory changers (alternatives to cd)","Cryptocurrency","Other","Resources"],"sub_categories":["Visual Studio Code","Dependency Management","OS X","Uncategorized","Command line","Command-Line Tools"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclvv%2Ffasd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclvv%2Ffasd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclvv%2Ffasd/lists"}