Support shell integration of terminal programs iTerm2, Kitty...
Project description
Terminal Emulators integration
Shell integration for Xonsh.
The following terminal emulators are supported
- iTerm2
- kitty
- WezTerm with CWD; Input, Output, and Prompt zones; and User Vars for tracking additional shell state
- Ghostty
Note: If identifying current terminal fails, iTerm2 hooks are loaded.
PRs welcome on improving the support to more terminal programs :)
Installation
To install use pip:
xpip install xontrib-term-integrations
# or: xpip install -U git+https://github.com/jnoortheen/xontrib-term-integrations
Usage
# this modifies the $PROMPT function. So load it after setting $PROMPT if you have a custom value
xontrib load term_integration
(WezTerm) Set user vars[^1] via the helper set_user_var function:
# via a xonsh alias
set_wezterm_user_var 'my_term_user_var' 'value_of_my_term_user_var'
# or an explicit Python import
from xontrib_term_integrations.utils import set_user_var
set_user_var('my_term_user_var','value_of_my_term_user_var')
You can disable registering the alias with a $XONTRIB_TERM_INTEGRATIONS_SKIP_ALIAS = True
Contributing
Please make sure that you
- Document the purpose of functions and classes.
- When adding a new feature, please mention it in the
README.md. Use screenshots when applicable. - Conventional Commit style should be used for commit messages as it is used to generate changelog.
- Please use pre-commit to run qa checks. Configure it with
pre-commit install-hooks
- For new releases, create a GitHub release with new tag (e.g.
v0.x.x) and it will automatically push the package to PyPI.
Known issues
WezTerm
- (WezTerm) Multiline prompt is partially supported:
- every continuation line is semantically marked by default:
if True: #↓ continuation prompt ..... echo 1 # ↑ input
so you can selectecho 1as aSemanticZonewith a mouse multiclick, but you can't select both lines as one zone (and would need to map some combo of commands to hack around it) - if you set
$MULTILINE_PROMPT_PRE='',$MULTILINE_PROMPT_POS='', then continuation lines won't be marked, you'd be able to select all the lines as oneSemanticZone(unles the right prompt interferes), but that will also include..continuation markers (so you'd either need to disable them in Xonsh or add some extra WezTerm lua parsing hack to trim them)
(follow this WezTerm discussion for updates)
- every continuation line is semantically marked by default:
- (WezTerm) Semantic right prompt not separated from the next-line left prompt (issue)
- WezTerm is not recognized in root shells due to this issue
Ghostty
- Implemented features:
- Do not confirm close for terminals where the cursor is at a prompt.
- New terminals start in the working directory of the previously focused terminal.
- Complex prompts resize correctly by allowing the shell to redraw -- rather than reflow -- the prompt line.
- Triple-click while holding control (Linux) or command (macOS) to select the output of a command.
- The cursor at the prompt is turned into a bar to represent more typical text editing.
- The jump_to_prompt keybinding can be used to scroll the terminal window forward and back through prompts.
:warning: Because of the implementation, jumping includes secondary newlines in multiline prompts.
- Alt+click (option+click on macOS) moves the cursor to the click location while at a prompt.
- sudo can be automatically wrapped to preserve Ghostty terminfo (disabled by default)
- ssh can be automatically wrapped to either transmit the Ghostty terminfo or set the TERM environment variable to xterm-256color to maximize compatibility (disabled by default)
[^1]: Variables associated with a given pane rather than a process. WezTerm, iTerm2
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xontrib_term_integrations-0.2.3.tar.gz.
File metadata
- Download URL: xontrib_term_integrations-0.2.3.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
945fd56b33039ea010b9d9883b39bb15e4c8bef12719b087c122877877118000
|
|
| MD5 |
6c359fe1646901188265fe5267e625b1
|
|
| BLAKE2b-256 |
4ae4138ef7c56fcf01b03a667c69c3f5a5a995ab7ea02535d486796432409386
|
Provenance
The following attestation bundles were made for xontrib_term_integrations-0.2.3.tar.gz:
Publisher:
release.yml on jnoortheen/xontrib-term-integrations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xontrib_term_integrations-0.2.3.tar.gz -
Subject digest:
945fd56b33039ea010b9d9883b39bb15e4c8bef12719b087c122877877118000 - Sigstore transparency entry: 991046768
- Sigstore integration time:
-
Permalink:
jnoortheen/xontrib-term-integrations@1ae335ea4a0abebf15a8812cf3ebbba6d5b3e1d0 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/jnoortheen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1ae335ea4a0abebf15a8812cf3ebbba6d5b3e1d0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file xontrib_term_integrations-0.2.3-py3-none-any.whl.
File metadata
- Download URL: xontrib_term_integrations-0.2.3-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05ea694d38990a4305c92c7ef28873f50d62069a4a7331f40ef123f4618b627b
|
|
| MD5 |
0217abb3d56d18410456ba1804cd0841
|
|
| BLAKE2b-256 |
a7ea3f8f28482547e4cca118116848c7fa31bf4e58c90000e8f9eba3e370e480
|
Provenance
The following attestation bundles were made for xontrib_term_integrations-0.2.3-py3-none-any.whl:
Publisher:
release.yml on jnoortheen/xontrib-term-integrations
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xontrib_term_integrations-0.2.3-py3-none-any.whl -
Subject digest:
05ea694d38990a4305c92c7ef28873f50d62069a4a7331f40ef123f4618b627b - Sigstore transparency entry: 991046802
- Sigstore integration time:
-
Permalink:
jnoortheen/xontrib-term-integrations@1ae335ea4a0abebf15a8812cf3ebbba6d5b3e1d0 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/jnoortheen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1ae335ea4a0abebf15a8812cf3ebbba6d5b3e1d0 -
Trigger Event:
release
-
Statement type: