{"id":16878761,"url":"https://github.com/pavoljuhas/smart-change-directory","last_synced_at":"2025-06-13T10:35:57.392Z","repository":{"id":12474200,"uuid":"15141523","full_name":"pavoljuhas/smart-change-directory","owner":"pavoljuhas","description":"smart change of directory in a Unix shell, IPython and Vim","archived":false,"fork":false,"pushed_at":"2023-03-02T21:23:50.000Z","size":135,"stargazers_count":21,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T12:08:56.444Z","etag":null,"topics":["ipython","shell","zsh"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pavoljuhas.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2013-12-12T16:41:32.000Z","updated_at":"2024-10-01T20:45:45.000Z","dependencies_parsed_at":"2025-02-19T07:32:05.512Z","dependency_job_id":"1e77167d-0128-468e-a62e-074477446c33","html_url":"https://github.com/pavoljuhas/smart-change-directory","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/pavoljuhas/smart-change-directory","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavoljuhas%2Fsmart-change-directory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavoljuhas%2Fsmart-change-directory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavoljuhas%2Fsmart-change-directory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavoljuhas%2Fsmart-change-directory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pavoljuhas","download_url":"https://codeload.github.com/pavoljuhas/smart-change-directory/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavoljuhas%2Fsmart-change-directory/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259627902,"owners_count":22886945,"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":["ipython","shell","zsh"],"created_at":"2024-10-13T15:51:16.463Z","updated_at":"2025-06-13T10:35:57.356Z","avatar_url":"https://github.com/pavoljuhas.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# smart-change-directory (scd)\n\n[Z shell](http://www.zsh.org) function for visiting any directory in\na unix shell, [Vim](http://www.vim.org) or [IPython](http://ipython.org).\n\n`scd` is a Z shell (Zsh) script for changing to any directory with a few\nkeystrokes.  scd keeps history of the visited directories, which\nserves as an index of the known paths.  The directory index is updated after\nevery `cd` command in the shell and can be also filled manually by running\n`scd -a`.  To switch to some directory, scd needs few fragments of the\ndesired path to match with the index.  A selection menu is displayed in case\nof several matches, with a preference given to recently visited paths.\nscd can define persistent aliases, which match only their target paths.\n\n## SYNOPSIS\n\n```sh\nscd [options] [pattern1 pattern2 ...]\n```\n\n## PATTERNS\n\nPatterns may use all zsh [glob operators](\nhttp://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Operators)\navailable with *extendedglob* option.  Specified patterns must match\nthe absolute path and at least one of them must match in the tail.\nSeveral special patterns are also recognized as follows:\n\n\u003cdl\u003e\u003cdt\u003e\n^PAT\u003c/dt\u003e\u003cdd\u003e\n  PAT must match at the beginning of the path, for example, \"^/home\"\u003c/dd\u003e\u003cdt\u003e\nPAT$\u003c/dt\u003e\u003cdd\u003e\n  require PAT to match the end of the path, \"man$\"\u003c/dd\u003e\u003cdt\u003e\n./\u003c/dt\u003e\u003cdd\u003e\n  match only subdirectories of the current directory\u003c/dd\u003e\u003cdt\u003e\nPAT:\u003c/dt\u003e\u003cdd\u003e\n  require PAT to match over the tail component, \"doc:\", \"re/doc:\"\u003c/dd\u003e\n\u003c/dl\u003e\n\n\n## OPTIONS\n\n\u003cdl\u003e\u003cdt\u003e\n-a, --add\u003c/dt\u003e\u003cdd\u003e\n  add current or specified directories to the directory index.\n  For file arguments add their containing paths.\u003c/dd\u003e\u003cdt\u003e\n\n--unindex\u003c/dt\u003e\u003cdd\u003e\n  remove current or specified directories from the index.\u003c/dd\u003e\u003cdt\u003e\n\n-r, --recursive\u003c/dt\u003e\u003cdd\u003e\n  apply options \u003cem\u003e--add\u003c/em\u003e or \u003cem\u003e--unindex\u003c/em\u003e recursively.\u003c/dd\u003e\u003cdt\u003e\n\n--alias=ALIAS\u003c/dt\u003e\u003cdd\u003e\n  create alias for the current or specified directory and save it to\n  \u003cem\u003e~/.scdalias.zsh\u003c/em\u003e.\u003c/dd\u003e\u003cdt\u003e\n\n--unalias\u003c/dt\u003e\u003cdd\u003e\n  remove ALIAS definition for the current or specified directory from\n  \u003cem\u003e~/.scdalias.zsh\u003c/em\u003e.  Use \"OLD\" to purge aliases to non-existent\n  directories.\u003c/dd\u003e\u003cdt\u003e\n\n-A, --all\u003c/dt\u003e\u003cdd\u003e\n  display all directories even those excluded by patterns in\n  \u003cem\u003e~/.scdignore\u003c/em\u003e.  Disregard the unique matching for a\n  directory alias and filtering of less likely paths.\u003c/dd\u003e\u003cdt\u003e\n\n-p, --push\u003c/dt\u003e\u003cdd\u003e\n  use \"pushd\" to change to the target directory.\u003c/dd\u003e\u003cdt\u003e\n\n--list\u003c/dt\u003e\u003cdd\u003e\n  show matching directories and exit.\u003c/dd\u003e\u003cdt\u003e\n\n-v, --verbose\u003c/dt\u003e\u003cdd\u003e\n  display directory rank in the selection menu.\u003c/dd\u003e\u003cdt\u003e\n\n-h, --help\u003c/dt\u003e\u003cdd\u003e\n  display this options summary and exit.\u003c/dd\u003e\n\u003c/dl\u003e\n\n\n## INSTALLATION\n\n## Unix shell\n\n1.  Make sure that Z shell is installed.  On Linux it is usually the `zsh`\n    package.\n\n2.  Copy or symlink the [bin/scd](bin/scd) script to some directory\n    in the PATH.\n\n3.  Find out what shell is active for your account by running `ps -p $$`.\n\n4.  Edit the startup file for your shell and have it source the\n    corresponding scd setup file from [shellrcfiles](shellrcfiles)\n    as follows:\n\n    * *zsh*\n\n      ```zsh\n      # ~/.zshrc\n      source ~/Software/smart-change-directory/shellrcfiles/zshrc_scd\n      ```\n\n      Note that scd aliases are named directories in Zsh and can\n      be thus expanded as `~NAME` in the shell.  If you use the\n      [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)\n      framework you may just activate the `scd` plugin instead.\n\n    * *bash*\n\n      ```bash\n      # ~/.bashrc\n      source ~/Software/smart-change-directory/shellrcfiles/bashrc_scd\n      ```\n\n    * *tcsh*\n\n      ```sh\n      # ~/.cshrc\n      source ~/Software/smart-change-directory/shellrcfiles/tcshrc_scd\n      ```\n\n    * *dash*\n\n      ```sh\n      # add to ~/.profile or to the ${ENV} file\n      . ~/Software/smart-change-directory/shellrcfiles/dashrc_scd\n      ```\n\n## Examples\n\n```sh\n# Index recursively some paths for the very first run\nscd -ar ~/Documents/\n\n# Change to a directory path matching \"doc\"\nscd doc\n\n# Change to a path matching all of \"a\", \"b\" and \"c\"\nscd a b c\n\n# Change to a directory path that ends with \"ts\"\nscd \"ts$\"\n\n# Show selection menu and ranking of 20 most likely directories\nscd -v\n\n# Alias current directory as \"xray\"\nscd --alias=xray\n\n# Jump to a previously defined aliased directory\nscd xray\n```\n\n## Installation as Vim plugin\n\nPlease refer to https://github.com/pavoljuhas/scd.vim.\n\n## Installation as IPython extension\n\n1. Copy or symlink [ipython/ipy_scd.py](ipython/ipy_scd.py)\n   to some directory in Python module path.\n\n2. In IPython terminal session do `%load_ext ipy_scd`\n   to define the `%scd` magic command.  This also modifies the `%cd`,\n   `%pushd`, `%popd` magics to add directories to the scd index.  To load\n   `ipy_scd` for every IPython session, modify\n   `.../profile_default/ipython_config.py` so that it contains\n   ```Python\n   c.TerminalIPythonApp.extensions = ['ipy_scd']\n   ```\n\n3. If `scd` is not in the PATH, its location can be defined with\n   ```Python\n   import ipy_scd\n   ipy_scd.scd_executable = '/path/to/scd'\n   ```\n\n## Examples\n\n```Python\n# recursively index ~/.local/ and its subdirectories\n%scd -ar ~/.local\n\n# jump to the site-packages directory (if exists in ~/.local)\n%scd site pack\n```\n\n## FILES\n\n\u003cdl\u003e\u003cdt\u003e\n~/.scdhistory\u003c/dt\u003e\u003cdd\u003e\n    time-stamped index of visited directories.\u003c/dd\u003e\u003cdt\u003e\n\n~/.scdalias.zsh\u003c/dt\u003e\u003cdd\u003e\n    scd-generated definitions of directory aliases.\u003c/dd\u003e\u003cdt\u003e\n\n~/.scdignore\u003c/dt\u003e\u003cdd\u003e\n    \u003ca href=\"http://zsh.sourceforge.net/Doc/Release/Expansion.html#Glob-Operators\"\u003e\n    glob patterns\u003c/a\u003e for paths to be ignored in the scd search, for example,\n    \u003ccode\u003e/mnt/backup/*\u003c/code\u003e.  The patterns are specified one per line\n    and are matched assuming the \u003cem\u003eextendedglob\u003c/em\u003e zsh option.  Lines\n    starting with \"#\" are skipped as comments.  The .scdignore patterns\n    are not applied in the \u003cem\u003e--all\u003c/em\u003e mode.\u003c/dd\u003e\n\u003c/dl\u003e\n\n\n## ENVIRONMENT\n\n\u003cdl\u003e\u003cdt\u003e\nSCD_HISTFILE\u003c/dt\u003e\u003cdd\u003e\n    path to the scd index file (by default ~/.scdhistory).\u003c/dd\u003e\u003cdt\u003e\n\nSCD_HISTSIZE\u003c/dt\u003e\u003cdd\u003e\n    maximum number of entries in the index (5000).  Index is trimmed when it\n    exceeds \u003cem\u003eSCD_HISTSIZE\u003c/em\u003e by more than 20%.\u003c/dd\u003e\u003cdt\u003e\n\nSCD_MENUSIZE\u003c/dt\u003e\u003cdd\u003e\n    maximum number of items for directory selection menu (20).\u003c/dd\u003e\u003cdt\u003e\n\nSCD_MEANLIFE\u003c/dt\u003e\u003cdd\u003e\n    mean lifetime in seconds for exponential decay of directory\n    likelihood (86400).\u003c/dd\u003e\u003cdt\u003e\n\nSCD_THRESHOLD\u003c/dt\u003e\u003cdd\u003e\n    threshold for cumulative directory likelihood.  Directories with\n    a lower likelihood compared to the best match are excluded (0.005).\n    \u003c/dd\u003e\u003cdt\u003e\n\nSCD_SCRIPT\u003c/dt\u003e\u003cdd\u003e\n    command script file where scd writes the final \u003ccode\u003ecd\u003c/code\u003e\n    command.  This variable must be defined when scd runs in its own\n    process rather than as a shell function.  It is up to the\n    scd caller to use the output in \u003cem\u003eSCD_SCRIPT\u003c/em\u003e.\u003c/dd\u003e\n\u003c/dl\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpavoljuhas%2Fsmart-change-directory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpavoljuhas%2Fsmart-change-directory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpavoljuhas%2Fsmart-change-directory/lists"}