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
Ohmyzsh
Commits
6fd0b73e
Commit
6fd0b73e
authored
Dec 15, 2014
by
zghember
Browse files
Merge commit '
141c2e59
'
parents
6f70d288
141c2e59
Changes
47
Hide whitespace changes
Inline
Side-by-side
lib/completion.zsh
View file @
6fd0b73e
...
...
@@ -25,7 +25,12 @@ bindkey -M menuselect '^o' accept-and-infer-next-history
zstyle
':completion:*:*:*:*:*'
menu
select
zstyle
':completion:*:*:kill:*:processes'
list-colors
'=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
zstyle
':completion:*:*:*:*:processes'
command
"ps -u
`
whoami
`
-o pid,user,comm -w -w"
if
[
"
$OSTYPE
[0,7]"
=
"solaris"
]
then
zstyle
':completion:*:*:*:*:processes'
command
"ps -u
$USER
-o pid,user,comm"
else
zstyle
':completion:*:*:*:*:processes'
command
"ps -u
$USER
-o pid,user,comm -w -w"
fi
# disable named-directories autocompletion
zstyle
':completion:*:cd:*'
tag-order local-directories directory-stack path-directories
...
...
lib/git.zsh
View file @
6fd0b73e
...
...
@@ -10,23 +10,20 @@ function git_prompt_info() {
# Checks if working tree is dirty
parse_git_dirty
()
{
local
S
UBMODULE_SYNTAX
=
''
local
GIT_STATUS
=
''
local
CLEAN_MESSAGE
=
'nothing to commit (working directory clean)'
if
[[
"
$(
command
git config
--get
oh-my-zsh.hide-
status
)
"
!=
"1"
]]
;
then
local
S
TATUS
=
''
local
FLAGS
FLAGS
=(
'--porcelain'
)
if
[[
"
$(
command
git config
--get
oh-my-zsh.hide-
dirty
)
"
!=
"1"
]]
;
then
if
[[
$POST_1_7_2_GIT
-gt
0
]]
;
then
SUBMODULE_SYNTAX
=
"
--ignore-submodules=dirty
"
FLAGS+
=
'
--ignore-submodules=dirty
'
fi
if
[[
"
$DISABLE_UNTRACKED_FILES_DIRTY
"
==
"true"
]]
;
then
GIT_STATUS
=
$(
command
git status
-s
${
SUBMODULE_SYNTAX
}
-uno
2> /dev/null |
tail
-n1
)
else
GIT_STATUS
=
$(
command
git status
-s
${
SUBMODULE_SYNTAX
}
2> /dev/null |
tail
-n1
)
fi
if
[[
-n
$GIT_STATUS
]]
;
then
echo
"
$ZSH_THEME_GIT_PROMPT_DIRTY
"
else
echo
"
$ZSH_THEME_GIT_PROMPT_CLEAN
"
FLAGS+
=
'--untracked-files=no'
fi
STATUS
=
$(
command
git status
${
FLAGS
}
2> /dev/null |
tail
-n1
)
fi
if
[[
-n
$STATUS
]]
;
then
echo
"
$ZSH_THEME_GIT_PROMPT_DIRTY
"
else
echo
"
$ZSH_THEME_GIT_PROMPT_CLEAN
"
fi
...
...
@@ -135,17 +132,19 @@ function git_compare_version() {
INSTALLED_GIT_VERSION
=(
${
(s/./)INSTALLED_GIT_VERSION[3]
}
)
;
for
i
in
{
1..3
}
;
do
if
[[
$INSTALLED_GIT_VERSION
[
$i
]
-gt
$INPUT_GIT_VERSION
[
$i
]
]]
;
then
echo
1
return
0
fi
if
[[
$INSTALLED_GIT_VERSION
[
$i
]
-lt
$INPUT_GIT_VERSION
[
$i
]
]]
;
then
echo
-1
return
0
fi
done
echo
1
echo
0
}
#this is unlikely to change so make it all statically assigned
POST_1_7_2_GIT
=
$(
git_compare_version
"1.7.2"
)
#clean up the namespace slightly by removing the checker function
unset
-f
git_compare_version
oh-my-zsh.sh
View file @
6fd0b73e
...
...
@@ -8,18 +8,20 @@ fi
# add a function path
fpath
=(
$ZSH
/functions
$ZSH
/completions
$fpath
)
# Load all of the config files in ~/oh-my-zsh that end in .zsh
# TIP: Add files you don't want in git to .gitignore
for
config_file
(
$ZSH
/lib/
*
.zsh
)
;
do
source
$config_file
done
# Set ZSH_CUSTOM to the path where your custom config files
# and plugins exists, or else we will use the default custom/
if
[[
-z
"
$ZSH_CUSTOM
"
]]
;
then
ZSH_CUSTOM
=
"
$ZSH
/custom"
fi
# Load all of the config files in ~/oh-my-zsh that end in .zsh
# TIP: Add files you don't want in git to .gitignore
for
config_file
(
$ZSH
/lib/
*
.zsh
)
;
do
custom_config_file
=
"
${
ZSH_CUSTOM
}
/lib/
${
config_file
:t
}
"
[
-f
"
${
custom_config_file
}
"
]
&&
config_file
=
${
custom_config_file
}
source
$config_file
done
is_plugin
()
{
local
base_dir
=
$1
...
...
plugins/autojump/autojump.plugin.zsh
View file @
6fd0b73e
if
[
$commands
[
autojump]
]
;
then
# check if autojump is installed
if
[
-f
$HOME
/.autojump/etc/profile.d/autojump.zsh
]
;
then
# manual user-local installation
.
$HOME
/.autojump/etc/profile.d/autojump.zsh
elif
[
-f
$HOME
/.nix-profile/etc/profile.d/autojump.zsh
]
;
then
# nix installation
.
$HOME
/.nix-profile/etc/profile.d/autojump.zsh
elif
[
-f
/usr/share/autojump/autojump.zsh
]
;
then
# debian and ubuntu package
.
/usr/share/autojump/autojump.zsh
elif
[
-f
/etc/profile.d/autojump.zsh
]
;
then
# manual installation
...
...
plugins/aws/aws.plugin.zsh
View file @
6fd0b73e
...
...
@@ -3,19 +3,17 @@ _homebrew-installed() {
}
_awscli-homebrew-installed
()
{
brew
--prefix
awscli &> /dev/null
brew
list
awscli &> /dev/null
}
export
AWS_HOME
=
~/.aws
function
agp
{
echo
$AWS_DEFAULT_PROFILE
}
function
asp
{
export
AWS_DEFAULT_PROFILE
=
$1
export
RPROMPT
=
"<aws:
$AWS_DEFAULT_PROFILE
>"
export
RPROMPT
=
"<aws:
$AWS_DEFAULT_PROFILE
>"
}
function
aws_profiles
{
reply
=(
$(
grep
profile
$AWS_HOME
/config|sed
-e
's/.*profile \([a-zA-Z0-9_-]*\).*/\1/'
)
)
...
...
plugins/colored-man/colored-man.plugin.zsh
View file @
6fd0b73e
if
[
"
$OSTYPE
[0,7]"
=
"solaris"
]
then
if
[
!
-x
${
HOME
}
/bin/nroff
]
then
mkdir
-p
${
HOME
}
/bin
cat
>
${
HOME
}
/bin/nroff
<<
EOF
#!/bin/sh
if [ -n "
\$
_NROFF_U" -a "
\$
1,
\$
2,
\$
3" = "-u0,-Tlp,-man" ]; then
shift
exec /usr/bin/nroff -u
\$
{_NROFF_U} "
\$
@"
fi
#-- Some other invocation of nroff
exec /usr/bin/nroff "
\$
@"
EOF
chmod
+x
${
HOME
}
/bin/nroff
fi
fi
man
()
{
env
\
LESS_TERMCAP_mb
=
$(
printf
"
\e
[1;31m"
)
\
...
...
@@ -7,5 +25,8 @@ man() {
LESS_TERMCAP_so
=
$(
printf
"
\e
[1;44;33m"
)
\
LESS_TERMCAP_ue
=
$(
printf
"
\e
[0m"
)
\
LESS_TERMCAP_us
=
$(
printf
"
\e
[1;32m"
)
\
PAGER
=
/usr/bin/less
\
_NROFF_U
=
1
\
PATH
=
${
HOME
}
/bin:
${
PATH
}
\
man
"
$@
"
}
plugins/common-aliases/common-aliases.plugin.zsh
View file @
6fd0b73e
...
...
@@ -46,7 +46,6 @@ alias ff='find . -type f -name'
alias
h
=
'history'
alias
hgrep
=
"fc -El 0 | grep"
alias help
=
'man'
alias
j
=
'jobs'
alias
p
=
'ps -f'
alias
sortnr
=
'sort -n -r'
alias
unexport
=
'unset'
...
...
plugins/dirhistory/dirhistory.plugin.zsh
View file @
6fd0b73e
...
...
@@ -3,7 +3,7 @@
# that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT.
#
dirhistory_past
=(
`
pwd
`
)
dirhistory_past
=(
$PWD
)
dirhistory_future
=()
export
dirhistory_past
export
dirhistory_future
...
...
@@ -50,7 +50,7 @@ function push_future() {
# Called by zsh when directory changes
function
chpwd
()
{
push_past
`
pwd
`
push_past
$PWD
# If DIRHISTORY_CD is not set...
if
[[
-z
"
${
DIRHISTORY_CD
+x
}
"
]]
;
then
# ... clear future.
...
...
@@ -73,7 +73,7 @@ function dirhistory_back() {
pop_past cw
if
[[
""
==
"
$cw
"
]]
;
then
# Someone overwrote our variable. Recover it.
dirhistory_past
=(
`
pwd
`
)
dirhistory_past
=(
$PWD
)
return
fi
...
...
plugins/emoji-clock/emoji-clock.plugin.zsh
View file @
6fd0b73e
...
...
@@ -8,21 +8,25 @@
# -----------------------------------------------------------------------------
function
emoji-clock
()
{
hour
=
$(
date
-v
'+15M'
'+%I'
)
minutes
=
$(
date
-v
'+15M'
'+%M'
)
# Add 15 minutes to the current time and save the value as $minutes.
((
minutes
=
$(
date
'+%M'
)
+ 15
))
((
hour
=
$(
date
'+%I'
)
+ minutes / 60
))
# make sure minutes and hours don't exceed 60 nor 12 respectively
((
minutes %
=
60
))
;
((
hour %
=
12
))
case
$hour
in
01
)
clock
=
"🕐"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕜"
;;
02
)
clock
=
"🕑"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕝"
;;
03
)
clock
=
"🕒"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕞"
;;
04
)
clock
=
"🕓"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕟"
;;
05
)
clock
=
"🕔"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕠"
;;
06
)
clock
=
"🕕"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕡"
;;
07
)
clock
=
"🕖"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕢"
;;
08
)
clock
=
"🕗"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕣"
;;
09
)
clock
=
"🕘"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕤"
;;
0
)
clock
=
"🕛"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕧"
;;
1
)
clock
=
"🕐"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕜"
;;
2
)
clock
=
"🕑"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕝"
;;
3
)
clock
=
"🕒"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕞"
;;
4
)
clock
=
"🕓"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕟"
;;
5
)
clock
=
"🕔"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕠"
;;
6
)
clock
=
"🕕"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕡"
;;
7
)
clock
=
"🕖"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕢"
;;
8
)
clock
=
"🕗"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕣"
;;
9
)
clock
=
"🕘"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕤"
;;
10
)
clock
=
"🕙"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕥"
;;
11
)
clock
=
"🕚"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕦"
;;
12
)
clock
=
"🕛"
;
[
$minutes
-ge
30
]
&&
clock
=
"🕧"
;;
*
)
clock
=
"⌛"
;;
esac
echo
$clock
...
...
plugins/extract/extract.plugin.zsh
View file @
6fd0b73e
...
...
@@ -38,7 +38,7 @@ function extract() {
file_name
=
"
$(
basename
"
$1
"
)
"
extract_dir
=
"
$(
echo
"
$file_name
"
|
sed
"s/
\.
${
1
##*.
}
//g"
)
"
case
"
$1
"
in
(
*
.tar.gz|
*
.tgz
)
tar
xv
z
f
"
$1
"
;;
(
*
.tar.gz|
*
.tgz
)
[
-z
$commands
[
pigz]
]
&&
tar
z
xvf
"
$1
"
||
pigz
-dc
"
$1
"
|
tar
xv
;;
(
*
.tar.bz2|
*
.tbz|
*
.tbz2
)
tar
xvjf
"
$1
"
;;
(
*
.tar.xz|
*
.txz
)
tar
--xz
--help
&> /dev/null
\
&&
tar
--xz
-xvf
"
$1
"
\
...
...
@@ -47,7 +47,7 @@ function extract() {
&&
tar
--lzma
-xvf
"
$1
"
\
||
lzcat
"
$1
"
|
tar
xvf -
;;
(
*
.tar
)
tar
xvf
"
$1
"
;;
(
*
.gz
)
gunzip
"
$1
"
;;
(
*
.gz
)
[
-z
$commands
[
pigz]
]
&&
gunzip
"
$1
"
||
pigz
-d
"
$1
"
;;
(
*
.bz2
)
bunzip2
"
$1
"
;;
(
*
.xz
)
unxz
"
$1
"
;;
(
*
.lzma
)
unlzma
"
$1
"
;;
...
...
plugins/forklift/forklift.plugin.zsh
View file @
6fd0b73e
# Open folder in ForkLift.app o
f
ForkLift2.app from console
# Open folder in ForkLift.app o
r
ForkLift2.app from console
# Author: Adam Strzelecki nanoant.com, modified by Bodo Tasche bitboxer.de
# Updated to support ForkLift2 by Johan Kaving
#
...
...
plugins/frontend-search/frontend-search.plugin.zsh
View file @
6fd0b73e
...
...
@@ -118,7 +118,7 @@ alias jquery='frontend jquery'
alias
mdn
=
'frontend mdn'
# pre processors frameworks
alias
compass
=
'frontend compass'
alias
compass
doc
=
'frontend compass'
# important links
alias
html5please
=
'frontend html5please'
...
...
plugins/gitignore/gitignore.plugin.zsh
View file @
6fd0b73e
function
gi
()
{
curl http://www.gitignore.io/api/
$@
;
}
function
gi
()
{
curl
-sL
http
s
://www.gitignore.io/api/
$@
;
}
_gitign
i
reio_get_command_list
()
{
curl
-s
http://www.gitignore.io/api/list |
tr
","
"
\n
"
_gitign
o
reio_get_command_list
()
{
curl
-s
L
http
s
://www.gitignore.io/api/list |
tr
","
"
\n
"
}
_gitign
i
reio
()
{
_gitign
o
reio
()
{
compset
-P
'*,'
compadd
-S
''
`
_gitign
i
reio_get_command_list
`
compadd
-S
''
`
_gitign
o
reio_get_command_list
`
}
compdef _gitign
i
reio gi
compdef _gitign
o
reio gi
plugins/jump/jump.plugin.zsh
View file @
6fd0b73e
...
...
@@ -14,12 +14,12 @@ jump() {
mark
()
{
if
((
$#
==
0
))
;
then
MARK
=
$(
basename
"
$
(
pwd
)
"
)
MARK
=
$(
basename
"
$
PWD
"
)
else
MARK
=
"
$1
"
fi
if
read
-q
\?
"Mark
$
(
pwd
)
as
${
MARK
}
? (y/n) "
;
then
mkdir
-p
"
$MARKPATH
"
;
ln
-s
"
$
(
pwd
)
"
"
$MARKPATH
/
$MARK
"
if
read
-q
\?
"Mark
$
PWD
as
${
MARK
}
? (y/n) "
;
then
mkdir
-p
"
$MARKPATH
"
;
ln
-s
"
$
PWD
"
"
$MARKPATH
/
$MARK
"
fi
}
...
...
plugins/osx/osx.plugin.zsh
View file @
6fd0b73e
...
...
@@ -139,7 +139,7 @@ function man-preview() {
function
trash
()
{
local
trash_dir
=
"
${
HOME
}
/.Trash"
local
temp_ifs
=
$IFS
local
temp_ifs
=
"
$IFS
"
IFS
=
$'
\n
'
for
item
in
"
$@
"
;
do
if
[[
-e
"
$item
"
]]
;
then
...
...
plugins/pj/pj.plugin.zsh
View file @
6fd0b73e
...
...
@@ -18,8 +18,11 @@ function pj() {
file
=
$1
if
[[
"open"
==
"
$file
"
]]
then
file
=
$2
shift
file
=
$*
cmd
=(
${
(s
:
:
)EDITOR
}
)
else
file
=
$*
fi
for
project
in
$PROJECT_PATHS
;
do
...
...
@@ -36,7 +39,11 @@ function pj() {
alias
pjo
=
"pj open"
function
_pj
()
{
compadd
`
/bin/ls
-l
$PROJECT_PATHS
2>/dev/null |
awk
'{ print $9 }'
`
# might be possible to improve this using glob, without the basename trick
typeset
-a
projects
projects
=(
$PROJECT_PATHS
/
*
)
projects
=
$projects
:t
_arguments
"*:file:(
$projects
)"
}
compdef _pj pj
plugins/pow/pow.plugin.zsh
View file @
6fd0b73e
...
...
@@ -21,13 +21,13 @@
rack_root
(){
setopt chaselinks
local
orgdir
=
"
$
(
pwd
)
"
local
basedir
=
"
$
(
pwd
)
"
local
orgdir
=
"
$
PWD
"
local
basedir
=
"
$
PWD
"
while
[[
$basedir
!=
'/'
]]
;
do
test
-e
"
$basedir
/config.ru"
&&
break
builtin cd
".."
2>/dev/null
basedir
=
"
$
(
pwd
)
"
basedir
=
"
$
PWD
"
done
builtin cd
"
$orgdir
"
2>/dev/null
...
...
@@ -56,7 +56,7 @@ kapow(){
compctl
-W
~/.pow -/ kapow
powit
(){
local
basedir
=
"
$
(
pwd
)
"
local
basedir
=
"
$
PWD
"
local
vhost
=
$1
[
!
-n
"
$vhost
"
]
&&
vhost
=
$(
rack_root_detect
)
if
[
!
-h
~/.pow/
$vhost
]
...
...
plugins/profiles/profiles.plugin.zsh
View file @
6fd0b73e
...
...
@@ -2,7 +2,7 @@
# This will look for a custom profile for the local machine and each domain or
# subdomain it belongs to. (e.g. com, example.com and foo.example.com)
parts
=(
${
(s
:.:
)
$(
hostname
)
}
)
parts
=(
${
(s
:.:
)
HOST
}
)
for
i
in
{
${#
parts
}
..1
}
;
do
profile
=
${
(j
:.:
)
${
parts
[
$i
,
${#
parts
}
]
}}
file
=
$ZSH_CUSTOM
/profiles/
$profile
...
...
plugins/rails/rails.plugin.zsh
View file @
6fd0b73e
...
...
@@ -6,7 +6,7 @@ function _rails_command () {
elif
[
-e
"script/server"
]
;
then
ruby script/
$@
else
rails
$@
command
rails
$@
fi
}
...
...
@@ -14,7 +14,7 @@ function _rake_command () {
if
[
-e
"bin/rake"
]
;
then
bin/rake
$@
else
rake
$@
command
rake
$@
fi
}
...
...
plugins/scd/README.md
View file @
6fd0b73e
...
...
@@ -11,12 +11,9 @@ the index. A selection menu is displayed in case of several matches, with a
preference given to recently visited paths.
`scd`
can create permanent
directory aliases, which appear as named directories in zsh session.
## INSTALLATION
## INSTALLATION
NOTES
For oh-my-zsh, add
`scd`
to the
`plugins`
array in the ~/.zshrc file as in the
[
template file
](
../../templates/zshrc.zsh-template#L45
)
.
Besides zsh,
`scd`
can be used with
*bash*
,
*dash*
or
*tcsh*
Besides oh-my-zsh,
`scd`
can be used with
*bash*
,
*dash*
or
*tcsh*
shells and is also available as
[
Vim
](
http://www.vim.org/
)
plugin and
[
IPython
](
http://ipython.org/
)
extension. For installation details, see
https://github.com/pavoljuhas/smart-change-directory.
...
...
@@ -34,7 +31,7 @@ scd [options] [pattern1 pattern2 ...]
add specified directories to the directory index.
</dd><dt>
--unindex
</dt><dd>
remove specified directories from the index.
</dd><dt>
remove
current or
specified directories from the index.
</dd><dt>
-r, --recursive
</dt><dd>
apply options
<em>
--add
</em>
or
<em>
--unindex
</em>
recursively.
</dd><dt>
...
...
@@ -47,6 +44,10 @@ scd [options] [pattern1 pattern2 ...]
remove ALIAS definition for the current or specified directory from
<em>
~/.scdalias.zsh
</em>
.
</dd><dt>
-A, --all
</dt><dd>
include all matching directories. Disregard matching by directory
alias and filtering of less likely paths.
</dd><dt>
--list
</dt><dd>
show matching directories and exit.
</dd><dt>
...
...
@@ -70,7 +71,7 @@ scd doc
scd a b c
# Change to a directory path that ends with "ts"
scd
"ts
(#e)
"
scd
"ts
$
"
# Show selection menu and ranking of 20 most likely directories
scd
-v
...
...
Prev
1
2
3
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