cd to any path without escaping in xonsh shell: cd ~/[te] st
Project description
cd
to any path without escaping in xonsh shell.
Replaces cd
at the start of a line with a subprocess macro cd!
If you like the idea click ⭐ on the repo and stay tuned.
Install
xpip install xontrib-cd
# or: xpip install -U git+https://github.com/eugenesvk/xontrib-cd
This xontrib will get loaded automatically for interactive sessions; to stop this, set
$XONTRIBS_AUTOLOAD_DISABLED = {"cd", }
Configure
Set the following environment variables in your profile to enable extra options (disabled by default):
$XONTRIB_CD_ALTSYMLINKFLAG = True
to pass-p
,-f
, or-s
flags (in addition to-P
) to follow symlinks$XONTRIB_CD_ALTSYMLINKFUNC = True
to usecdp
,cdf
, orcds
(in addition tocd -P
) to follow symlinks$XONTRIB_CD_SYMLINKAlWAYSON = True
to makecd
always follow symlinks (always pass-P
)$XONTRIB_CD_LASTCMD = True
to makecd
also work when it's the last command in a multi-command line
Use
Use cd
as usual, but without the fear of copying&pasting arbitrary paths (e.g. .../space separated/
or .../[bracketed]/
)
xontrib load cd
cd ~/[Path] With Spaces # equivalent to 'cd! ~/[Path] With Spaces'
cd C:/Program Files # equivalent to 'cd! C:/Program Files'
cd -P ~/SymlinkTo # follow symlinks, equivalent to 'cd -P! ~/SymlinkTo'
Add a space before cd
to disable adding !
Known issues
- Xontrib autoload can't be disabled and prevents user configured environment vars from being read on time due to a xonsh bug, so if you want to change the default configs via env vars, install the deauto branch
xpip install -U git+https://github.com/eugenesvk/xontrib-cd@deauto
- Multiple commands per line like
cd ~; echo 1
will fail sincecd
is replaced withcd!
, and everything after!
is treated as a single string argument, ignoring the;
separators - But
echo 1; cd ~
will work with$XONTRIB_CD_LASTCMD
Credits
This package was created with xontrib cookiecutter template based on the idea of hooking into the command line input as implemented in xontrib-sh
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
Hashes for xontrib_cd-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4825addbb987c485c17e7740866bf77999e3890952a2bd759724e0ac48673f04 |
|
MD5 | 3963c98c0d77efac67fa2dda0cf0bb9d |
|
BLAKE2b-256 | 659afe57d75d9f7245981936d8be911b8bb1ec131344ea43cd6dff9a1788fe22 |