Shell Integration
BCMR provides shell integration similar to zoxide. You can create aliases with custom prefixes, suffixes, or replace native commands entirely.
Setup
Add one of the following to your shell configuration file:
# Use 'b' prefix → bcp, bmv, brm
eval "$(bcmr init zsh --cmd b)"# Use 'b' prefix → bcp, bmv, brm
eval "$(bcmr init bash --cmd b)"# Use 'b' prefix → bcp, bmv, brm
bcmr init fish --cmd b | source# Use 'b' prefix → bcp, bmv, brm
bcmr init powershell --cmd b | Out-String | Invoke-ExpressionOptions
Zsh copy/move wrappers use command-specific noglob aliases. This lets bcmr
expand remote source stars before zsh can reject them as unmatched local files:
eval "$(bcmr init zsh --cmd b)"
bcp mini_m2:/Users/snaix/Downloads/deecamp中期检查* ~/Downloads/
Reload initialization after upgrading. This leaves global shell options and
the remove wrapper unchanged. Direct bcmr copy calls should quote patterns.
| Flag | Description |
|---|---|
--cmd <prefix> | Set command prefix (e.g., b creates bcp, bmv, brm) |
--prefix <prefix> | Explicitly set prefix (overrides --cmd) |
--suffix <suffix> | Set command suffix |
--no-cmd | Don't create command aliases |
--path <path> | Add a directory to PATH |
Examples
# Replace native commands (creates cp, mv, rm)
eval "$(bcmr init zsh --cmd '')"
# Custom prefix (creates testcp, testmv, testrm)
eval "$(bcmr init zsh --cmd test)"
# Prefix + suffix (creates pcp+, pmv+, prm+)
eval "$(bcmr init zsh --cmd --prefix p --suffix +)"
# Only add to PATH, no aliases
eval "$(bcmr init zsh --no-cmd --path /usr/local/bin)"
Supported Shells
- Bash
- Zsh
- Fish
- PowerShell
Shell Completions
BCMR provides tab completion for all commands and flags via bcmr completions.
# Add to ~/.zshrc; this also initializes zsh's completion system when needed.
eval "$(bcmr init zsh --cmd b)"
# Optional: install a generated completion file for loading through fpath.
bcmr completions zsh --install
# Print its resolved location without writing it:
bcmr completions zsh --install --print# Add to ~/.bashrc
eval "$(bcmr completions bash)"
# Or generate to system completions dir
bcmr completions bash > /etc/bash_completion.d/bcmrbcmr completions fish > ~/.config/fish/completions/bcmr.fish# Create profile directory if it doesn't exist, then append
New-Item -Path (Split-Path $PROFILE) -ItemType Directory -Force | Out-Null
bcmr completions powershell >> $PROFILE
# Or load for current session only
bcmr completions powershell | Out-String | Invoke-Expressionbcmr init zsh --cmd b creates bcp, bmv, and brm, initializes compinit only if needed, and loads both local and remote completions. It is safe to run again. Keep any existing zsh completion setup before this line. --no-cmd retains its PATH-only behavior and does not initialize completions.
--install only writes a file; it does not activate completion in an existing shell or edit your configuration. The command prints the resolved installation directory (including the default when XDG_DATA_HOME is unset). For file-based loading, add that directory to fpath before autoload -Uz compinit; compinit. The self-contained init line above is sufficient for command wrappers and completions.
If compinit reports insecure directories, inspect them with compaudit and correct their ownership or permissions before retrying. Initialization preserves these checks and reports completion failures while leaving command wrappers available.
After setup, you can tab-complete commands and flags:
bcmr co<TAB> → bcmr copy
bcmr copy -<TAB> → --recursive --preserve --force --verify ...
Remote completion normally stays quiet when a host is unavailable. To inspect a failure, run the hidden completion command directly, or enable diagnostics for Tab completion:
bcmr __complete-remote '[email protected]:/path/'
export BCMR_COMPLETION_DEBUG=1
# Disable diagnostic output again:
unset BCMR_COMPLETION_DEBUG