Skip to main content

Expands input words as you type in xonsh shell.

Project description

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:

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:

xontrib load abbrevs
abbrevs['gst'] = 'git status'
gst # Once you hit <space> or <return> '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

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,

abbrevs['gp'] = "git push <edit> --force"

Credits

This package was created with xontrib template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xontrib-abbrevs-0.0.1.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distribution

xontrib_abbrevs-0.0.1-py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page