### Manual Installation of zsh-abbr Source: https://context7.com/olets/zsh-abbr/llms.txt Manually install the zsh-abbr plugin by cloning the repository and sourcing the plugin script in your ~/.zshrc file. ```zsh # Clone the repo and source the plugin git clone https://github.com/olets/zsh-abbr ~/.config/zsh/plugins/zsh-abbr # In ~/.zshrc: source ~/.config/zsh/plugins/zsh-abbr/zsh-abbr.zsh ``` -------------------------------- ### Install zsh-abbr with Homebrew Source: https://context7.com/olets/zsh-abbr/llms.txt Install the zsh-abbr plugin using Homebrew. After installation, source the plugin in your ~/.zshrc file using the provided command. ```zsh brew install olets/formulae/zsh-abbr # Then in ~/.zshrc: source $(brew --prefix)/share/zsh-abbr/zsh-abbr.zsh ``` -------------------------------- ### Install zsh-abbr with zinit Source: https://context7.com/olets/zsh-abbr/llms.txt Install the zsh-abbr plugin using the zinit plugin manager by adding the provided line to your ~/.zshrc file. ```zsh # ~/.zshrc zinit light olets/zsh-abbr ``` -------------------------------- ### Combine filters for listing commands Source: https://context7.com/olets/zsh-abbr/llms.txt Demonstrates combining scope and type filters when listing abbreviations as runnable commands. This example filters for global user abbreviations. ```zsh abbr list-commands --global --user ``` -------------------------------- ### Run Performance Benchmarks Source: https://github.com/olets/zsh-abbr/blob/main/performance/README.md Execute performance tests using zsh-bench. Ensure zsh-bench is installed and the configuration directory is set correctly. This command runs benchmarks for different abbreviation counts and installation states. ```shell zsh-bench --isolation docker --config-dir ./performance -- not-installed fresh-install zero-abbreviations ten-abbreviations one-hundred-abbreviations ``` -------------------------------- ### Get Archive SHA Source: https://github.com/olets/zsh-abbr/blob/main/CONTRIBUTING.md Calculate the SHA256 checksum of the created release archive. This is used for verification, for example, on macOS. ```shell openssl sha256 %ABBR_CURSOR%.tar.gz ``` -------------------------------- ### Generate Changelog Source: https://github.com/olets/zsh-abbr/blob/main/docs/releasing.md Use conventional-changelog-cli to automatically generate or update the CHANGELOG.md file based on commit messages. Ensure conventional-changelog-cli is installed. ```shell conventional-changelog -p angular -i CHANGELOG.md -s ``` -------------------------------- ### Run Test Suite in Current Shell Source: https://github.com/olets/zsh-abbr/blob/main/tests/README.md Source the test runner script to execute all tests within the current shell environment. Ensure zsh-test-runner v2.x is installed. ```shell . ./index.ztr.zsh ``` -------------------------------- ### Update Prerelease Branch Source: https://github.com/olets/zsh-abbr/blob/main/docs/releasing.md If the release is a prerelease, merge the appropriate version trunk branch into the 'next' branch. For example, merge v5 into 'next'. ```shell git checkout next git merge # e.g. git merge v5 ``` -------------------------------- ### Update Version Trunk Branch Source: https://github.com/olets/zsh-abbr/blob/main/docs/releasing.md Merge the main branch into a specific version trunk branch (e.g., v4) and push the changes. This is an example for a pre-v5 release. ```shell git checkout v4 git merge main git push ``` -------------------------------- ### Create Release Archive Source: https://github.com/olets/zsh-abbr/blob/main/CONTRIBUTING.md Generate a tar.gz archive of the release. The archive is prefixed with the version number and includes the tag name. ```shell git archive --prefix=%ABBR_CURSOR%/ -o %ABBR_CURSOR%.tar.gz %ABBR_CURSOR% # replace cursor with `v`-prefixed tag name ``` -------------------------------- ### Cursor Placement with `abbr-set-line-cursor` Source: https://context7.com/olets/zsh-abbr/llms.txt Enable cursor placement at a marker after expansion by setting `ABBR_SET_LINE_CURSOR=1` and defining `ABBR_LINE_CURSOR_MARKER`. The marker is removed after placement. ```zsh ABBR_SET_LINE_CURSOR=1 ABBR_LINE_CURSOR_MARKER='%' # When an expansion contains `%`, after pressing Space or Enter the cursor # is placed at `%` (marker is removed) abbr gcm="git commit -m '%"' # Type: gcm → git commit -m '' ``` ```zsh # abbr-set-line-cursor can be called directly in custom widgets ``` -------------------------------- ### List all abbreviations with expansions Source: https://context7.com/olets/zsh-abbr/llms.txt Displays all defined abbreviations along with their corresponding expansions in the format `abbreviation=expansion`. ```zsh abbr list ``` -------------------------------- ### Run Test Suite with zsh-test-runner Source: https://github.com/olets/zsh-abbr/blob/main/CONTRIBUTING.md Execute the project's test suite using the provided zsh-test-runner script. Ensure you source the script to run tests. ```shell . ./tests/abbr.ztr ``` -------------------------------- ### Verify git abbreviation pair creation Source: https://context7.com/olets/zsh-abbr/llms.txt Lists abbreviations and filters for the created git abbreviations to verify their existence and expansions. ```zsh abbr list | grep -E "^(co|git co)=" ``` -------------------------------- ### List abbreviations as runnable commands Source: https://context7.com/olets/zsh-abbr/llms.txt Outputs abbreviations as full `abbr` commands, suitable for re-execution or exporting to configuration files. Use the short flag `-L`. ```zsh abbr list-commands ``` ```zsh abbr L ``` -------------------------------- ### Tag Release Source: https://github.com/olets/zsh-abbr/blob/main/docs/releasing.md Create a Git tag for the release. Replace with the tag name, which should be a v-prefixed semantic version. ```shell git tag ``` -------------------------------- ### Import Git Aliases with zsh-abbr Source: https://context7.com/olets/zsh-abbr/llms.txt Import Git aliases into zsh-abbr using `abbr import-git-aliases`. Specify a file with `--file`, add a prefix with `--prefix`, or use `--session` and `--dry-run` for preview. ```zsh abbr import-git-aliases ``` ```zsh abbr import-git-aliases --file ~/.gitconfig-work ``` ```zsh abbr import-git-aliases --prefix g ``` ```zsh abbr import-git-aliases --session ``` ```zsh abbr import-git-aliases --dry-run ``` ```zsh abbr import-git-aliases --file ~/.gitconfig --prefix g --session --dry-run ``` -------------------------------- ### Import Fish Shell Abbreviations Source: https://context7.com/olets/zsh-abbr/llms.txt Import abbreviations from a fish shell file using `abbr import-fish`. Use `--session` for temporary imports or `--force` to overwrite existing ones. ```zsh # Export fish abbreviations first (from inside fish): abbr --show > ~/fish-abbrs.txt # Then import into zsh-abbr: abbr import-fish ~/fish-abbrs.txt ``` ```zsh abbr import-fish --session ~/fish-abbrs.txt ``` ```zsh abbr import-fish --force ~/fish-abbrs.txt ``` -------------------------------- ### Import existing shell aliases as abbreviations Source: https://context7.com/olets/zsh-abbr/llms.txt Converts all currently defined shell aliases (both regular and global) into zsh-abbr abbreviations. ```zsh abbr import-aliases ``` -------------------------------- ### Create Signed Git Tag Source: https://github.com/olets/zsh-abbr/blob/main/CONTRIBUTING.md Create a signed Git tag for a new release. The tag name should be prefixed with 'v' and use the version number. ```shell git tag -s v%ABBR_CURSOR% -m v%ABBR_CURSOR% ``` -------------------------------- ### Print abbreviation expansion Source: https://context7.com/olets/zsh-abbr/llms.txt Outputs the expansion of a given abbreviation without altering any state. Returns exit code 1 if the abbreviation is not found. ```zsh abbr expand gco ``` ```zsh abbr x gco ``` -------------------------------- ### Push Tag Source: https://github.com/olets/zsh-abbr/blob/main/docs/releasing.md Push the created Git tag to the origin remote. Replace with the actual tag name. ```shell git push origin ``` -------------------------------- ### Import Aliases with zsh-abbr Source: https://context7.com/olets/zsh-abbr/llms.txt Use `abbr import-aliases` to import regular, global, or session-only aliases. Options include `--dry-run` for preview and `--force` to overwrite existing abbreviations. ```zsh abbr import-aliases --regular ``` ```zsh abbr import-aliases --global ``` ```zsh abbr import-aliases --session ``` ```zsh abbr import-aliases --dry-run ``` ```zsh abbr import-aliases --force ``` -------------------------------- ### Display zsh-abbr Version and Profile Information Source: https://context7.com/olets/zsh-abbr/llms.txt Commands to display the current version of zsh-abbr and its profile information, including Zsh version and OS type, useful for debugging and bug reports. ```zsh abbr version ``` ```zsh abbr --version ``` ```zsh abbr -v ``` ```zsh abbr profile ``` ```zsh abbr help ``` ```zsh abbr --help ``` ```zsh man abbr ``` -------------------------------- ### Export abbreviations to a script Source: https://context7.com/olets/zsh-abbr/llms.txt Saves all defined abbreviations as runnable `abbr` commands to a file, which can then be sourced to restore them or migrate them. ```zsh abbr list-commands > ~/my-abbreviations-backup.zsh source ~/my-abbreviations-backup.zsh ``` -------------------------------- ### Configure zsh-abbr Settings Source: https://context7.com/olets/zsh-abbr/llms.txt Set global configuration variables for zsh-abbr in your ~/.zshrc file before sourcing the plugin. These variables control features like auto-reloading, key bindings, and output silencing. ```zsh # ~/.zshrc — set before sourcing zsh-abbr # Auto-reload user abbreviations file before each abbr command (default: 1) ABBR_AUTOLOAD=1 # Use default key bindings: Space expands, Enter expands-and-runs, # Ctrl+Space is literal space, Ctrl+Enter is literal enter (default: 1) ABBR_DEFAULT_BINDINGS=1 # Globally behave as if --dry-run was passed (default: 0) ABBR_DRY_RUN=0 # Globally behave as if --force was passed (default: 0) ABBR_FORCE=0 # Silence all success/warning/error output (default: 0) ABBR_QUIET=0 # Silence only the "abbreviation conflicts with a command name" warning (default: 0) ABBR_QUIETER=0 # Enable debug logging (default: 0) ABBR_DEBUG=0 # Enable cursor placement in expansions (default: 0) # When enabled, the first occurrence of ABBR_EXPANSION_CURSOR_MARKER in the # expansion is replaced with the cursor position ABBR_SET_EXPANSION_CURSOR=1 ABBR_EXPANSION_CURSOR_MARKER='|' # default: same as ABBR_LINE_CURSOR_MARKER # Enable cursor placement from line marker (default: 0) # When enabled, after expansion the first occurrence of ABBR_LINE_CURSOR_MARKER # in the full buffer is replaced with the cursor ABBR_SET_LINE_CURSOR=1 ABBR_LINE_CURSOR_MARKER='%' # default: % # Custom path for user abbreviations file # Default: ${XDG_CONFIG_HOME:-$HOME/.config}/zsh-abbr/user-abbreviations ABBR_USER_ABBREVIATIONS_FILE="$HOME/.dotfiles/zsh-abbreviations" # Check after each command whether an abbreviation was available (default: 0) ABBR_GET_AVAILABLE_ABBREVIATION=1 # Log available-abbreviation reminders (requires ABBR_GET_AVAILABLE_ABBREVIATION=1) ABBR_LOG_AVAILABLE_ABBREVIATION=1 # Show the reminder after command output instead of before (default: 0) ABBR_LOG_AVAILABLE_ABBREVIATION_AFTER=1 # Allow regular abbreviations to expand in command position mid-line (experimental, default: 0) # 1 = enable with warning, 2 = enable without warning ABBR_EXPERIMENTAL_COMMAND_POSITION_REGULAR_ABBREVIATIONS=2 # Disable color output (follows https://no-color.org/ standard) NO_COLOR=1 # Custom split function for abbreviation tokenization # Receives the line in $*; must set REPLY to an array of tokens ABBR_SPLIT_FN() { REPLY=( ${(z)*} ) # default: zsh shell-grammar word splitting } ``` -------------------------------- ### Add abbreviation with cursor placement marker Source: https://context7.com/olets/zsh-abbr/llms.txt Defines an abbreviation that includes a cursor placement marker. Ensure ABBR_SET_EXPANSION_CURSOR is set to 1. ```zsh ABBR_SET_EXPANSION_CURSOR=1 ABBR_EXPANSION_CURSOR_MARKER='|' abbr gc="git commit -m '|'" ``` -------------------------------- ### Add a global session-only abbreviation Source: https://context7.com/olets/zsh-abbr/llms.txt Add a global abbreviation that is only available for the current session. Combine the -g/--global and -S/--session flags. ```zsh # Combine type + scope abbr -g -S log="| less" ``` -------------------------------- ### Add git-specific abbreviation pair Source: https://context7.com/olets/zsh-abbr/llms.txt Creates both a regular and a global abbreviation for git commands. The global abbreviation is session-only. ```zsh abbr git co="checkout" ``` ```zsh abbr -S git co="checkout" ``` ```zsh abbr -f git co="checkout main" ``` -------------------------------- ### Add a global session abbreviation Source: https://context7.com/olets/zsh-abbr/llms.txt Adds a global abbreviation that is only active for the current session. ```zsh abbr --force gco="git checkout -b" ``` ```zsh abbr -f gco="git checkout -b" ``` -------------------------------- ### Add a session-only abbreviation Source: https://context7.com/olets/zsh-abbr/llms.txt Add a session-only abbreviation that is not persisted to the user abbreviations file. Use the --session or -S flag. ```zsh # Session-only abbreviation (not persisted to file) abbr --session gco="git checkout" abbr -S gco="git checkout" ``` -------------------------------- ### Add a global user abbreviation Source: https://context7.com/olets/zsh-abbr/llms.txt Add a persistent global user abbreviation that expands anywhere on the line. Use the -g or --global flag. ```zsh # Global user abbreviation (expands anywhere on the line) abbr -g nrd="npm run dev" # → Added the global user abbreviation `nrd` # Typing: echo nrd → echo npm run dev ``` -------------------------------- ### ZLE Widgets for Interactive Expansion Source: https://context7.com/olets/zsh-abbr/llms.txt zsh-abbr registers ZLE widgets for inline expansion. Default bindings use Space for expansion and Enter to accept. Customize bindings by setting `ABBR_DEFAULT_BINDINGS=0` and using `bindkey`. ```zsh # Default bindings set by zsh-abbr (reproduced here for documentation) # Space → abbr-expand-and-insert (expands abbreviation, then inserts space) # Enter → abbr-expand-and-accept (expands abbreviation, then runs command) # Ctrl+Space → magic-space (literal space, no expansion) # In incremental search: # Ctrl+Space → abbr-expand-and-insert # Space → magic-space (literal) ``` ```zsh # Disable default bindings and set your own ABBR_DEFAULT_BINDINGS=0 source /path/to/zsh-abbr.zsh bindkey " " abbr-expand-and-insert # Space expands bindkey "^M" abbr-expand-and-accept # Enter expands and accepts bindkey "^ " magic-space # Ctrl+Space = literal space ``` ```zsh # Use abbr-expand (expand only, without inserting a space or running) # e.g. bind to a custom key bindkey "^X^A" abbr-expand ``` ```zsh # abbr-expand-line: core expansion function used by all widgets. # Can be called directly in custom widgets. # Expects: abbr-expand-line "$LBUFFER" "$RBUFFER" # Sets the `reply` associative array with keys: # reply[loutput] — the left buffer after expansion # reply[routput] — the right buffer after expansion # reply[abbreviation] — the matched abbreviation (if any) # reply[expansion] — the resulting expansion (if any) # reply[type] — "regular" or "global" # reply[expansion_cursor_set] — 1 if cursor was placed via marker my-custom-expand-widget() { local -A reply abbr-expand-line "$LBUFFER" "$RBUFFER" LBUFFER=$reply[loutput] RBUFFER=$reply[routput] } zle -N my-custom-expand-widget bindkey "^Xe" my-custom-expand-widget ``` -------------------------------- ### Run Test Suite in Subshell Source: https://github.com/olets/zsh-abbr/blob/main/tests/README.md Execute the entire test suite in a subshell to avoid modifying the current shell environment. Set ZTR_PATH if necessary. ```shell ztr_path=$ZTR_PATH zsh ./index.ztr.zsh && abbr load ``` -------------------------------- ### Filter abbreviations by scope Source: https://context7.com/olets/zsh-abbr/llms.txt Lists abbreviations, filtering by scope. Available scopes are `--session`, `--user`, and `--global`. ```zsh abbr list --session ``` ```zsh abbr list --user ``` ```zsh abbr list --global ``` -------------------------------- ### Filter abbreviations by type Source: https://context7.com/olets/zsh-abbr/llms.txt Lists abbreviations, filtering by type. Available types are `--global` and `--regular`. ```zsh abbr list --global ``` ```zsh abbr list --regular ``` -------------------------------- ### Add a regular user abbreviation Source: https://context7.com/olets/zsh-abbr/llms.txt Add a persistent user abbreviation that expands only in the command position (the first word on the line). This is the default type if no flag is specified. ```zsh # Regular user abbreviation (expands only in command position) abbr gco="git checkout" # → Added the regular user abbreviation `gco` # Typing: gco → git checkout ``` -------------------------------- ### Expand Abbreviation and Update Buffers Source: https://context7.com/olets/zsh-abbr/llms.txt Expands an abbreviation in the current buffer and updates the left and right buffers if successful. Returns 1 if the cursor line setting is off or the marker is not found. ```zsh abbr-set-line-cursor "$BUFFER" if (( $? == 0 )); then LBUFFER=$reply[loutput] RBUFFER=$reply[routput] fi ``` -------------------------------- ### Dry-run adding an abbreviation Source: https://context7.com/olets/zsh-abbr/llms.txt Simulates adding an abbreviation without making any changes to the configuration. Useful for testing. ```zsh abbr --dry-run gco="git checkout" ``` -------------------------------- ### Run Single Command Tests in Current Shell Source: https://github.com/olets/zsh-abbr/blob/main/tests/README.md Execute tests for a specific command by providing the command name as an argument to the test runner script. This runs tests in the current shell. ```shell . ./index.ztr.zsh # e.g. `. ./index.ztr.zsh add` ``` -------------------------------- ### Reload User Abbreviations Source: https://context7.com/olets/zsh-abbr/llms.txt Force an immediate reload of the user abbreviations file into the current session using `abbr load`. This is automatic by default when `ABBR_AUTOLOAD=1`. ```zsh # Manually trigger a reload after editing the file directly nano ~/.config/zsh-abbr/user-abbreviations abbr load ``` ```zsh # Disable autoload for performance in scripts, then load manually ABBR_AUTOLOAD=0 # ... batch operations ... abbr load ``` -------------------------------- ### Export abbreviations as alias commands Source: https://context7.com/olets/zsh-abbr/llms.txt Outputs abbreviations formatted as standard shell `alias` declarations, useful for compatibility or sharing with non-zsh-abbr users. ```zsh abbr export-aliases ``` -------------------------------- ### Save exported aliases to a file Source: https://context7.com/olets/zsh-abbr/llms.txt Exports abbreviations as `alias` commands and redirects the output to a file, typically for shell configuration. ```zsh abbr export-aliases > ~/.zsh_aliases ``` -------------------------------- ### Push Abbreviations to Shell History Source: https://context7.com/olets/zsh-abbr/llms.txt Configure zsh-abbr to push the abbreviation itself or the original buffer to shell history. This allows for searching and recalling abbreviated commands. ```zsh ABBR_EXPAND_PUSH_ABBREVIATION_TO_HISTORY=1 ``` ```zsh ABBR_EXPAND_AND_ACCEPT_PUSH_ABBREVIATED_LINE_TO_HISTORY=1 ``` ```zsh ABBR_EXPAND_PUSH_ABBREVIATION_TO_HISTORY=1 ABBR_EXPAND_AND_ACCEPT_PUSH_ABBREVIATED_LINE_TO_HISTORY=1 ``` ```zsh abbr cm="git checkout main" ``` -------------------------------- ### List abbreviation names only Source: https://context7.com/olets/zsh-abbr/llms.txt Prints only the names of the defined abbreviations, without showing their expansions. Use the short flag `-l`. ```zsh abbr list-abbreviations ``` ```zsh abbr l ``` -------------------------------- ### Dry-run abbreviation rename Source: https://context7.com/olets/zsh-abbr/llms.txt Simulates renaming an abbreviation without making any changes. Shows what would happen to both the old and new abbreviations. ```zsh abbr rename --dry-run gco gcheck ``` -------------------------------- ### Run Single Command Tests in Subshell Source: https://github.com/olets/zsh-abbr/blob/main/tests/README.md Run tests for a specific command within a subshell. This isolates test execution and is useful for CI or complex environments. ```shell ztr_path=$ZTR_PATH zsh ./index.ztr.zsh && abbr load # e.g. `ztr_path=$ZTR_PATH zsh ./index.ztr.zsh add && abbr load` ``` -------------------------------- ### Notify When Abbreviation Was Available Source: https://context7.com/olets/zsh-abbr/llms.txt Enable reminders to notify the user when an abbreviation was available for the typed command. This helps in learning and adopting abbreviations. ```zsh ABBR_GET_AVAILABLE_ABBREVIATION=1 ``` ```zsh ABBR_LOG_AVAILABLE_ABBREVIATION=1 ``` ```zsh abbr gco="git checkout" ``` ```zsh ABBR_LOG_AVAILABLE_ABBREVIATION_AFTER=1 ``` -------------------------------- ### Update Other Version Trunks Source: https://github.com/olets/zsh-abbr/blob/main/docs/releasing.md When changes are made in a lower version trunk (e.g., v4), merge it into a higher version trunk (e.g., v5), resolve conflicts by preferring the current branch's version, then revert specific files from the lower trunk, commit, and push. ```shell git checkout v5 git merge --no-ff v4 git checkout --ours . git checkout v4 -- # manually copy over v4 CHANGELOG change into v5, marking it as "From v4.…" git commit git push ``` -------------------------------- ### Filter exported aliases by scope Source: https://context7.com/olets/zsh-abbr/llms.txt Exports abbreviations as `alias` commands, filtering by scope. Available scopes are `--session` and `--user`. ```zsh abbr export-aliases --session ``` ```zsh abbr export-aliases --user ``` -------------------------------- ### Commit Version Bump Source: https://github.com/olets/zsh-abbr/blob/main/docs/releasing.md Commit the version bump with a message following conventional commit standards. Replace with the actual new version number. ```shell chore(bump): bump to v, update changelog ``` -------------------------------- ### Filter exported aliases by type Source: https://context7.com/olets/zsh-abbr/llms.txt Exports abbreviations as `alias` commands, filtering by type. Available types are `--global` and `--regular`. ```zsh abbr export-aliases --global ``` -------------------------------- ### Capture abbreviation expansion Source: https://context7.com/olets/zsh-abbr/llms.txt Captures the expansion of an abbreviation into a shell variable for later use. Ensures the variable is local to the current scope. ```zsh local expansion expansion=$(abbr expand gco) echo "gco expands to: $expansion" ``` -------------------------------- ### Update Trunk Branches Source: https://github.com/olets/zsh-abbr/blob/main/docs/releasing.md Push local changes, merge the main branch into the current branch, and push again to update remote tracking branches. ```shell git push git merge main git push ``` -------------------------------- ### Suppress success output for abbreviations Source: https://context7.com/olets/zsh-abbr/llms.txt Adds an abbreviation without displaying a success message. Useful for scripting or cleaner output. ```zsh abbr --quiet gco="git checkout" ``` ```zsh abbr -q gco="git checkout" ``` -------------------------------- ### Remove a session-only abbreviation Source: https://context7.com/olets/zsh-abbr/llms.txt Erases an abbreviation that is only active for the current session. Use `--session` or `-S`. ```zsh abbr erase --session gco ``` ```zsh abbr e -S gco ``` -------------------------------- ### Remove a user abbreviation Source: https://context7.com/olets/zsh-abbr/llms.txt Erases a regular user-defined abbreviation. Use the short flag `-e` for convenience. ```zsh abbr erase gco ``` ```zsh abbr e gco ``` -------------------------------- ### Commit Release Changes Source: https://github.com/olets/zsh-abbr/blob/main/CONTRIBUTING.md Commit updated files for a new release, following the Angular commit message guidelines. The message includes a placeholder for the version number. ```shell git commit -i CHANGELOG.md completions/_abbr man/man1/abbr.1 zsh-abbr.zsh -m "feat(release): bump to v%ABBR_CURSOR%, update changelog" ``` -------------------------------- ### Rename a regular user abbreviation Source: https://context7.com/olets/zsh-abbr/llms.txt Renames an existing abbreviation from one name to another, preserving its expansion. Use the short flag `-R` for convenience. ```zsh abbr rename gco gcheck ``` ```zsh abbr R gco gcheck ``` -------------------------------- ### Force rename an abbreviation Source: https://context7.com/olets/zsh-abbr/llms.txt Renames an abbreviation, overwriting the target name if it already exists. Use `--force` or `-f`. ```zsh abbr rename --force gco gcheck ``` -------------------------------- ### Dry-run abbreviation erase Source: https://context7.com/olets/zsh-abbr/llms.txt Simulates erasing an abbreviation without making any changes. Useful for verifying which abbreviation would be removed. ```zsh abbr erase --dry-run gco ``` -------------------------------- ### Check if abbreviation exists using expand Source: https://context7.com/olets/zsh-abbr/llms.txt Uses `abbr expand` within a conditional statement to check if an abbreviation is defined. Redirects stderr to avoid error messages. ```zsh if abbr expand gco 2>/dev/null; then echo "gco is defined" else echo "gco is not defined" fi ``` -------------------------------- ### Remove a global user abbreviation Source: https://context7.com/olets/zsh-abbr/llms.txt Erases a global user-defined abbreviation. Specify global scope with `--global` or `-g`. The semicolon prevents premature expansion. ```zsh abbr erase --global gco; ``` ```zsh abbr e -g gco; ``` -------------------------------- ### Rename a global user abbreviation Source: https://context7.com/olets/zsh-abbr/llms.txt Renames a global abbreviation. Specify global scope with `--global` or `-g`. ```zsh abbr rename --global gco gcheck ``` ```zsh abbr R -g gco gcheck ``` -------------------------------- ### Clear Session Abbreviations Source: https://context7.com/olets/zsh-abbr/llms.txt Use `abbr clear-session` or its alias `abbr c` to remove all abbreviations added with the `--session` scope. This does not affect persistent user abbreviations. ```zsh abbr clear-session ``` ```zsh abbr c ``` ```zsh # Typical use: reset temporary abbreviations in a script abbr -S tmp="some-long-command --with-args" # ... do work ... abbr clear-session ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.