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
18ef1ee6
Commit
18ef1ee6
authored
Aug 25, 2015
by
Dawid Ferenczy
Browse files
Merge remote-tracking branch 'robbyrussell/master'
parents
eafd5f32
192de6bc
Changes
234
Hide whitespace changes
Inline
Side-by-side
plugins/profiles/profiles.plugin.zsh
View file @
18ef1ee6
...
...
@@ -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 @
18ef1ee6
...
...
@@ -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
}
...
...
@@ -45,10 +45,12 @@ alias rsd='rails server --debugger'
# Rake aliases
alias
rdm
=
'rake db:migrate'
alias
rdms
=
'rake db:migrate:status'
alias
rdr
=
'rake db:rollback'
alias
rdc
=
'rake db:create'
alias
rds
=
'rake db:seed'
alias
rdd
=
'rake db:drop'
alias
rdrs
=
'rake db:reset'
alias
rdtc
=
'rake db:test:clone'
alias
rdtp
=
'rake db:test:prepare'
alias
rdmtc
=
'rake db:migrate db:test:clone'
...
...
@@ -58,7 +60,7 @@ alias rn='rake notes'
alias
rr
=
'rake routes'
# legacy stuff
alias
ss
=
'thin --stats "/thin/stats" start'
alias
ss
tat
=
'thin --stats "/thin/stats" start'
alias
sg
=
'ruby script/generate'
alias
sd
=
'ruby script/destroy'
alias
sp
=
'ruby script/plugin'
...
...
plugins/rails3/rails3.plugin.zsh
deleted
100644 → 0
View file @
eafd5f32
echo
"It looks like you have been using the 'rails3' plugin,"
echo
"which has been deprecated in favor of a newly consolidated 'rails' plugin."
echo
"You will want to modify your ~/.zshrc configuration to begin using it."
echo
"Learn more at https://github.com/robbyrussell/oh-my-zsh/pull/2240"
plugins/rails4/rails4.plugin.zsh
deleted
100644 → 0
View file @
eafd5f32
echo
"It looks like you have been using the 'rails4' plugin,"
echo
"which has been deprecated in favor of a newly consolidated 'rails' plugin."
echo
"You will want to modify your ~/.zshrc configuration to begin using it."
echo
"Learn more at https://github.com/robbyrussell/oh-my-zsh/pull/2240"
plugins/rake-fast/rake-fast.plugin.zsh
View file @
18ef1ee6
...
...
@@ -10,7 +10,7 @@ _rake_refresh () {
_rake_does_task_list_need_generating
()
{
if
[
!
-f
.rake_tasks
]
;
then return
0
;
else
if
[[
$(
uname
-s
)
==
'D
arwin
'
]]
;
then
if
[[
"
$OSTYPE
"
=
d
arwin
*
]]
;
then
accurate
=
$(
stat
-f
%m .rake_tasks
)
changed
=
$(
stat
-f
%m Rakefile
)
else
...
...
plugins/rbenv/rbenv.plugin.zsh
View file @
18ef1ee6
...
...
@@ -7,7 +7,7 @@ _rbenv-from-homebrew-installed() {
}
FOUND_RBENV
=
0
rbenvdirs
=(
"
$HOME
/.rbenv"
"/usr/local/rbenv"
"/opt/rbenv"
)
rbenvdirs
=(
"
$HOME
/.rbenv"
"/usr/local/rbenv"
"/opt/rbenv"
"/usr/local/opt/rbenv"
)
if
_homebrew-installed
&&
_rbenv-from-homebrew-installed
;
then
rbenvdirs
=(
$(
brew
--prefix
rbenv
)
"
${
rbenvdirs
[@]
}
"
)
fi
...
...
plugins/repo/repo.plugin.zsh
View file @
18ef1ee6
...
...
@@ -10,3 +10,9 @@ compdef _repo rs='repo sync'
alias
rsrra
=
'repo sync ; repo rebase --auto-stash'
compdef _repo
rsrra
=
'repo sync ; repo rebase --auto-stash'
alias
ru
=
'repo upload'
compdef _repo
ru
=
'repo upload'
alias
rst
=
'repo status'
compdef _repo
rst
=
'repo status'
plugins/rsync/rsync.plugin.zsh
View file @
18ef1ee6
alias
rsync-copy
=
"rsync -av --progress -h"
alias
rsync-move
=
"rsync -av --progress -h --remove-source-files"
alias
rsync-update
=
"rsync -avu --progress -h"
alias
rsync-synchronize
=
"rsync -avu --delete --progress -h"
alias
rsync-copy
=
"rsync -av
z
--progress -h"
alias
rsync-move
=
"rsync -av
z
--progress -h --remove-source-files"
alias
rsync-update
=
"rsync -av
z
u --progress -h"
alias
rsync-synchronize
=
"rsync -av
z
u --delete --progress -h"
plugins/rvm/rvm.plugin.zsh
View file @
18ef1ee6
...
...
@@ -6,6 +6,7 @@ alias gemsets='rvm gemset list'
local
ruby18
=
'ruby-1.8.7'
local
ruby19
=
'ruby-1.9.3'
local
ruby20
=
'ruby-2.0.0'
local
ruby21
=
'ruby-2.1.2'
function
rb18
{
if
[
-z
"
$1
"
]
;
then
...
...
@@ -40,6 +41,17 @@ function rb20 {
_rb20
()
{
compadd
`
ls
-1
$rvm_path
/gems |
grep
"^
$ruby20
@"
|
sed
-e
"s/^
$ruby20
@//"
|
awk
'{print $1}'
`
}
compdef _rb20 rb20
function
rb21
{
if
[
-z
"
$1
"
]
;
then
rvm use
"
$ruby21
"
else
rvm use
"
$ruby21
@
$1
"
fi
}
_rb21
()
{
compadd
`
ls
-1
$rvm_path
/gems |
grep
"^
$ruby21
@"
|
sed
-e
"s/^
$ruby21
@//"
|
awk
'{print $1}'
`
}
compdef _rb21 rb21
function
rvm-update
{
rvm get
head
}
...
...
plugins/scd/README.md
View file @
18ef1ee6
...
...
@@ -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
...
...
plugins/scd/scd
View file @
18ef1ee6
...
...
@@ -11,20 +11,22 @@ fi
local
DOC
=
'scd -- smart change to a recently used directory
usage: scd [options] [pattern1 pattern2 ...]
Go to a directory path that contains all fixed string patterns. Prefer
recently visited directories a
nd directories with patterns in their tail
component.
Display a selection menu in case of multiple matches.
recent
or frequent
ly visited directories a
s found in the directory index.
Display a selection menu in case of multiple matches.
Options:
-a, --add add specified directories to the directory index
--unindex remove specified directories from the index
-r, --recursive apply options --add or --unindex recursively
-a, --add add specified directories to the directory index
.
--unindex remove
current or
specified directories from the index
.
-r, --recursive apply options --add or --unindex recursively
.
--alias=ALIAS create alias for the current or specified directory and
store it in ~/.scdalias.zsh
store it in ~/.scdalias.zsh
.
--unalias remove ALIAS definition for the current or specified
directory from ~/.scdalias.zsh
--list show matching directories and exit
-v, --verbose display directory rank in the selection menu
-h, --help display this message and exit
directory from ~/.scdalias.zsh.
-A, --all include all matching directories. Disregard matching by
directory alias and filtering of less likely paths.
--list show matching directories and exit.
-v, --verbose display directory rank in the selection menu.
-h, --help display this message and exit.
'
local
SCD_HISTFILE
=
${
SCD_HISTFILE
:-${
HOME
}
/.scdhistory
}
...
...
@@ -35,9 +37,9 @@ local SCD_THRESHOLD=${SCD_THRESHOLD:-0.005}
local
SCD_SCRIPT
=
${
RUNNING_AS_COMMAND
:+
$SCD_SCRIPT
}
local
SCD_ALIAS
=
~/.scdalias.zsh
local
ICASE a d m p i
tdir
maxrank threshold
local
ICASE a d m p i maxrank threshold
local
opt_help opt_add opt_unindex opt_recursive opt_verbose
local
opt_alias opt_unalias opt_list
local
opt_alias opt_unalias
opt_all
opt_list
local
-A
drank dalias
local
dmatching
local
last_directory
...
...
@@ -56,7 +58,8 @@ zmodload -i zsh/zutil
zmodload
-i
zsh/datetime
zparseopts
-D
--
a
=
opt_add
-add
=
opt_add
-unindex
=
opt_unindex
\
r
=
opt_recursive
-recursive
=
opt_recursive
\
-alias
:
=
opt_alias
-unalias
=
opt_unalias
-list
=
opt_list
\
-alias
:
=
opt_alias
-unalias
=
opt_unalias
\
A
=
opt_all
-all
=
opt_all
-list
=
opt_list
\
v
=
opt_verbose
-verbose
=
opt_verbose
h
=
opt_help
-help
=
opt_help
\
||
$EXIT
$?
...
...
@@ -68,6 +71,11 @@ fi
# load directory aliases if they exist
[[
-r
$SCD_ALIAS
]]
&&
source
$SCD_ALIAS
# Private internal functions are prefixed with _scd_Y19oug_.
# Clean them up when the scd function returns.
setopt localtraps
trap
'unfunction -m "_scd_Y19oug_*"'
EXIT
# works faster than the (:a) modifier and is compatible with zsh 4.2.6
_scd_Y19oug_abspath
()
{
set
-A
$1
${
(ps
:
\0
:
)
"
$(
...
...
@@ -123,11 +131,52 @@ if [[ -n $opt_unalias ]]; then
$EXIT
$?
fi
# The "compress" function collapses repeated directories to
# one entry with a time stamp that gives equivalent-probability.
_scd_Y19oug_compress
()
{
awk
-v
epochseconds
=
$EPOCHSECONDS
-v
meanlife
=
$SCD_MEANLIFE
'
BEGIN { FS = "[:;]"; }
length($0) < 4096 && $2 > 0 {
tau = 1.0 * ($2 - epochseconds) / meanlife;
if (tau < -6.9078) tau = -6.9078;
prob = exp(tau);
sub(/^[^;]*;/, "");
if (NF) {
dlist[last[$0]] = "";
dlist[NR] = $0;
last[$0] = NR;
ptot[$0] += prob;
}
}
END {
for (i = 1; i <= NR; ++i) {
d = dlist[i];
if (d) {
ts = log(ptot[d]) * meanlife + epochseconds;
printf(": %.0f:0;%s\n", ts, d);
}
}
}
'
$*
}
# Rewrite directory index if it is at least 20% oversized
if
[[
-s
$SCD_HISTFILE
]]
&&
\
((
$(
wc
-l
<
$SCD_HISTFILE
)
>
1.2
*
$SCD_HISTSIZE
))
;
then
m
=(
${
(f)
"
$(
<
$SCD_HISTFILE
)
"
}
)
print
-lr
--
${
m
[-
$SCD_HISTSIZE
,-1]
}
>
|
${
SCD_HISTFILE
}
# compress repeated entries
m
=(
${
(f)
"
$(
_scd_Y19oug_compress
$SCD_HISTFILE
)
"
}
)
# purge non-existent directories
m
=(
${
(f)
"
$(
for
a
in
$m
;
do
if
[[
-d
${
a
#*;
}
]]
;
then
print
-r
--
$a
;
fi
done
)
"
}
)
# cut old entries if still oversized
if
[[
$#m
-gt
$SCD_HISTSIZE
]]
;
then
m
=(
${
m
[-
$SCD_HISTSIZE
,-1]
}
)
fi
print
-lr
--
$m
>
|
${
SCD_HISTFILE
}
fi
# Determine the last recorded directory
...
...
@@ -135,7 +184,6 @@ if [[ -s ${SCD_HISTFILE} ]]; then
last_directory
=
${
"
$(
tail
-1
${
SCD_HISTFILE
}
)
"
#*;
}
fi
# Internal functions are prefixed with "_scd_Y19oug_".
# The "record" function adds its arguments to the directory index.
_scd_Y19oug_record
()
{
while
[[
-n
$last_directory
&&
$1
==
$last_directory
]]
;
do
...
...
@@ -217,7 +265,7 @@ _scd_Y19oug_action() {
# set global arrays dmatching and drank
_scd_Y19oug_match
()
{
## single argument that is an existing directory or directory alias
if
[[
$#
==
1
]]
&&
\
if
[[
-z
$opt_all
&&
$#
==
1
]]
&&
\
[[
-d
${
d
::
=
$1
}
||
-d
${
d
::
=
${
nameddirs
[
$1
]
}}
]]
&&
[[
-x
$d
]]
;
then
_scd_Y19oug_abspath dmatching
$d
...
...
@@ -227,6 +275,8 @@ _scd_Y19oug_match() {
# ignore case unless there is an argument with an uppercase letter
[[
"
$*
"
==
*
[[
:upper:]]
*
]]
||
ICASE
=
'(#i)'
# support "$" as an anchor for the directory name ending
argv
=(
${
argv
/(#m)?[
$]
(#e)/
${
MATCH
[1]
}
(#e)
}
)
# calculate rank of all directories in the SCD_HISTFILE and keep it as drank
# include a dummy entry for splitting of an empty string is buggy
...
...
@@ -237,10 +287,10 @@ _scd_Y19oug_match() {
BEGIN { FS = "[:;]"; }
length($0) < 4096 && $2 > 0 {
tau = 1.0 * ($2 - epochseconds) / meanlife;
if (tau < -
4.61
) tau = -
4.61
;
pr
ec
= exp(tau);
if (tau < -
6.9078
) tau = -
6.9078
;
pr
ob
= exp(tau);
sub(/^[^;]*;/, "");
if (NF) ptot[$0] += pr
ec
;
if (NF) ptot[$0] += pr
ob
;
}
END { for (di in ptot) { print di; print ptot[di]; } }'
)
"
}
...
...
@@ -249,9 +299,12 @@ _scd_Y19oug_match() {
# filter drank to the entries that match all arguments
for
a
;
do
p
=
${
ICASE
}
"*
${
a
}
*"
p
=
${
ICASE
}
"*
(
${
a
}
)
*"
drank
=(
${
(kv)drank[(I)
${
~p
}
]
}
)
done
# require at least one argument matches the directory name
p
=
${
ICASE
}
"*(
${
(j
:|:
)argv
}
)[^/]#"
drank
=(
${
(kv)drank[(I)
${
~p
}
]
}
)
# build a list of matching directories reverse-sorted by their probabilities
dmatching
=(
${
(f)
"
$(
...
...
@@ -261,26 +314,6 @@ _scd_Y19oug_match() {
)
"
}
)
# if some directory paths match all patterns in order, discard all others
p
=
${
ICASE
}
"*
${
(j
:
*
:
)argv
}
*"
m
=(
${
(M)dmatching
:#
${
~p
}}
)
[[
-d
${
m
[1]
}
]]
&&
dmatching
=(
$m
)
# if some directory names match last pattern, discard all others
p
=
${
ICASE
}
"*
${
(j
:
*
:
)argv
}
[^/]#"
m
=(
${
(M)dmatching
:#
${
~p
}}
)
[[
-d
${
m
[1]
}
]]
&&
dmatching
=(
$m
)
# if some directory names match all patterns, discard all others
m
=(
$dmatching
)
for
a
;
do
p
=
${
ICASE
}
"*/[^/]#
${
a
}
[^/]#"
m
=(
${
(M)m
:#
${
~p
}}
)
done
[[
-d
${
m
[1]
}
]]
&&
dmatching
=(
$m
)
# if some directory names match all patterns in order, discard all others
p
=
${
ICASE
}
"/*
${
(j
:[^/]#:
)argv
}
[^/]#"
m
=(
${
(M)dmatching
:#
${
~p
}}
)
[[
-d
${
m
[1]
}
]]
&&
dmatching
=(
$m
)
# do not match $HOME or $PWD when run without arguments
if
[[
$#
==
0
]]
;
then
dmatching
=(
${
dmatching
:#
(
${
HOME
}
|
${
PWD
}
)
}
)
...
...
@@ -302,6 +335,9 @@ _scd_Y19oug_match() {
# discard all directories below the rank threshold
threshold
=
$((
maxrank
*
SCD_THRESHOLD
))
if
[[
-n
${
opt_all
}
]]
;
then
threshold
=
0
fi
dmatching
=(
${
^dmatching
}
(
Ne:
'(( ${drank[$REPLY]} >= threshold ))'
:
)
)
}
...
...
@@ -339,6 +375,7 @@ fi
## here we have multiple matches - display selection menu
a
=(
{
a-z
}
{
A-Z
}
)
a
=(
${
a
[1,
${#
dmatching
}
]
}
)
p
=(
)
for
i
in
{
1..
${#
dmatching
}
}
;
do
[[
-n
${
a
[i]
}
]]
||
break
...
...
plugins/ssh-agent/ssh-agent.plugin.zsh
View file @
18ef1ee6
#
# INSTRUCTIONS
#
# To enable
d
agent forwarding support add the following to
# To enable agent forwarding support add the following to
# your .zshrc file:
#
# zstyle :omz:plugins:ssh-agent agent-forwarding on
...
...
plugins/sublime/README.md
0 → 100644
View file @
18ef1ee6
## sublime
Plugin for Sublime Text, a cross platform text and code editor, available for Linux, Mac OS X, and Windows.
### Requirements
*
[
Sublime Text
](
http://www.sublimetext.com/
)
### Usage
*
If
`st`
command is called without an argument, launch Sublime Text
*
If
`st`
is passed a directory,
`cd`
to it and open it in Sublime Text
*
If
`st`
is passed a file, open it in Sublime Text
*
If
`stt`
command is called, it is equivalent to
`st .`
, opening the current folder in Sublime Text
*
If
`sst`
command is called, it is like
`sudo st`
, opening the file or folder in Sublime Text. Useful for editing system protected files.
\ No newline at end of file
plugins/sublime/sublime.plugin.zsh
100755 → 100644
View file @
18ef1ee6
...
...
@@ -5,18 +5,24 @@ if [[ $('uname') == 'Linux' ]]; then
_sublime_linux_paths
=(
"
$HOME
/bin/sublime_text"
"/opt/sublime_text/sublime_text"
"/opt/sublime_text_3/sublime_text"
"/usr/bin/sublime_text"
"/usr/local/bin/sublime_text"
"/usr/bin/subl"
"/opt/sublime_text_3/sublime_text"
"/usr/bin/subl3"
)
for
_sublime_path
in
$_sublime_linux_paths
;
do
if
[[
-a
$_sublime_path
]]
;
then
st_run
()
{
$_sublime_path
$@
>
/dev/null 2>&1 &|
}
st_run_sudo
()
{
sudo
$_sublime_path
$@
>
/dev/null 2>&1
}
alias
sst
=
st_run_sudo
alias
st
=
st_run
break
fi
done
elif
[[
$(
'uname'
)
==
'D
arwin
'
]]
;
then
elif
[[
"
$OSTYPE
"
=
d
arwin
*
]]
;
then
local
_sublime_darwin_paths
>
/dev/null 2>&1
_sublime_darwin_paths
=(
"/usr/local/bin/subl"
...
...
@@ -30,7 +36,7 @@ elif [[ $('uname') == 'Darwin' ]]; then
for
_sublime_path
in
$_sublime_darwin_paths
;
do
if
[[
-a
$_sublime_path
]]
;
then
alias
subl
=
"'
$_sublime_path
'
"
subl
()
{
"
$_sublime_path
"
$*
}
alias
st
=
subl
break
fi
...
...
plugins/sudo/sudo.plugin.zsh
View file @
18ef1ee6
...
...
@@ -13,9 +13,8 @@
# ------------------------------------------------------------------------------
sudo-command-line
()
{
[[
-z
$BUFFER
]]
&&
zle up-history
[[
$BUFFER
!=
sudo
\
*
]]
&&
BUFFER
=
"sudo
$BUFFER
"
zle end-of-line
[[
-z
$BUFFER
]]
&&
zle up-history
[[
$BUFFER
!=
sudo
\
*
]]
&&
LBUFFER
=
"sudo
$LBUFFER
"
}
zle
-N
sudo-command-line
# Defined shortcut keys: [Esc] [Esc]
...
...
plugins/svn-fast-info/svn-fast-info.plugin.zsh
View file @
18ef1ee6
...
...
@@ -63,11 +63,11 @@ function svn_current_revision() {
function
svn_status_info
()
{
local
svn_status_string
=
"
$ZSH_THEME_SVN_PROMPT_CLEAN
"
local
svn_status
=
"
$(
svn status 2> /dev/null
)
"
;
if
grep
-E
'^\s*A'
&> /dev/null
<<<
$svn_status
;
then
svn_status_string
=
"
$svn_status_string
${
ZSH_THEME_SVN_PROMPT_ADDITIONS
:-
+
}
"
;
fi
if
grep
-E
'^\s*D'
&> /dev/null
<<<
$svn_status
;
then
svn_status_string
=
"
$svn_status_string
${
ZSH_THEME_SVN_PROMPT_DELETIONS
:-
✖
}
"
;
fi
if
grep
-E
'^\s*M'
&> /dev/null
<<<
$svn_status
;
then
svn_status_string
=
"
$svn_status_string
${
ZSH_THEME_SVN_PROMPT_MODIFICATIONS
:-
✎
}
"
;
fi
if
grep
-E
'^\s*[R~]'
&> /dev/null
<<<
$svn_status
;
then
svn_status_string
=
"
$svn_status_string
${
ZSH_THEME_SVN_PROMPT_REPLACEMENTS
:-
∿
}
"
;
fi
if
grep
-E
'^\s*\?'
&> /dev/null
<<<
$svn_status
;
then
svn_status_string
=
"
$svn_status_string
${
ZSH_THEME_SVN_PROMPT_UNTRACKED
:-
?
}
"
;
fi
if
grep
-E
'^\s*[CI!L]'
&> /dev/null
<<<
$svn_status
;
then
svn_status_string
=
"
$svn_status_string
${
ZSH_THEME_SVN_PROMPT_DIRTY
:-
'!'
}
"
;
fi
if
command
grep
-E
'^\s*A'
&> /dev/null
<<<
$svn_status
;
then
svn_status_string
=
"
$svn_status_string
${
ZSH_THEME_SVN_PROMPT_ADDITIONS
:-
+
}
"
;
fi
if
command
grep
-E
'^\s*D'
&> /dev/null
<<<
$svn_status
;
then
svn_status_string
=
"
$svn_status_string
${
ZSH_THEME_SVN_PROMPT_DELETIONS
:-
✖
}
"
;
fi
if
command
grep
-E
'^\s*M'
&> /dev/null
<<<
$svn_status
;
then
svn_status_string
=
"
$svn_status_string
${
ZSH_THEME_SVN_PROMPT_MODIFICATIONS
:-
✎
}
"
;
fi
if
command
grep
-E
'^\s*[R~]'
&> /dev/null
<<<
$svn_status
;
then
svn_status_string
=
"
$svn_status_string
${
ZSH_THEME_SVN_PROMPT_REPLACEMENTS
:-
∿
}
"
;
fi
if
command
grep
-E
'^\s*\?'
&> /dev/null
<<<
$svn_status
;
then
svn_status_string
=
"
$svn_status_string
${
ZSH_THEME_SVN_PROMPT_UNTRACKED
:-
?
}
"
;
fi
if
command
grep
-E
'^\s*[CI!L]'
&> /dev/null
<<<
$svn_status
;
then
svn_status_string
=
"
$svn_status_string
${
ZSH_THEME_SVN_PROMPT_DIRTY
:-
'!'
}
"
;
fi
echo
$svn_status_string
}
plugins/svn/svn.plugin.zsh
View file @
18ef1ee6
...
...
@@ -61,7 +61,7 @@ function svn_get_rev_nr() {
function
svn_dirty_choose
()
{
if
in_svn
;
then
root
=
`
svn info 2> /dev/null |
sed
-n
's/^Working Copy Root Path: //p'
`
if
$(
svn status
$root
2> /dev/null |
grep
-Eq
'^\s*[ACDIM!?L]'
)
;
then
if
$(
svn status
$root
2> /dev/null |
command
grep
-Eq
'^\s*[ACDIM!?L]'
)
;
then
# Grep exits with 0 when "One or more lines were selected", return "dirty".
echo
$1
else
...
...
@@ -77,8 +77,8 @@ function svn_dirty() {
function
svn_dirty_choose_pwd
()
{
if
in_svn
;
then
root
=
`
pwd
`
if
$(
svn status
$root
2> /dev/null |
grep
-Eq
'^\s*[ACDIM!?L]'
)
;
then
root
=
$PWD
if
$(
svn status
$root
2> /dev/null |
command
grep
-Eq
'^\s*[ACDIM!?L]'
)
;
then
# Grep exits with 0 when "One or more lines were selected", return "dirty".
echo
$1
else
...
...
plugins/symfony2/symfony2.plugin.zsh
View file @
18ef1ee6
# Symfony2 basic command completion
_symfony_console
()
{
echo
"php
$(
find
.
-maxdepth
2
-mindepth
1
-name
'console'
-type
f |
head
-n
1
)
"
}
_symfony2_get_command_list
()
{
php app/
console
--no-ansi
|
sed
"1,/Available commands/d"
|
awk
'/^ [a-z]+/ { print $1 }'
`
_symfony_
console
`
--no-ansi
|
sed
"1,/Available commands/d"
|
awk
'/^
?
[a-z]+/ { print $1 }'
}
_symfony2
()
{
if
[
-f
app/console
]
;
then
compadd
`
_symfony2_get_command_list
`
fi
compadd
`
_symfony2_get_command_list
`
}
compdef _symfony2 app/console
compdef _symfony2
'`_symfony_console`'
compdef _symfony2
'app/console'
compdef _symfony2
'bin/console'
compdef _symfony2 sf
#Alias
alias
sf
=
'php app/console'
alias
sfcl
=
'php app/console cache:clear'
alias
sfroute
=
'php app/console router:debug'
alias
sfgb
=
'php app/console generate:bundle'
alias
sf
=
'`_symfony_console`'
alias
sfcl
=
'sf cache:clear'
alias
sfsr
=
'sf server:run -vvv'
alias
sfcw
=
'sf cache:warmup'
alias
sfroute
=
'sf router:debug'
alias
sfcontainer
=
'sf container:debug'
alias
sfgb
=
'sf generate:bundle'
plugins/systemadmin/systemadmin.zsh
→
plugins/systemadmin/systemadmin.
plugin.
zsh
View file @
18ef1ee6
...
...
@@ -30,7 +30,7 @@ function retlog() {
}
alias
ping
=
'ping -c 5'
alias
clr
=
'clear;echo "Currently logged in on $(tty), as $
(whoami)
in directory $
(pwd)
."'
alias
clr
=
'clear;echo "Currently logged in on $(tty), as $
USER
in directory $
PWD
."'
alias
path
=
'echo -e ${PATH//:/\\n}'
alias mkdir
=
'mkdir -pv'
# get top process eating memory
...
...
plugins/systemd/systemd.plugin.zsh
View file @
18ef1ee6
user_commands
=(
list-units is-active status show
help
list-unit-files
is-enabled list-jobs show-environment
)
is-enabled list-jobs show-environment
cat
)
sudo_commands
=(
start stop reload restart try-restart isolate
kill
reset-failed
enable
disable reenable preset mask unmask
link
load cancel set-environment unset-environment
)
link
load cancel set-environment unset-environment
edit
)
for
c
in
$user_commands
;
do
;
alias
sc-
$c
=
"systemctl
$c
"
;
done
for
c
in
$sudo_commands
;
do
;
alias
sc-
$c
=
"sudo systemctl
$c
"
;
done
Prev
1
…
4
5
6
7
8
9
10
11
12
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