Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xonsh/xontrib-abbrevs
Command abbreviations. This expands input words as you type.
https://github.com/xonsh/xontrib-abbrevs
abbrev cli terminal xonsh xontrib
Last synced: about 1 month ago
JSON representation
Command abbreviations. This expands input words as you type.
- Host: GitHub
- URL: https://github.com/xonsh/xontrib-abbrevs
- Owner: xonsh
- License: mit
- Created: 2023-02-14T15:08:14.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-21T17:56:15.000Z (about 2 months ago)
- Last Synced: 2024-10-22T08:41:18.763Z (about 2 months ago)
- Topics: abbrev, cli, terminal, xonsh, xontrib
- Language: Python
- Homepage:
- Size: 30.3 KB
- Stars: 19
- Watchers: 3
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-xontribs - abbrevs - Expands input words as you type in xonsh shell (fish-shell-like abbreviations). (Tab-completions)
README
Expands input words as you type in xonsh shell.
If you like the idea click ⭐ on the repo and tweet.## Installation
To install use pip:
```bash
xpip install xontrib-abbrevs
# or: xpip install -U git+https://github.com/xonsh/xontrib-abbrevs
```## Usage
This expands input words from `abbrevs` dictionary as you type.
Adds ``abbrevs`` dictionary to hold user-defined "command abbreviations.
The dictionary is searched as you type the matching words are replaced
at the command line by the corresponding dictionary contents once you hit
'Space' or 'Return' key.For instance a frequently used command such as ``git status`` can be abbreviated to ``gst`` as follows:
```xsh
xontrib load abbrevs
abbrevs['gst'] = 'git status'
gst # Once you hit or 'gst' gets expanded to 'git status'.
```one can set a callback function that receives current buffer and word to customize the expanded word based on context
```xsh
abbrevs['ps'] = lambda buffer, word: "procs" if buffer.text.startswith(word) else word
```It is also possible to set the cursor position after expansion with,
```xsh
abbrevs['gp'] = "git push --force"
```## Credits
This package was created with [xontrib template](https://github.com/xonsh/xontrib-template).