mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-12 05:49:47 +08:00
Compare commits
4 Commits
0a9d82780e
...
48ccc7b36d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48ccc7b36d | ||
|
|
346bd1cd53 | ||
|
|
c37df3ebd4 | ||
|
|
1ae0515a80 |
@ -182,6 +182,8 @@ function omz_urlencode() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Use LC_CTYPE=C to process text byte-by-byte
|
# Use LC_CTYPE=C to process text byte-by-byte
|
||||||
|
# Note that this doesn't work in Termux, as it only has UTF-8 locale.
|
||||||
|
# Characters will be processed as UTF-8, which is fine for URLs.
|
||||||
local i byte ord LC_ALL=C
|
local i byte ord LC_ALL=C
|
||||||
export LC_ALL
|
export LC_ALL
|
||||||
local reserved=';/?:@&=+$,'
|
local reserved=';/?:@&=+$,'
|
||||||
@ -206,6 +208,9 @@ function omz_urlencode() {
|
|||||||
else
|
else
|
||||||
if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
|
if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
|
||||||
url_str+="+"
|
url_str+="+"
|
||||||
|
elif [[ "$PREFIX" = *com.termux* ]]; then
|
||||||
|
# Termux does not have non-UTF8 locales, so just send the UTF-8 character directly
|
||||||
|
url_str+="$byte"
|
||||||
else
|
else
|
||||||
ord=$(( [##16] #byte ))
|
ord=$(( [##16] #byte ))
|
||||||
url_str+="%$ord"
|
url_str+="%$ord"
|
||||||
|
|||||||
@ -1,22 +1,14 @@
|
|||||||
# This scripts is copied from (MIT License):
|
# This scripts is copied from (MIT License):
|
||||||
# https://github.com/dotnet/toolset/blob/master/scripts/register-completions.zsh
|
# https://raw.githubusercontent.com/dotnet/sdk/main/scripts/register-completions.zsh
|
||||||
|
|
||||||
_dotnet_zsh_complete()
|
#compdef dotnet
|
||||||
{
|
_dotnet_completion() {
|
||||||
local completions=("$(dotnet complete "$words")")
|
local -a completions=("${(@f)$(dotnet complete "${words}")}")
|
||||||
|
compadd -a completions
|
||||||
# If the completion list is empty, just continue with filename selection
|
_files
|
||||||
if [ -z "$completions" ]
|
|
||||||
then
|
|
||||||
_arguments '*::arguments: _normal'
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
# This is not a variable assignment, don't remove spaces!
|
|
||||||
_values = "${(ps:\n:)completions}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
compdef _dotnet_zsh_complete dotnet
|
compdef _dotnet_completion dotnet
|
||||||
|
|
||||||
# Aliases bellow are here for backwards compatibility
|
# Aliases bellow are here for backwards compatibility
|
||||||
# added by Shaun Tabone (https://github.com/xontab)
|
# added by Shaun Tabone (https://github.com/xontab)
|
||||||
|
|||||||
@ -60,12 +60,22 @@ Available search contexts are:
|
|||||||
| typescript | `https://google.com/search?as_sitesearch=www.typescriptlang.org/docs&as_q=` |
|
| typescript | `https://google.com/search?as_sitesearch=www.typescriptlang.org/docs&as_q=` |
|
||||||
| unheap | `http://www.unheap.com/?s=` |
|
| unheap | `http://www.unheap.com/?s=` |
|
||||||
| vuejs | `https://www.google.com/search?as_sitesearch=vuejs.org&as_q=` |
|
| vuejs | `https://www.google.com/search?as_sitesearch=vuejs.org&as_q=` |
|
||||||
|
| nextjs | `https://www.google.com/search?as_sitesearch=nextjs.org&as_q=` |
|
||||||
|
|
||||||
If you want to have another context, open an Issue and tell us!
|
If you want to have another context, open an Issue and tell us!
|
||||||
|
|
||||||
## Fallback search behaviour
|
## Fallback search behaviour
|
||||||
|
|
||||||
The plugin will use Google as a fallback if the docs site for a search context does not have a search function. You can set the fallback search engine to DuckDuckGo by setting `FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced.
|
The plugin will use Google as a fallback if the docs site for a search context does not have a search
|
||||||
|
function. You can set the fallback search engine to DuckDuckGo by setting
|
||||||
|
`FRONTEND_SEARCH_FALLBACK='duckduckgo'` in your `~/.zshrc` file before Oh My Zsh is sourced.
|
||||||
|
|
||||||
|
## DuckDuckGo Lucky Search
|
||||||
|
|
||||||
|
Enable DuckDuckGo's "ducky" (lucky) search feature to automatically access the top search result. This feature
|
||||||
|
is optimized for DuckDuckGo, as Google redirects to an intermediate page. The FRONTEND_SEARCH_FALLBACK_LUCKY
|
||||||
|
environment variable triggers the use of DuckDuckGo's lucky search, rendering the FRONTEND_SEARCH_FALLBACK
|
||||||
|
setting unnecessary in this context.
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
|
|||||||
@ -27,12 +27,19 @@ alias stackoverflow='frontend stackoverflow'
|
|||||||
alias typescript='frontend typescript'
|
alias typescript='frontend typescript'
|
||||||
alias unheap='frontend unheap'
|
alias unheap='frontend unheap'
|
||||||
alias vuejs='frontend vuejs'
|
alias vuejs='frontend vuejs'
|
||||||
|
alias nextjs='frontend nextjs'
|
||||||
|
|
||||||
function _frontend_fallback() {
|
function _frontend_fallback() {
|
||||||
case "$FRONTEND_SEARCH_FALLBACK" in
|
if [[ "$FRONTEND_SEARCH_FALLBACK_LUCKY" == "true" ]]; then
|
||||||
duckduckgo) echo "https://duckduckgo.com/?sites=$1&q=" ;;
|
case true in
|
||||||
*) echo "https://google.com/search?as_sitesearch=$1&as_q=" ;;
|
*) echo "https://duckduckgo.com/?q=!ducky+site%3A$1+" ;;
|
||||||
esac
|
esac
|
||||||
|
else
|
||||||
|
case "$FRONTEND_SEARCH_FALLBACK" in
|
||||||
|
duckduckgo) echo "https://duckduckgo.com/?sites=$1&q=" ;;
|
||||||
|
*) echo "https://google.com/search?as_sitesearch=$1&as_q=" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function frontend() {
|
function frontend() {
|
||||||
@ -70,6 +77,7 @@ function frontend() {
|
|||||||
typescript $(_frontend_fallback 'www.typescriptlang.org/docs')
|
typescript $(_frontend_fallback 'www.typescriptlang.org/docs')
|
||||||
unheap 'http://www.unheap.com/?s='
|
unheap 'http://www.unheap.com/?s='
|
||||||
vuejs $(_frontend_fallback 'vuejs.org')
|
vuejs $(_frontend_fallback 'vuejs.org')
|
||||||
|
nextjs $(_frontend_fallback 'nextjs.org')
|
||||||
)
|
)
|
||||||
|
|
||||||
# show help for command list
|
# show help for command list
|
||||||
@ -81,7 +89,7 @@ function frontend() {
|
|||||||
print -P ""
|
print -P ""
|
||||||
print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
|
print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
|
||||||
print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash,"
|
print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash,"
|
||||||
print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
|
print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia, nextjs"
|
||||||
print -P ""
|
print -P ""
|
||||||
print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
|
print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
|
||||||
print -P ""
|
print -P ""
|
||||||
@ -96,7 +104,7 @@ function frontend() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
|
echo " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
|
||||||
echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash,"
|
echo " dartlang, emberjs, fontello, github, html5please, jest, jquery, lodash,"
|
||||||
echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
|
echo " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia, nextjs"
|
||||||
echo ""
|
echo ""
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user