Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
30a8a5d3
Unverified
Commit
30a8a5d3
authored
Oct 09, 2023
by
Marc Cornellà
Committed by
GitHub
Oct 09, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(rtx): fix `rtx` init procedure (#11949)
parent
b75b01a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
27 deletions
+15
-27
rtx.plugin.zsh
plugins/rtx/rtx.plugin.zsh
+15
-27
No files found.
plugins/rtx/rtx.plugin.zsh
View file @
30a8a5d3
# Find where rtx should be installed
# rtx needs to be in $PATH
RTX_DIR
=
"
${
RTX_DIR
:-
$HOME
/.rtx
}
"
if
((
!
${
+commands[rtx]
}
))
;
then
RTX_COMPLETIONS
=
"
$RTX_DIR
/completions"
return
if
[[
!
-f
"
$RTX_DIR
/rtx.sh"
||
!
-f
"
$RTX_COMPLETIONS
/_rtx"
]]
;
then
# If not found, check for archlinux/AUR package (/opt/rtx-vm/)
if
[[
-f
"/opt/rtx-vm/rtx.sh"
]]
;
then
RTX_DIR
=
"/opt/rtx-vm"
RTX_COMPLETIONS
=
"
$RTX_DIR
"
# If not found, check for Homebrew package
elif
((
$+
commands[brew]
))
;
then
_RTX_PREFIX
=
"
$(
brew
--prefix
rtx
)
"
RTX_DIR
=
"
${
_RTX_PREFIX
}
/libexec"
RTX_COMPLETIONS
=
"
${
_RTX_PREFIX
}
/share/zsh/site-functions"
unset
_RTX_PREFIX
else
return
fi
fi
fi
# Load
command
# Load
rtx hooks
if
[[
-f
"
$RTX_DIR
/rtx.sh"
]]
;
then
eval
"
$(
rtx activate zsh
)
"
source
"
$RTX_DIR
/rtx.sh"
# Load completions
# If the completion file doesn't exist yet, we need to autoload it and
if
[[
-f
"
$RTX_COMPLETIONS
/_rtx"
]]
;
then
# bind it to `rtx`. Otherwise, compinit will have already done that.
fpath+
=(
"
$RTX_COMPLETIONS
"
)
if
[[
!
-f
"
$ZSH_CACHE_DIR
/completions/_rtx"
]]
;
then
autoload
-Uz
_rtx
typeset
-g
-A
_comps
compdef _rtx rtx
# compdef is already loaded before loading plugins
autoload
-Uz
_rtx
fi
_comps[rtx]
=
_rtx
fi
fi
# Generate and load rtx completion
rtx completion zsh
>!
"
$ZSH_CACHE_DIR
/completions/_rtx"
&|
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment