Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Oh My Zsh
Commits
3b6a695b
Commit
3b6a695b
authored
Feb 11, 2015
by
Ashley Valent
Browse files
Merge branch 'master' of github.com:avalent/oh-my-zsh
parents
3ba10ad0
ef7e53a7
Changes
34
Hide whitespace changes
Inline
Side-by-side
plugins/web-search/web-search.plugin.zsh
View file @
3b6a695b
# web_search from terminal
function
web_search
()
{
# get the open command
local
open_cmd
if
[[
"
$OSTYPE
"
=
darwin
*
]]
;
then
open_cmd
=
'open'
else
open_cmd
=
'xdg-open'
fi
emulate
-L
zsh
# define search engine URLS
typeset
-A
urls
urls
=(
google
"https://www.google.com/search?q="
bing
"https://www.bing.com/search?q="
yahoo
"https://search.yahoo.com/search?p="
duckduckgo
"https://www.duckduckgo.com/?q="
yandex
"https://yandex.ru/yandsearch?text="
)
# define the open command
case
"
$OSTYPE
"
in
darwin
*
)
open_cmd
=
"open"
;;
cygwin
*
)
open_cmd
=
"cygstart"
;;
linux
*
)
open_cmd
=
"xdg-open"
;;
*
)
echo
"Platform
$OSTYPE
not supported"
return
1
;;
esac
# check whether the search engine is supported
if
[[
!
$1
=
~
'(google|bing|yahoo|duckduckgo)'
]]
;
then
if
[[
-z
"
$urls
[
$1
]"
]]
;
then
echo
"Search engine
$1
not supported."
return
1
fi
local
url
=
"http://www.
$1
.com"
# no keyword provided, simply open the search engine homepage
if
[[
$#
-le
1
]]
;
then
$open_cmd
"
$url
"
return
fi
if
[[
$1
==
'duckduckgo'
]]
;
then
#slightly different search syntax for DDG
url
=
"
${
url
}
/?q="
# search or go to main page depending on number of arguments passed
if
[[
$#
-gt
1
]]
;
then
# build search url:
# join arguments passed with '+', then append to search engine URL
url
=
"
${
urls
[
$1
]
}${
(j
:+:
)@[2,-1]
}
"
else
url
=
"
${
url
}
/search?q="
# build main page url:
# split by '/', then rejoin protocol (1) and domain (2) parts with '//'
url
=
"
${
(j
://:
)
${
(s
:/:
)urls[
$1
]
}
[1,2]
}
"
fi
shift
# shift out $1
while
[[
$#
-gt
0
]]
;
do
url
=
"
${
url
}
$1
+"
shift
done
url
=
"
${
url
%?
}
"
# remove the last '+'
nohup
$open_cmd
"
$url
"
>
/dev/null 2&>1
nohup
$open_cmd
"
$url
"
&>/dev/null
}
...
...
@@ -45,6 +48,8 @@ alias bing='web_search bing'
alias
google
=
'web_search google'
alias
yahoo
=
'web_search yahoo'
alias
ddg
=
'web_search duckduckgo'
alias
yandex
=
'web_search yandex'
#add your own !bang searches here
alias
wiki
=
'web_search duckduckgo \!w'
alias
news
=
'web_search duckduckgo \!n'
...
...
themes/adben.zsh-theme
View file @
3b6a695b
...
...
@@ -69,17 +69,17 @@ function precmd {
#Choose from all databases, regardless of whether they are considered "offensive"
fortune
-a
}
#obtains the tip
#obtains the tip
ps1_command_tip
()
{
wget
-qO
- http://www.commandlinefu.com/commands/random/plaintext |
sed
1d |
sed
'/^$/d'
}
}
prompt_header
()
{
if
[[
"true"
==
"
$ENABLE_COMMAND_TIP
"
]]
;
then
ps1_command_tip
else
ps1_fortune
fi
}
fi
}
PROMPT_HEAD
=
"
${
RED_START
}${
PR_YELLOW
}
$(
prompt_header
)
${
PR_RESET
}
"
# set a simple variable to show when in screen
if
[[
-n
"
${
WINDOW
}
"
]]
;
then
...
...
@@ -99,11 +99,8 @@ prompt_context () {
set_prompt
()
{
# required for the prompt
setopt prompt_subst
autoload colors zsh/terminfo
if
[[
"
$terminfo
[colors]"
-gt
8
]]
;
then
colors
fi
autoload zsh/terminfo
# ######### PROMPT #########
PROMPT
=
'${PROMPT_HEAD}
${RED_START}$(prompt_context)
...
...
themes/apple.zsh-theme
View file @
3b6a695b
...
...
@@ -7,7 +7,6 @@ get_git_dirty() {
}
autoload -Uz vcs_info
autoload -U colors && colors
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' unstagedstr '%F{red}*' # display this when there are unstaged changes
zstyle ':vcs_info:*' stagedstr '%F{yellow}+' # display this when there are staged changes
...
...
themes/gnzh.zsh-theme
View file @
3b6a695b
...
...
@@ -2,8 +2,7 @@
# Based on bira theme
# load some modules
autoload -U colors zsh/terminfo # Used in the colour alias below
colors
autoload -U zsh/terminfo # Used in the colour alias below
setopt prompt_subst
# make some aliases for the colours: (could use normal escape sequences too)
...
...
themes/half-life.zsh-theme
View file @
3b6a695b
...
...
@@ -13,8 +13,6 @@ function virtualenv_info {
PR_GIT_UPDATE=1
setopt prompt_subst
autoload colors
colors
autoload -U add-zsh-hook
autoload -Uz vcs_info
...
...
themes/jonathan.zsh-theme
View file @
3b6a695b
...
...
@@ -44,10 +44,7 @@ setprompt () {
###
# See if we can use colors.
autoload colors zsh/terminfo
if [[ "$terminfo[colors]" -ge 8 ]]; then
colors
fi
autoload zsh/terminfo
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
...
...
themes/kolo.zsh-theme
View file @
3b6a695b
autoload -U colors && colors
autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr '%F{green}●'
...
...
themes/linuxonly.zsh-theme
View file @
3b6a695b
...
...
@@ -13,7 +13,6 @@ local c7=$(printf "\033[38;5;149m")
local
c8
=
$(
printf
"
\0
33[38;5;126m"
)
local
c9
=
$(
printf
"
\0
33[38;5;162m"
)
local
foopath
=
$(
perl /home/scp1/bin/foopath
)
if
[
"
$TERM
"
=
"linux"
]
;
then
c1
=
$(
printf
"
\0
33[34;1m"
)
...
...
themes/mikeh.zsh-theme
View file @
3b6a695b
setopt prompt_subst
autoload colors
colors
autoload -U add-zsh-hook
autoload -Uz vcs_info
...
...
themes/rkj-repos.zsh-theme
View file @
3b6a695b
...
...
@@ -16,13 +16,15 @@ ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✗"
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}➦"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[magenta]%}✂"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}✈"
ZSH_THEME_GIT_PROMPT_SHA_BEFORE=" %{$fg[grey]%}"
ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%}"
function mygit() {
ref1=$(git symbolic-ref HEAD 2> /dev/null) || retur
n
ref
2
=$(
git rev-parse HEAD | head -c 6) || return
ref=
"$ref1 %{$fg[grey]%}$ref2"
#ref=$(git symbolic-ref HEAD 2> /dev/null)
$(git
rev-parse HEAD | head -c 6) || return
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$( git_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX "
if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; the
n
ref=$(
command git symbolic-ref HEAD 2> /dev/null) || \
ref=
$(command git rev-parse --short HEAD 2> /dev/null) || return
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(git_prompt_short_sha)
$(
git
_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX "
fi
}
function retcode() {}
...
...
themes/simonoff.zsh-theme
View file @
3b6a695b
...
...
@@ -63,10 +63,7 @@ setprompt () {
###
# See if we can use colors.
autoload colors zsh/terminfo
if [[ "$terminfo[colors]" -ge 8 ]]; then
colors
fi
autoload zsh/terminfo
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
...
...
themes/steeef.zsh-theme
View file @
3b6a695b
...
...
@@ -15,8 +15,6 @@ function virtualenv_info {
PR_GIT_UPDATE=1
setopt prompt_subst
autoload colors
colors
autoload -U add-zsh-hook
autoload -Uz vcs_info
...
...
themes/zhann.zsh-theme
View file @
3b6a695b
autoload -U colors && colors
autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr '%F{green}●'
...
...
tools/install.sh
View file @
3b6a695b
...
...
@@ -23,8 +23,8 @@ fi
echo
"
\0
33[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc
\0
33[0m"
cp
$ZSH
/templates/zshrc.zsh-template ~/.zshrc
sed
-i
-e
"/^ZSH=/ c
\\
ZSH=
$ZSH
sed
-i
-e
"/^
export
ZSH=/ c
\\
export
ZSH=
$ZSH
"
~/.zshrc
echo
"
\0
33[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.
\0
33[0m"
...
...
Prev
1
2
Next
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