{"id":31074145,"url":"https://github.com/hagatasdelus/babbr","last_synced_at":"2026-05-18T04:38:55.557Z","repository":{"id":314531723,"uuid":"1045821881","full_name":"hagatasdelus/babbr","owner":"hagatasdelus","description":"Abbreviation extension plugins for bash","archived":false,"fork":false,"pushed_at":"2025-09-13T01:49:21.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-13T03:24:21.336Z","etag":null,"topics":["bash","bash-plugin","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","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/hagatasdelus.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-27T19:01:11.000Z","updated_at":"2025-09-13T01:49:25.000Z","dependencies_parsed_at":"2025-09-13T03:24:24.600Z","dependency_job_id":"2526b73d-118b-47a4-9b1c-ef9c874cbe73","html_url":"https://github.com/hagatasdelus/babbr","commit_stats":null,"previous_names":["hagatasdelus/babbr"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/hagatasdelus/babbr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hagatasdelus%2Fbabbr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hagatasdelus%2Fbabbr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hagatasdelus%2Fbabbr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hagatasdelus%2Fbabbr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hagatasdelus","download_url":"https://codeload.github.com/hagatasdelus/babbr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hagatasdelus%2Fbabbr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33165079,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T22:39:12.733Z","status":"online","status_checked_at":"2026-05-18T02:00:06.436Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","bash-plugin","go","golang"],"created_at":"2025-09-16T02:03:48.589Z","updated_at":"2026-05-18T04:38:55.552Z","avatar_url":"https://github.com/hagatasdelus.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# babbr\n\n[![CI](https://github.com/hagatasdelus/babbr/actions/workflows/ci.yml/badge.svg)](https://github.com/hagatasdelus/babbr/actions)\n\nFish shell-style abbreviations for bash, providing an experience inspired by fish's abbr functionality.\n\n## Installation\n\n```bash\ngo install github.com/hagatasdelus/babbr@latest\n```\n\nExecute the following line or add it to `$HOME/.bashrc`:\n\n```bash\neval \"$(babbr init)\"\n```\n\n## Usage\n\n\u003e **Note**\n\u003e A minor visual flicker may occur during abbreviation expansion. This is a known limitation of the `bind -x` macro within Bash's readline library.  This behavior does not impact the functionality of the tool.\n\n### Configuration\n\nConfiguration can be done with a `config.yaml` file.\n\nYou can see all currently defined abbreviations by running.\n\n```bash\nbabbr list\n```\n\n### Example for config.yaml\n\nLocation of config.yaml is:\n\n- UNIX: `$XDG_CONFIG_HOME/babbr/config.yaml` or `$HOME/.config/babbr/config.yaml`\n- Windows: `%APPDATA%\\babbr\\config.yaml`\n\n```yaml\nabbreviations:\n  # I. Basic abbreviations (alias usage)\n  - name: list files with details\n    abbr: l\n    snippet: ls -l\n\n  - name: list all files with details\n    abbr: la\n    snippet: ls -la\n\n  - name: clear screen\n    abbr: cls\n    snippet: clear\n\n  # II. Global abbreviation (expanded anywhere on command line)\n  - name: Redirect stdout and stderr to /dev/null\n    abbr: \"null\"\n    snippet: \"\u003e/dev/null 2\u003e\u00261\"\n    options:\n      # `position: anywhere` allows expansion anywhere in the row\n      position: anywhere\n\n  - name: Pipe to less\n    abbr: L\n    snippet: \"| less\"\n    options:\n      position: anywhere\n\n  # III. Context-aware abbreviations\n  - name: git status\n    abbr: s\n    snippet: status\n    options:\n      position: anywhere\n      # By `command: git`, it is expanded only as an argument to the `git` command\n      command: git\n\n  - name: git commit\n    abbr: c\n    snippet: commit\n    options:\n      position: anywhere\n      command: git\n\n  - name: git commit with message\n    abbr: cm\n    snippet: \"commit -m '%'\"\n    options:\n      position: anywhere\n      command: git\n      # 'set_cursor: true' will move the cursor to the `%` position after expansion\n      set_cursor: true\n\n  - name: git add all\n    abbr: a\n    snippet: \"add .\"\n    options:\n      position: anywhere\n      command: git\n\n  - name: git push current branch to origin (dynamic)\n    abbr: po\n    snippet: \"push origin $(git symbolic-ref --short HEAD)\"\n    options:\n      position: anywhere\n      command: git\n      # `evaluate: true` causes the command in the snippet to be executed and its standard output to be expanded\n      evaluate: true\n\n  # IV. Conditional and environmentally-aware abbreviations\n  - name: Use trash-cli if available\n    abbr: del\n    snippet: trash\n    options:\n      # This abbreviation is valid only if `condition` is true (the trash command is present)\n      # The string is executed in a shell and the condition is determined by its success or failure (exit status)\n      condition: \"command -v trash \u0026\u003e /dev/null\"\n\n  - name: Fallback to interactive rm if trash-cli is not installed\n    abbr: del\n    snippet: \"rm -i\"\n\n  - name: Open file with VSCode if code command exists\n    abbr: code\n    snippet: \"code .\"\n    options:\n      condition: \"type code \u0026\u003e /dev/null\"\n\n  # V. Suffix alias (execution by regular expression pattern)\n  - name: Execute Python scripts with filename\n    # The `$file` variable in the snippet is replaced by the value captured in options.regex\n    snippet: \"python $file\"\n    options:\n      # Matches words ending with `.py` and captures the entire word as `file`\n      regex: '^(?\u003cfile\u003e\\S+\\.py)$'\n      evaluate: true\n\n  - name: Execute shell scripts\n    snippet: \"bash $script\"\n    options:\n      regex: '^(?\u003cscript\u003e\\S+\\.sh)$'\n      evaluate: true\n\n  - name: Unpack tar.gz files\n    snippet: \"tar -xzvf $archive\"\n    options:\n      regex: '^(?\u003carchive\u003e\\S+\\.tar\\.gz)$'\n      evaluate: true\n```\n\n## Configuration Reference\n\nThe following keys can be used in your `config.yaml` to define an abbreviation.\n\n  * `name`: A brief, human-readable description of what the abbreviation does.\n  * `abbr`: The short word to be typed that will trigger the expansion.\n  * `snippet`: The text that will replace the `abbr` when it is expanded.\n  * `options`: A block of advanced configuration keys for more specific behavior.\n      * `position`: Controls where the abbreviation can be expanded.\n          * `command` (default): Only expands when the `abbr` is the first word on the command line.\n          * `anywhere`: Allows expansion at any point on the command line.\n      * `command`: Restricts the abbreviation to only expand when it appears as an argument to a specific command.\n      * `condition`: A shell command that is executed to determine if the abbreviation should be active. The abbreviation is only enabled if the command exits with a status of 0 (success).\n      * `regex`: A regular expression that serves as the trigger instead of a fixed `abbr` string. This is useful for creating \"suffix aliases\" that act on patterns, like file extensions.\n      * `evaluate`: Enables dynamic features in the `snippet`.\n          * When used with `regex`, it substitutes named capture groups (e.g., `(?\u003cname\u003e...)`) from the regex into variables in the snippet (e.g., `$name`).\n          * When used without `regex`, it allows for shell command substitution (e.g., `$(...))`) within the snippet to be evaluated by the shell.\n      * `set_cursor`: A boolean (`true`/`false`). If true, the cursor will be moved to the position of the `%` character in the snippet after expansion. The `%` character is then removed.\n\n## Features\n\nThis tool brings a fish shell-inspired `abbr` experience to bash, including key features like:\n\n| Feature                  | Description                                                     |\n| ------------------------ | --------------------------------------------------------------- |\n| **Inline expansion** | Abbreviations expand in the command line before you run the command. |\n| **Visibility** | You can see and edit the full command before execution. |\n| **History integrity** | Your shell history saves the expanded commands, not the abbreviations. |\n| **Position control** | You can restrict abbreviations to the command position or allow them anywhere on the line. |\n| **Command-specific** | Abbreviations can be set to expand only as arguments for a specific command (e.g., `git`). |\n| **Conditional expansion** | You can enable abbreviations based on shell conditions, such as checking if a command exists. |\n| **Cursor positioning** | You can set the cursor's position after an expansion using a `%` marker in the snippet. |\n| **Regex-powered snippets** | You can use regular expressions to trigger abbreviations, primarily to substitute named capture groups. |\n\n## License\n\nMIT\n\n## Author\n\nHagata\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhagatasdelus%2Fbabbr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhagatasdelus%2Fbabbr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhagatasdelus%2Fbabbr/lists"}