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.1.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

xontrib_abbrevs-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file xontrib_abbrevs-0.1.0.tar.gz.

File metadata

  • Download URL: xontrib_abbrevs-0.1.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for xontrib_abbrevs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b2e00bf7081d01345eb1f303dbe32fb78def34bcf4036c22b2a36a54ba0d75ff
MD5 9cee97a7a451e71838524ced6eb29afe
BLAKE2b-256 2c8dfe9d19a14bc25e9640ed79342a9c5b95511d39c52f2466fb9184498acb5f

See more details on using hashes here.

File details

Details for the file xontrib_abbrevs-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for xontrib_abbrevs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab577ce4bac3ce7431a5d1d50b3dd7c4c162f23b085333e9a42016493aec5df1
MD5 75b8f673a0d711ceeb401cc6ee7757a3
BLAKE2b-256 ff7076b32465f535b1327fac54ecf07ea8190747f3654567b092cb3f3717f6dd

See more details on using hashes here.

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