mirror of
https://gitlab.com/mlunax/dotfiles.git
synced 2025-04-19 08:45:36 +00:00
add rtx command
This commit is contained in:
parent
edc0a6ec12
commit
da8da1ccc5
1 changed files with 34 additions and 0 deletions
34
.zsh/rtx.zsh
Normal file
34
.zsh/rtx.zsh
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
export RTX_SHELL=zsh
|
||||||
|
|
||||||
|
rtx() {
|
||||||
|
local command
|
||||||
|
command="${1:-}"
|
||||||
|
if [ "$#" = 0 ]; then
|
||||||
|
command /home/lunax/.cargo/bin/rtx
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
|
||||||
|
case "$command" in
|
||||||
|
deactivate|shell)
|
||||||
|
eval "$(/home/lunax/.cargo/bin/rtx "$command" "$@")"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
command /home/lunax/.cargo/bin/rtx "$command" "$@"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_rtx_hook() {
|
||||||
|
trap -- '' SIGINT;
|
||||||
|
eval "$("$HOME/.cargo/bin/rtx" hook-env -s zsh)";
|
||||||
|
trap - SIGINT;
|
||||||
|
}
|
||||||
|
typeset -ag precmd_functions;
|
||||||
|
if [[ -z "${precmd_functions[(r)_rtx_hook]+1}" ]]; then
|
||||||
|
precmd_functions=( _rtx_hook ${precmd_functions[@]} )
|
||||||
|
fi
|
||||||
|
typeset -ag chpwd_functions;
|
||||||
|
if [[ -z "${chpwd_functions[(r)_rtx_hook]+1}" ]]; then
|
||||||
|
chpwd_functions=( _rtx_hook ${chpwd_functions[@]} )
|
||||||
|
fi
|
Loading…
Add table
Reference in a new issue