Auto-expand abbreviations for PowerShell. Inspired by zsh-abbr.
Clone this repository to a local folder:
git clone https://github.com/kot149/posh-abbrThen import the module and define abbrs in your PowerShell profile:
edit $profileImport-Module 'C:\path\to\posh-abbr\posh-abbr.psd1' -Force
abbr g git
abbr 'git ch' 'git checkout'
abbr 'git cm' 'git commit -m "%"'With the above example,
- Type
spaceorenteraftergto expand it togit - Type
spaceorenteraftergit chto expand it togit checkout - Type
spaceorenteraftergit cmto expand it togit checkout -m ""and move cursor into the quatation
Notes:
- Expansions are applied when the cursor is at the end of the line.
- Use
%in the expansion to specify the cursor position after expansion (the%itself is removed).