{"id":18887603,"url":"https://github.com/clarity20/fasder","last_synced_at":"2025-10-04T09:38:48.240Z","repository":{"id":179386501,"uuid":"65260606","full_name":"clarity20/fasder","owner":"clarity20","description":"A descendant of fasd offering faster performance on Windows/Cygwin and (eventually) more... ","archived":false,"fork":false,"pushed_at":"2020-10-25T01:33:58.000Z","size":51,"stargazers_count":7,"open_issues_count":6,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T10:54:21.409Z","etag":null,"topics":["bash","command-line-tool","cygwin","fasd","shell","shell-extension"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"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/clarity20.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-09T03:42:26.000Z","updated_at":"2023-09-08T17:13:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"8853fa86-3423-4451-9a41-fc8b958edd70","html_url":"https://github.com/clarity20/fasder","commit_stats":null,"previous_names":["clarity20/fasder"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarity20%2Ffasder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarity20%2Ffasder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarity20%2Ffasder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarity20%2Ffasder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clarity20","download_url":"https://codeload.github.com/clarity20/fasder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248973308,"owners_count":21191940,"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":["bash","command-line-tool","cygwin","fasd","shell","shell-extension"],"created_at":"2024-11-08T07:38:37.816Z","updated_at":"2025-10-04T09:38:48.213Z","avatar_url":"https://github.com/clarity20.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fasder\n\nA descendant of Wei Dai's [fasd](https://github.com/clvv/fasd) project offering\nimproved performance on Cygwin/Windows and (eventually) more... \n\n_Fasder_ (approximate pronunciation \"faster\") is a command-line productivity\nbooster that offers quick jumping and naming access to files and directories\nat the POSIX shell prompt. _Fasder_ tracks your command history to give priority\naccess to the files you've accessed most often or most recently.\n_Fasder_ is a direct descendant of [fasd](https://github.com/clvv/fasd) which was\ninspired by tools like [autojump](https://github.com/joelthelion/autojump),\n[z](http://github.com/rupa/z) and [v](https://github.com/rupa/v). \n\n_fasder_ (and its ancestor _fasd_) takes its name from the convenient default\naliases that provide most of _fasder_'s functionality:\n* `f`(files),\n* `a`(all, i.e. files/directories)\n* `s`(show/search/select interactively)\n* `d`(directories).\n\n_Fasder_ ranks files and directories by \"frecency,\" that is, by a combination of\n\"frequency\" and \"recency.\" The term \"frecency\" was coined by Mozilla and is\nused 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, _fasder_ can help you\ndo so more efficiently. With _fasder_, you can open files from any directory.\n_Fasder_ can find a \"frecent\" file or directory and open it with the command you\nspecify. Here are some scenarios where the _fasder_ command on the left \nwill expand to the shell command on the right. Pretty magical, 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\n_Fasder_ comes with some useful aliases by default:\n\n```sh\nalias a='fasder -a'        # any\nalias s='fasder -si'       # show / search / select\nalias d='fasder -d'        # directory\nalias f='fasder -f'        # file\nalias sd='fasder -sid'     # interactive directory selection\nalias sf='fasder -sif'     # interactive file selection\nalias z='fasder_cd -d'     # cd, same functionality as j in autojump\nalias zz='fasder_cd -d -i' # cd with interactive selection\n```\n\nFasder will smartly detect when to display a list of files or just the best\nmatch. For instance, when you call fasder in a subshell with some search\nparameters, fasder 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\nFasder is a self-contained POSIX shell script that can be either sourced or\nexecuted. A Makefile is provided to install `fasder` and `fasder.1` to the\ndesired places.\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 `fasder` anywhere you like (preferably\nunder some directory in your `$PATH`).\n\nTo get fasder working in a shell, some initialization code must be run. Put the\nfollowing line in your shell rc:\n\n```sh\neval \"$(fasder --init auto)\"\n```\n\nThis will setup a command hook that executes on every command as well as\nadvanced tab completion for zsh and bash.\n\nIf you want more control over what gets into your shell environment, you can\npass a customized set of arguments to `fasder --init`.\n\n```\nzsh-hook             # define _fasder_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 \"$(fasder --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 fasder init code if you want minimal\noverhead. Example code for bash (to be put into .bashrc):\n\n```sh\nfasd_cache=\"$HOME/.fasder-init-bash\"\nif [ \"$(command -v fasder)\" -nt \"$fasd_cache\" -o ! -s \"$fasd_cache\" ]; then\n  fasder --init posix-alias bash-hook bash-ccomp bash-ccomp-install \u003e| \"$fasd_cache\"\nfi\nsource \"$fasd_cache\"\nunset fasd_cache\n```\n\nOptionally, you can also source `fasder` if you want `fasder` to be a shell\nfunction instead of an executable.\n\nYou can tweak the 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='fasder_cd -d'\n# `-d` option present for bash completion\n# function fasder_cd is defined in posix-alias\n```\n\nAfter you install fasder, warm up the fasder database by opening some files\n(with any program) as you `cd` around your filesystem. Then try some of the\nexamples 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 can add your own aliases to fully utilize the power of fasder. 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 `_fasder_bash_hook_cmd_complete` to make\ncompletion work. For instance:\n\n    _fasder_bash_hook_cmd_complete v m j o\n\nYou can select an entry in the list of matching files.\n\n# Matching\n\nFasder has three matching modes: default, case-insensitive, and fuzzy.\n\nFor a given set of queries (groups of command-line arguments passed to fasder),\na pathname 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, fasder will try the same process ignoring case. Failing\nthis, fasder 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  `/` to 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 initialize the fasder system (typically through your shell config\nscripts), fasder creates a hook function which will be executed after \nevery shell command. The hook will scan your commands for file\nand directory names and add them to its database. \n\n# Compatibility\n\nFasder's basic functionalities are POSIX compliant, meaning that you should be\nable to _use_ fasder in all POSIX compliant shells. Your shell needs to support\ncommand substitution in `$PS1` in order to automatically track your\ncommands and files. This feature is not specified by the POSIX standard, but\nis present in many POSIX-compliant shells. In shells without\nprompt command or prompt command substitution (csh for instance), you can add\nentries manually with `fasder -A`. You are most welcome to contribute shell\ninitialization code for shells not yet supported.\n\nFasder has been tested on the following shells: bash, zsh, mksh, pdksh, dash,\nbusybox ash, FreeBSD 9 /bin/sh and OpenBSD /bin/sh.\n\nFasder is written in bash-4.1; you need a bash interpreter at least as new.\nBasically, we've traded in the POSIX compatibility of _fasd_ for Bash's greater\nrange of built-in features to \"squeeze\" the script for faster performance.\n\n# Synopsis\n\n    fasder [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    fasder [-A|-D] [paths ...]\n        -A    add paths\n        -D    delete paths\n\n# Tab Completion\n\nFasder offers two completion modes: command completion and word \ncompletion. Command completion works in bash and zsh. Word \ncompletion only works in zsh.\n\nCommand completion is just like completion for any other command. 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 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: `fasder-complete`, `fasder-complete-f`,\n`fasder-complete-d`. You can bind them to any keybindings you like:\n\n```sh\nbindkey '^X^A' fasder-complete    # C-x C-a to do fasder-complete (files and directories)\nbindkey '^X^F' fasder-complete-f  # C-x C-f to do fasder-complete-f (only files)\nbindkey '^X^D' fasder-complete-d  # C-x C-d to do fasder-complete-d (only directories)\n```\n\n# Backends\n\nFasder 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. Fasder can use them as additional backends if the data\ncan be converted into fasder's native format. Below is a list of available\nbackends.\n\n```\n`spotlight`\nOSX spotlight, provides entries that were 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 (wherever you are executing `fasder`)\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 your\n`.fasdrc`.\n\nFasder 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# Configuration settings\n\nThe following shell variables can be set before sourcing `fasder`. You can set them\nin `$HOME/.fasdrc`\n\n```\n$_FASD_DATA\nPath to the fasder 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 command names that need to be shifted; defaults to \"sudo busybox\".\n\n$_FASD_IGNORE\nList of all commands that will be ignored; defaults to \"fasder ls echo\".\n\n$_FASD_TRACK_PWD\nFasder tracks your \"$PWD\" by default. Set this to 0 to disable this behavior.\n\n$_FASD_AWK\nThe awk program to use. Fasder can detect and use a compatible awk.\n\n$_FASD_SINK\nLog file to capture the standard error; defaults to \"/dev/null\".\n\n$_FASD_MAX\nMaximum total score / weight; defaults to 2000.\n\n$_FASD_SHELL\nThe shell to execute. Some shells will run faster than others. fasder\nruns faster with dash and ksh variants.\n\n$_FASD_BACKENDS\nDefault backends. (See the \"backends\" section above.)\n\n$_FASD_RO\nIf set to any non-empty string, fasder will not add or delete entries from\nthe database. You can set and export this variable from the 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 fasder 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\nFasder is adapted from Wei Dai's [fasd](https://github.com/clvv/fasd) project.\nFasd is 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. Fasder is licensed under the \"MIT/X11\" license.\n\n###### This document is adapted from the README for the original fasd project.\n\n# Please see also:\n\n[Thoughts about a faster \"fasder\"](https://github.com/clarity20/fasder/wiki/Thoughts-about-a-faster-%22fasder%22)\n\n### TODO\n\n* Discuss the optimization strategies employed.\n* Discuss the remaining bottlenecks in the prompt hook: the call to mapfile,\nthe \"heaviness\" of forking a process under Cygwin, and the extra burden when \ncontext-switching into a Cygwin shell (especially the DLLs) from the outside.\n* Optimization work thus far has focused on the prompt hook and the `--add`\nand `--query` options. For the other options, there is still plenty of low-hanging\nfruit.\n* There are many style issues: Comments and variable names can be made better,\nfor example. Sub-functions can be extracted. Low-hanging fruit here too.\n* Implement a --clean option to delete duplicate entries and entries no longer\npresent in the filesystem\n* Inventory the open issues and PRs of the original fasd project\nfor anything we might wish to address here.\n* Develop a more thorough, systematic testing process. There are two classes of use cases:\n(1) the hidden action of the \\_fasder_prompt_func (the prompt hook) and \n(2) the explicit invocation of fasder or its short aliases. Regarding the former,\nthe script's dependency on a `PROMPT_COMMAND` whose exact behavior\nchanges whenever we edit the script makes testing challenging; the situation is akin to\nthe observer effect familiar to physicists. As a workaround, we could\nstructure our test rig to invoke \"fasder --proc \u003ccmd\u003e\" directly for each test\ncase while we monitor the effects this has on a suitably mocked-up data file.\nOTOH, the \"type 2\" use cases wherein fasder is explicitly called should be easier to test.\n* The original fasd contains notes about downloading it through package managers \nor the project website. Consider pursuing either or both of these for fasder.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclarity20%2Ffasder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclarity20%2Ffasder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclarity20%2Ffasder/lists"}