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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: xontrib_abbrevs-0.1.1.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for xontrib_abbrevs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c4cbf035c064e485bce132322fd9c51742bf162788e4ef53899a21b915de8f84
MD5 518ee17a127ee5f64fedf2251a87c3f3
BLAKE2b-256 fad062d387148066c2896d7d333f214f0116695e92c62c8c89acf78986df298a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for xontrib_abbrevs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9b8e1ea18c4f11f9bafdca3015ee1282ab509eceddc211eeb2cdc28a3a5b65c5
MD5 cf6fbdfa145695135996ee4db71d6c60
BLAKE2b-256 9746ee039f68d580e37690c1fd2f32632b153411427ad2d2b656cfb419c2b2e2

See more details on using hashes here.

Supported by

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