e4fdb083655fc582ebcecb07cd1bd1130077f0e4
- Author
- Andrew Janke <andrew@apjanke.net>
- Committer
- Andrew Janke <andrew@apjanke.net>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/README.markdown b/README.markdown
2index d4d3fdbaf273203bf635f392b8df83a5e128d16f..a29df81ab5d6aff44df86ce96e10448483474744 100644
3--- a/README.markdown
4+++ b/README.markdown
5@@ -65,7 +65,7 @@ Once you find a theme that you want to use, you will need to edit the `~/.zshrc`
6 ZSH_THEME="robbyrussell"
7 ```
8
9-To use a different theme, simple change the value to match the name of your desired theme. For example:
10+To use a different theme, simply change the value to match the name of your desired theme. For example:
11
12 ```shell
13 ZSH_THEME="agnoster" # (this is one of the fancy ones)
14@@ -77,6 +77,14 @@ Open up a new terminal window and your prompt should look something like...
15
16 In case you did not find a suitable theme for your needs, please have a look at the wiki for [more of them](https://github.com/robbyrussell/oh-my-zsh/wiki/External-themes).
17
18+If you're feeling feisty, you can let the computer select one randomly for you each time you open a new terminal window.
19+
20+
21+```shell
22+ZSH_THEME="random" # (...please let it be pie... please be some pie..)
23+```
24+
25+
26 ## Advanced Topics
27
28 If you're the type that likes to get their hands dirty, these sections might resonate.
29diff --git a/lib/compfix.zsh b/lib/compfix.zsh
30new file mode 100644
31index 0000000000000000000000000000000000000000..208aaadb1ebad0e25ebdef29192da815be8136bd
32--- /dev/null
33+++ b/lib/compfix.zsh
34@@ -0,0 +1,60 @@
35+# Handle completions insecurities (i.e., completion-dependent directories with
36+# insecure ownership or permissions) by:
37+#
38+# * Human-readably notifying the user of these insecurities.
39+# * Moving away all existing completion caches to a temporary directory. Since
40+# any of these caches may have been generated from insecure directories, they
41+# are all suspect now. Failing to do so typically causes subsequent compinit()
42+# calls to fail with "command not found: compdef" errors. (That's bad.)
43+function handle_completion_insecurities() {
44+ # List of the absolute paths of all unique insecure directories, split on
45+ # newline from compaudit()'s output resembling:
46+ #
47+ # There are insecure directories:
48+ # /usr/share/zsh/site-functions
49+ # /usr/share/zsh/5.0.6/functions
50+ # /usr/share/zsh
51+ # /usr/share/zsh/5.0.6
52+ #
53+ # Since the ignorable first line is printed to stderr and thus not captured,
54+ # stderr is squelched to prevent this output from leaking to the user.
55+ local -aU insecure_dirs
56+ insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
57+
58+ # If no such directories exist, get us out of here.
59+ if (( ! ${#insecure_dirs} )); then
60+ print "[oh-my-zsh] No insecure completion-dependent directories detected."
61+ return
62+ fi
63+
64+ # List ownership and permissions of all insecure directories.
65+ print "[oh-my-zsh] Insecure completion-dependent directories detected:"
66+ ls -ld "${(@)insecure_dirs}"
67+ print "[oh-my-zsh] For safety, completions will be disabled until you manually fix all"
68+ print "[oh-my-zsh] insecure directory permissions and ownership and restart oh-my-zsh."
69+ print "[oh-my-zsh] See the above list for directories with group or other writability.\n"
70+
71+ # Locally enable the "NULL_GLOB" option, thus removing unmatched filename
72+ # globs from argument lists *AND* printing no warning when doing so. Failing
73+ # to do so prints an unreadable warning if no completion caches exist below.
74+ setopt local_options null_glob
75+
76+ # List of the absolute paths of all unique existing completion caches.
77+ local -aU zcompdump_files
78+ zcompdump_files=( "${ZSH_COMPDUMP}"(.) "${ZDOTDIR:-${HOME}}"/.zcompdump* )
79+
80+ # Move such caches to a temporary directory.
81+ if (( ${#zcompdump_files} )); then
82+ # Absolute path of the directory to which such files will be moved.
83+ local ZSH_ZCOMPDUMP_BAD_DIR="${ZSH_CACHE_DIR}/zcompdump-bad"
84+
85+ # List such files first.
86+ print "[oh-my-zsh] Insecure completion caches also detected:"
87+ ls -l "${(@)zcompdump_files}"
88+
89+ # For safety, move rather than permanently remove such files.
90+ print "[oh-my-zsh] Moving to \"${ZSH_ZCOMPDUMP_BAD_DIR}/\"...\n"
91+ mkdir -p "${ZSH_ZCOMPDUMP_BAD_DIR}"
92+ mv "${(@)zcompdump_files}" "${ZSH_ZCOMPDUMP_BAD_DIR}/"
93+ fi
94+}
95diff --git a/lib/completion.zsh b/lib/completion.zsh
96index 452c0dfe765539dd6cf0a83f85037c7ac5f571a9..f5b29247127543f4aec6ffec6bdb4b29bcdd9de1 100644
97--- a/lib/completion.zsh
98+++ b/lib/completion.zsh
99@@ -58,9 +58,13 @@ zstyle ':completion:*:*:*:users' ignored-patterns \
100 # ... unless we really want to.
101 zstyle '*' single-ignored show
102
103-if [ "x$COMPLETION_WAITING_DOTS" = "xtrue" ]; then
104+if [[ $COMPLETION_WAITING_DOTS = true ]]; then
105 expand-or-complete-with-dots() {
106- echo -n "\e[31m......\e[0m"
107+ # toggle line-wrapping off and back on again
108+ [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
109+ print -Pn "%{%F{red}......%f%}"
110+ [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam
111+
112 zle expand-or-complete
113 zle redisplay
114 }
115diff --git a/lib/diagnostics.zsh b/lib/diagnostics.zsh
116new file mode 100644
117index 0000000000000000000000000000000000000000..afc33829b01c0a09dc0633a21fbfee906c5d3116
118--- /dev/null
119+++ b/lib/diagnostics.zsh
120@@ -0,0 +1,335 @@
121+# diagnostics.zsh
122+#
123+# Diagnostic and debugging support for oh-my-zsh
124+
125+# omz_diagnostic_dump()
126+#
127+# Author: Andrew Janke <andrew@apjanke.net>
128+#
129+# Usage:
130+#
131+# omz_diagnostic_dump [-v] [-V] [file]
132+#
133+# NOTE: This is a work in progress. Its interface and behavior are going to change,
134+# and probably in non-back-compatible ways.
135+#
136+# Outputs a bunch of information about the state and configuration of
137+# oh-my-zsh, zsh, and the user's system. This is intended to provide a
138+# bunch of context for diagnosing your own or a third party's problems, and to
139+# be suitable for posting to public bug reports.
140+#
141+# The output is human-readable and its format may change over time. It is not
142+# suitable for parsing. All the output is in one single file so it can be posted
143+# as a gist or bug comment on GitHub. GitHub doesn't support attaching tarballs
144+# or other files to bugs; otherwise, this would probably have an option to produce
145+# tarballs that contain copies of the config and customization files instead of
146+# catting them all in to one file.
147+#
148+# This is intended to be widely portable, and run anywhere that oh-my-zsh does.
149+# Feel free to report any portability issues as bugs.
150+#
151+# This is written in a defensive style so it still works (and can detect) cases when
152+# basic functionality like echo and which have been redefined. In particular, almost
153+# everything is invoked with "builtin" or "command", to work in the face of user
154+# redefinitions.
155+#
156+# OPTIONS
157+#
158+# [file] Specifies the output file. If not given, a file in the current directory
159+# is selected automatically.
160+#
161+# -v Increase the verbosity of the dump output. May be specified multiple times.
162+# Verbosity levels:
163+# 0 - Basic info, shell state, omz configuration, git state
164+# 1 - (default) Adds key binding info and configuration file contents
165+# 2 - Adds zcompdump file contents
166+#
167+# -V Reduce the verbosity of the dump output. May be specified multiple times.
168+#
169+# TODO:
170+# * Multi-file capture
171+# * Add automatic gist uploading
172+# * Consider whether to move default output file location to TMPDIR. More robust
173+# but less user friendly.
174+#
175+function omz_diagnostic_dump() {
176+ emulate -L zsh
177+
178+ builtin echo "Generating diagnostic dump; please be patient..."
179+
180+ local thisfcn=omz_diagnostic_dump
181+ local -A opts
182+ local opt_verbose opt_noverbose opt_outfile
183+ local timestamp=$(date +%Y%m%d-%H%M%S)
184+ local outfile=omz_diagdump_$timestamp.txt
185+ builtin zparseopts -A opts -D -- "v+=opt_verbose" "V+=opt_noverbose"
186+ local verbose n_verbose=${#opt_verbose} n_noverbose=${#opt_noverbose}
187+ (( verbose = 1 + n_verbose - n_noverbose ))
188+
189+ if [[ ${#*} > 0 ]]; then
190+ opt_outfile=$1
191+ fi
192+ if [[ ${#*} > 1 ]]; then
193+ builtin echo "$thisfcn: error: too many arguments" >&2
194+ return 1
195+ fi
196+ if [[ -n "$opt_outfile" ]]; then
197+ outfile="$opt_outfile"
198+ fi
199+
200+ # Always write directly to a file so terminal escape sequences are
201+ # captured cleanly
202+ _omz_diag_dump_one_big_text &> "$outfile"
203+ if [[ $? != 0 ]]; then
204+ builtin echo "$thisfcn: error while creating diagnostic dump; see $outfile for details"
205+ fi
206+
207+ builtin echo
208+ builtin echo Diagnostic dump file created at: "$outfile"
209+ builtin echo
210+ builtin echo To share this with OMZ developers, post it as a gist on GitHub
211+ builtin echo at "https://gist.github.com" and share the link to the gist.
212+ builtin echo
213+ builtin echo "WARNING: This dump file contains all your zsh and omz configuration files,"
214+ builtin echo "so don't share it publicly if there's sensitive information in them."
215+ builtin echo
216+
217+}
218+
219+function _omz_diag_dump_one_big_text() {
220diff --git a/lib/functions.zsh b/lib/functions.zsh
221index 0d632a2686693f5d624ebd17694d9c4e18bc3d3e..efb73a1bd91170f1c2622635875ceb900942ee43 100644
222--- a/lib/functions.zsh
223+++ b/lib/functions.zsh
224@@ -89,3 +89,135 @@ function env_default() {
225 env | grep -q "^$1=" && return 0
226 export "$1=$2" && return 3
227 }
228+
229+
230+# Required for $langinfo
231+zmodload zsh/langinfo
232+
233+# URL-encode a string
234+#
235+# Encodes a string using RFC 2396 URL-encoding (%-escaped).
236+# See: https://www.ietf.org/rfc/rfc2396.txt
237+#
238+# By default, reserved characters and unreserved "mark" characters are
239+# not escaped by this function. This allows the common usage of passing
240+# an entire URL in, and encoding just special characters in it, with
241+# the expectation that reserved and mark characters are used appropriately.
242+# The -r and -m options turn on escaping of the reserved and mark characters,
243+# respectively, which allows arbitrary strings to be fully escaped for
244+# embedding inside URLs, where reserved characters might be misinterpreted.
245+#
246+# Prints the encoded string on stdout.
247+# Returns nonzero if encoding failed.
248+#
249+# Usage:
250+# omz_urlencode [-r] [-m] <string>
251+#
252+# -r causes reserved characters (;/?:@&=+$,) to be escaped
253+#
254+# -m causes "mark" characters (_.!~*''()-) to be escaped
255+#
256+# -P causes spaces to be encoded as '%20' instead of '+'
257+function omz_urlencode() {
258+ emulate -L zsh
259+ zparseopts -D -E -a opts r m P
260+
261+ local in_str=$1
262+ local url_str=""
263+ local spaces_as_plus
264+ if [[ -z $opts[(r)-P] ]]; then spaces_as_plus=1; fi
265+ local str="$in_str"
266+
267+ # URLs must use UTF-8 encoding; convert str to UTF-8 if required
268+ local encoding=$langinfo[CODESET]
269+ local safe_encodings
270+ safe_encodings=(UTF-8 utf8 US-ASCII)
271+ if [[ -z ${safe_encodings[(r)$encoding]} ]]; then
272+ str=$(echo -E "$str" | iconv -f $encoding -t UTF-8)
273+ if [[ $? != 0 ]]; then
274+ echo "Error converting string from $encoding to UTF-8" >&2
275+ return 1
276+ fi
277+ fi
278+
279+ # Use LC_CTYPE=C to process text byte-by-byte
280+ local i byte ord LC_ALL=C
281+ export LC_ALL
282+ local reserved=';/?:@&=+$,'
283+ local mark='_.!~*''()-'
284+ local dont_escape="[A-Za-z0-9"
285+ if [[ -z $opts[(r)-r] ]]; then
286+ dont_escape+=$reserved
287+ fi
288+ # $mark must be last because of the "-"
289+ if [[ -z $opts[(r)-m] ]]; then
290+ dont_escape+=$mark
291+ fi
292+ dont_escape+="]"
293+
294+ # Implemented to use a single printf call and avoid subshells in the loop,
295+ # for performance (primarily on Windows).
296+ local url_str=""
297+ for (( i = 1; i <= ${#str}; ++i )); do
298+ byte="$str[i]"
299+ if [[ "$byte" =~ "$dont_escape" ]]; then
300+ url_str+="$byte"
301+ else
302+ if [[ "$byte" == " " && -n $spaces_as_plus ]]; then
303+ url_str+="+"
304+ else
305+ ord=$(( [##16] #byte ))
306+ url_str+="%$ord"
307+ fi
308+ fi
309+ done
310+ echo -E "$url_str"
311+}
312+
313+# URL-decode a string
314+#
315+# Decodes a RFC 2396 URL-encoded (%-escaped) string.
316+# This decodes the '+' and '%' escapes in the input string, and leaves
317+# other characters unchanged. Does not enforce that the input is a
318+# valid URL-encoded string. This is a convenience to allow callers to
319+# pass in a full URL or similar strings and decode them for human
320+# presentation.
321+#
322+# Outputs the encoded string on stdout.
323+# Returns nonzero if encoding failed.
324diff --git a/lib/git.zsh b/lib/git.zsh
325index caa7e632913251f9694b3a3b7cb357e2879e02cf..1e203c7c61e758ecbb89be2fd3684421791018aa 100644
326--- a/lib/git.zsh
327+++ b/lib/git.zsh
328@@ -36,7 +36,10 @@ git_remote_status() {
329 ahead=$(command git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | wc -l)
330 behind=$(command git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | wc -l)
331
332- if [ $ahead -gt 0 ] && [ $behind -eq 0 ]
333+ if [ $ahead -eq 0 ] && [ $behind -eq 0 ]
334+ then
335+ git_remote_status="$ZSH_THEME_GIT_PROMPT_EQUAL_REMOTE"
336+ elif [ $ahead -gt 0 ] && [ $behind -eq 0 ]
337 then
338 git_remote_status="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE"
339 git_remote_status_detailed="$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE_COLOR$ZSH_THEME_GIT_PROMPT_AHEAD_REMOTE$((ahead))%{$reset_color%}"
340diff --git a/lib/grep.zsh b/lib/grep.zsh
341index 3fa103d19a5827f021742f442aaf3c1148d980a5..abc1650a1cca6f117bb1d212a8501d53a06f83a7 100644
342--- a/lib/grep.zsh
343+++ b/lib/grep.zsh
344@@ -11,7 +11,7 @@ if grep-flag-available --color=auto; then
345 fi
346
347 # ignore VCS folders (if the necessary grep flags are available)
348-VCS_FOLDERS="{.bzr,.cvs,.git,.hg,.svn}"
349+VCS_FOLDERS="{.bzr,CVS,.git,.hg,.svn}"
350
351 if grep-flag-available --exclude-dir=.cvs; then
352 GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS"
353diff --git a/lib/misc.zsh b/lib/misc.zsh
354index 6d1a64e8dbc540fcbe3a84df20082d2416a4e1de..bdb884046af81a7d108593aeec55985733a82c8d 100644
355--- a/lib/misc.zsh
356+++ b/lib/misc.zsh
357@@ -1,6 +1,10 @@
358 ## Load smart urls if available
359 for d in $fpath; do
360 if [[ -e "$d/url-quote-magic" ]]; then
361+ if [[ -e "$d/bracketed-paste-magic" ]]; then
362+ autoload -Uz bracketed-paste-magic
363+ zle -N bracketed-paste bracketed-paste-magic
364+ fi
365 autoload -U url-quote-magic
366 zle -N self-insert url-quote-magic
367 fi
368diff --git a/lib/termsupport.zsh b/lib/termsupport.zsh
369index babbaa95789afb3233e8b4eb74216ceed44ce716..5f61fe8ef2d4e3cd34fe441dde04779f709f9fa7 100644
370--- a/lib/termsupport.zsh
371+++ b/lib/termsupport.zsh
372@@ -33,6 +33,7 @@ fi
373
374 # Runs before showing the prompt
375 function omz_termsupport_precmd {
376+ emulate -L zsh
377 if [[ $DISABLE_AUTO_TITLE == true ]]; then
378 return
379 fi
380@@ -42,11 +43,11 @@ function omz_termsupport_precmd {
381
382 # Runs before executing the command
383 function omz_termsupport_preexec {
384+ emulate -L zsh
385 if [[ $DISABLE_AUTO_TITLE == true ]]; then
386 return
387 fi
388
389- emulate -L zsh
390 setopt extended_glob
391
392 # cmd name only, or if this is sudo or ssh, the next cmd
393@@ -60,14 +61,28 @@ precmd_functions+=(omz_termsupport_precmd)
394 preexec_functions+=(omz_termsupport_preexec)
395
396
397-# Runs before showing the prompt, to update the current directory in Terminal.app
398-function omz_termsupport_cwd {
399- # Notify Terminal.app of current directory using undocumented OSC sequence
400- # found in OS X 10.9 and 10.10's /etc/bashrc
401- if [[ $TERM_PROGRAM == Apple_Terminal ]] && [[ -z $INSIDE_EMACS ]]; then
402- local PWD_URL="file://$HOSTNAME${PWD// /%20}"
403- printf '\e]7;%s\a' "$PWD_URL"
404- fi
405-}
406+# Keep Apple Terminal.app's current working directory updated
407+# Based on this answer: http://superuser.com/a/315029
408+# With extra fixes to handle multibyte chars and non-UTF-8 locales
409
410-precmd_functions+=(omz_termsupport_cwd)
411+if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
412+
413+ # Emits the control sequence to notify Terminal.app of the cwd
414+ function update_terminalapp_cwd() {
415+ emulate -L zsh
416+ # Identify the directory using a "file:" scheme URL, including
417+ # the host name to disambiguate local vs. remote paths.
418+
419+ # Percent-encode the pathname.
420+ local URL_PATH=$(omz_urlencode -P $PWD)
421+ [[ $? != 0 ]] && return 1
422+ local PWD_URL="file://$HOST$URL_PATH"
423+ # Undocumented Terminal.app-specific control sequence
424+ printf '\e]7;%s\a' $PWD_URL
425+ }
426+
427+ # Use a precmd hook instead of a chpwd hook to avoid contaminating output
428+ precmd_functions+=(update_terminalapp_cwd)
429+ # Run once to get initial cwd set
430+ update_terminalapp_cwd
431+fi
432diff --git a/lib/theme-and-appearance.zsh b/lib/theme-and-appearance.zsh
433index 926303ca4509cd89bbc30187fd99879c1fbeb771..ebb11fb3185cef97ef29c8b6f11174c7669986ac 100644
434--- a/lib/theme-and-appearance.zsh
435+++ b/lib/theme-and-appearance.zsh
436@@ -11,8 +11,11 @@ then
437 # otherwise, leave ls as is, because NetBSD's ls doesn't support -G
438 gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
439 elif [[ "$(uname -s)" == "OpenBSD" ]]; then
440- # On OpenBSD, test if "colorls" is installed (this one supports colors);
441- # otherwise, leave ls as is, because OpenBSD's ls doesn't support -G
442+ # On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base,
443+ # with color and multibyte support) are available from ports. "colorls"
444+ # will be installed on purpose and can't be pulled in by installing
445+ # coreutils, so prefer it to "gls".
446+ gls --color -d . &>/dev/null 2>&1 && alias ls='gls --color=tty'
447 colorls -G -d . &>/dev/null 2>&1 && alias ls='colorls -G'
448 else
449 ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
450diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
451index 4e5f77990dd567ca1495ed2af948473609ed1bfe..8e31ddd0ff62c43d187cd6f6fd2bf97a72a0bc11 100644
452--- a/oh-my-zsh.sh
453+++ b/oh-my-zsh.sh
454@@ -8,6 +8,9 @@ fi
455 # add a function path
456 fpath=($ZSH/functions $ZSH/completions $fpath)
457
458+# Load all stock functions (from $fpath files) called below.
459+autoload -U compaudit compinit
460+
461 # Set ZSH_CUSTOM to the path where your custom config files
462 # and plugins exists, or else we will use the default custom/
463 if [[ -z "$ZSH_CUSTOM" ]]; then
464@@ -59,9 +62,14 @@ if [ -z "$ZSH_COMPDUMP" ]; then
465 ZSH_COMPDUMP="${ZDOTDIR:-${HOME}}/.zcompdump-${SHORT_HOST}-${ZSH_VERSION}"
466 fi
467
468-# Load and run compinit
469-autoload -U compinit
470-compinit -i -d "${ZSH_COMPDUMP}"
471+# If completion insecurities exist, warn the user without enabling completions.
472+if ! compaudit &>/dev/null; then
473+ # This function resides in the "lib/compfix.zsh" script sourced above.
474+ handle_completion_insecurities
475+# Else, enable and cache completions to the desired file.
476+else
477+ compinit -d "${ZSH_COMPDUMP}"
478+fi
479
480 # Load all of the plugins that were defined in ~/.zshrc
481 for plugin ($plugins); do
482diff --git a/plugins/atom/README.md b/plugins/atom/README.md
483index 75d77a0ac1c3732be4dbab1b4062e4f8e1d315fc..6350c647b029ef0ca2416c6dcfe976a63e1d1534 100644
484--- a/plugins/atom/README.md
485+++ b/plugins/atom/README.md
486@@ -1,6 +1,8 @@
487 ## atom
488
489-Plugin for Atom, a cross platform text and code editor, available for Linux, Mac OS X, and Windows.
490+This plugin makes "at" a useful function for invoking the Atom Editor.
491+
492+Originally by Github user [aforty](https://github.com/aforty) for OSX, modified to alias 'at' to 'atom' for Linux, since atom already works on the terminal for Linux, and calling 'at' in a non-OSX environment should still work.
493
494 ### Requirements
495
496@@ -10,8 +12,12 @@ Plugin for Atom, a cross platform text and code editor, available for Linux, Mac
497
498 * If `at` command is called without an argument, launch Atom
499
500- * If `at` is passed a directory, `cd` to it and open it in Atom
501+ * If `at` is passed a directory, open it in Atom
502
503 * If `at` is passed a file, open it in Atom
504
505- * if `att` command is called, it is equivalent to `at .`, opening the current folder in Atom
506+### Examples
507+
508+ * Open the current dir in atom: `at .`
509+ * Open another dir in atom: `at path/to/folder`
510+ * Open a file: `at filename.extension`
511diff --git a/plugins/atom/atom.plugin.zsh b/plugins/atom/atom.plugin.zsh
512index 9adb9031a0e9c61c113a0e210531f5f3fdc5f4e2..2711cf0e8967276380d0441e43cbf112af9cea56 100644
513--- a/plugins/atom/atom.plugin.zsh
514+++ b/plugins/atom/atom.plugin.zsh
515@@ -1,14 +1,37 @@
516-local _atom_paths > /dev/null 2>&1
517-_atom_paths=(
518- "$HOME/Applications/Atom.app"
519- "/Applications/Atom.app"
520-)
521+case $OSTYPE in
522+darwin*)
523+ local _atom_paths > /dev/null 2>&1
524+ _atom_paths=(
525+ "$HOME/Applications/Atom.app"
526+ "/Applications/Atom.app"
527+ )
528+
529+ for _atom_path in $_atom_paths; do
530+ if [[ -a $_atom_path ]]; then
531+ alias at="open -a '$_atom_path'"
532+ break
533+ fi
534+ done
535+ ;;
536+cygwin)
537+ local _atom_path > /dev/null 2>&1
538+
539+ _atom_path=${LOCALAPPDATA}/atom/bin/atom
540
541-for _atom_path in $_atom_paths; do
542 if [[ -a $_atom_path ]]; then
543- alias at="open -a '$_atom_path'"
544- break
545- fi
546-done
547+ cyg_open_atom()
548+ {
549+ if [[ -n $1 ]]; then
550+ ${_atom_path} `cygpath -w -a $1`
551+ else
552+ ${_atom_path}
553+ fi
554+ }
555
556-alias att='at .'
557+ alias at=cyg_open_atom
558+ fi
559+ ;;
560+linux*)
561+ # Alerts the user if 'atom' is not a found command.
562+ type atom >/dev/null 2>&1 && alias at="atom" || { echo >&2 "You have enabled the atom oh-my-zsh plugin on Linux, but atom is not a recognized command. Please make sure you have it installed before using this plugin."; }
563+esac
564diff --git a/plugins/autojump/autojump.plugin.zsh b/plugins/autojump/autojump.plugin.zsh
565index 4cf0364013b2655dac01bf250d063ff2d7b2d1b5..c05c699e106b56ec04278d4cd84d7a4176fd9c35 100644
566--- a/plugins/autojump/autojump.plugin.zsh
567+++ b/plugins/autojump/autojump.plugin.zsh
568@@ -15,7 +15,7 @@ if [ $commands[autojump] ]; then # check if autojump is installed
569 . /usr/local/share/autojump/autojump.zsh
570 elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports
571 . /opt/local/etc/profile.d/autojump.zsh
572- elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.zsh ]; then # mac os x with brew
573- . `brew --prefix`/etc/autojump.zsh
574+ elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.sh ]; then # mac os x with brew
575+ . `brew --prefix`/etc/autojump.sh
576 fi
577 fi
578diff --git a/plugins/aws/aws.plugin.zsh b/plugins/aws/aws.plugin.zsh
579index 7246db9f0e10252a2c9bee1cff624e0b76ebc6c9..d31052f8300082f0d7ed5a47e59a2cf1454288d0 100644
580--- a/plugins/aws/aws.plugin.zsh
581+++ b/plugins/aws/aws.plugin.zsh
582@@ -11,11 +11,16 @@ export AWS_HOME=~/.aws
583 function agp {
584 echo $AWS_DEFAULT_PROFILE
585 }
586+
587 function asp {
588+ local rprompt=${RPROMPT/<aws:$(agp)>/}
589+
590 export AWS_DEFAULT_PROFILE=$1
591 export AWS_PROFILE=$1
592- export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>$RPROMPT"
593+
594+ export RPROMPT="<aws:$AWS_DEFAULT_PROFILE>$rprompt"
595 }
596+
597 function aws_profiles {
598 reply=($(grep profile $AWS_HOME/config|sed -e 's/.*profile \([a-zA-Z0-9_-]*\).*/\1/'))
599 }
600diff --git a/plugins/bgnotify/bgnotify.plugin.zsh b/plugins/bgnotify/bgnotify.plugin.zsh
601index b70b42f984540b2d58e9a6720e57234ec5ae21d6..459f5214e62c07d62d65dbd98901ea2c4dc82bcc 100755
602--- a/plugins/bgnotify/bgnotify.plugin.zsh
603+++ b/plugins/bgnotify/bgnotify.plugin.zsh
604@@ -11,31 +11,38 @@ autoload -Uz add-zsh-hook || { print "can't add zsh hook!"; return }
605
606 ## definitions ##
607
608-if ! (type bgnotify_formatted | grep -q 'function'); then
609- function bgnotify_formatted {
610- ## exit_status, command, elapsed_time
611- [ $1 -eq 0 ] && title="#win (took $3 s)" || title="#fail (took $3 s)"
612- bgnotify "$title" "$2"
613+if ! (type bgnotify_formatted | grep -q 'function'); then ## allow custom function override
614+ function bgnotify_formatted { ## args: (exit_status, command, elapsed_seconds)
615+ elapsed="$(( $3 % 60 ))s"
616+ (( $3 >= 60 )) && elapsed="$((( $3 % 3600) / 60 ))m $elapsed"
617+ (( $3 >= 3600 )) && elapsed="$(( $3 / 3600 ))h $elapsed"
618+ [ $1 -eq 0 ] && bgnotify "#win (took $elapsed)" "$2" || bgnotify "#fail (took $elapsed)" "$2"
619 }
620 fi
621
622 currentWindowId () {
623 if hash osascript 2>/dev/null; then #osx
624 osascript -e 'tell application (path to frontmost application as text) to id of front window' 2&> /dev/null || echo "0"
625- elif hash notify-send 2>/dev/null; then #ubuntu!
626- xprop -root | awk '/NET_ACTIVE_WINDOW/ { print $5; exit }'
627+ elif (hash notify-send 2>/dev/null || hash kdialog 2>/dev/null); then #ubuntu!
628+ xprop -root 2> /dev/null | awk '/NET_ACTIVE_WINDOW/{print $5;exit} END{exit !$5}' || echo "0"
629 else
630 echo $EPOCHSECONDS #fallback for windows
631 fi
632 }
633
634-bgnotify () {
635+bgnotify () { ## args: (title, subtitle)
636 if hash terminal-notifier 2>/dev/null; then #osx
637- terminal-notifier -message "$2" -title "$1"
638+ [[ "$TERM_PROGRAM" == 'iTerm.app' ]] && term_id='com.googlecode.iterm2';
639+ [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]] && term_id='com.apple.terminal';
640+ ## now call terminal-notifier, (hopefully with $term_id!)
641+ [ -z "$term_id" ] && terminal-notifier -message "$2" -title "$1" >/dev/null ||
642+ terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" >/dev/null
643 elif hash growlnotify 2>/dev/null; then #osx growl
644 growlnotify -m "$1" "$2"
645- elif hash notify-send 2>/dev/null; then #ubuntu!
646+ elif hash notify-send 2>/dev/null; then #ubuntu gnome!
647 notify-send "$1" "$2"
648+ elif hash kdialog 2>/dev/null; then #ubuntu kde!
649+ kdialog -title "$1" --passivepopup "$2" 5
650 elif hash notifu 2>/dev/null; then #cygwyn support!
651 notifu /m "$2" /p "$1"
652 fi
653@@ -46,7 +53,7 @@ bgnotify () {
654
655 bgnotify_begin() {
656 bgnotify_timestamp=$EPOCHSECONDS
657- bgnotify_lastcmd=$1
658+ bgnotify_lastcmd="$1"
659 bgnotify_windowid=$(currentWindowId)
660 }
661
662@@ -63,5 +70,8 @@ bgnotify_end() {
663 bgnotify_timestamp=0 #reset it to 0!
664 }
665
666-add-zsh-hook preexec bgnotify_begin
667-add-zsh-hook precmd bgnotify_end
668+## only enable if a local (non-ssh) connection
669+if [ -z "$SSH_CLIENT" ] && [ -z "$SSH_TTY" ]; then
670+ add-zsh-hook preexec bgnotify_begin
671+ add-zsh-hook precmd bgnotify_end
672+fi
673diff --git a/plugins/capistrano/_capistrano b/plugins/capistrano/_capistrano
674index 3cadf3d54be8aabaacaf509d5ca75ab14eb97910..c19c20b7a814a14f01563111ecb9f1af857ffb70 100644
675--- a/plugins/capistrano/_capistrano
676+++ b/plugins/capistrano/_capistrano
677@@ -1,10 +1,49 @@
678-#compdef cap
679+#compdef shipit
680 #autoload
681
682-if [[ -f config/deploy.rb || -f Capfile ]]; then
683- if [[ ! -f .cap_tasks~ || config/deploy.rb -nt .cap_tasks~ ]]; then
684- echo "\nGenerating .cap_tasks~..." > /dev/stderr
685- cap -v --tasks | grep '#' | cut -d " " -f 2 > .cap_tasks~
686+# Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work.
687+# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module
688+
689+local curcontext="$curcontext" state line ret=1
690+local -a _configs
691+
692+_arguments -C \
693+ '1: :->cmds' \
694+ '2:: :->args' && ret=0
695+
696+_cap_tasks() {
697+ if [[ -f config/deploy.rb || -f Capfile ]]; then
698+ if [[ ! -f .cap_tasks~ ]]; then
699+ shipit --tasks | sed 's/\(\[\)\(.*\)\(\]\)/\2:/' | awk '{command=$2; $1=$2=$3=""; gsub(/^[ \t\r\n]+/, "", $0); gsub(":", "\\:", command); print command"["$0"]"}' > .cap_tasks~
700+ fi
701+
702+ OLD_IFS=$IFS
703+ IFS=$'\n'
704+ _values 'cap commands' $(< .cap_tasks~)
705+ IFS=$OLD_IFS
706+ # zmodload zsh/mapfile
707+ # _values ${(f)mapfile[.cap_tasks~]}
708 fi
709- compadd `cat .cap_tasks~`
710-fi
711+}
712+
713+_cap_stages() {
714+ compadd $(find config/deploy -name \*.rb | cut -d/ -f3 | sed s:.rb::g)
715+}
716+
717+case $state in
718+ cmds)
719+ # check if it uses multistage
720+ if [[ -d config/deploy ]]; then
721+ _cap_stages
722+ else
723+ _cap_tasks
724+ fi
725+ ret=0
726+ ;;
727+ args)
728+ _cap_tasks
729+ ret=0
730+ ;;
731+esac
732+
733+return ret
734diff --git a/plugins/capistrano/capistrano.plugin.zsh b/plugins/capistrano/capistrano.plugin.zsh
735new file mode 100644
736index 0000000000000000000000000000000000000000..c85eb474ca8a9cd85f8f3cc4446e54ce5a5a0c85
737--- /dev/null
738+++ b/plugins/capistrano/capistrano.plugin.zsh
739@@ -0,0 +1,11 @@
740+# Added `shipit` because `cap` is a reserved word. `cap` completion doesn't work.
741+# http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcap-Module
742+
743+func shipit() {
744+ if [ -f Gemfile ]
745+ then
746+ bundle exec cap $*
747+ else
748+ cap $*
749+ fi
750+}
751diff --git a/plugins/chruby/chruby.plugin.zsh b/plugins/chruby/chruby.plugin.zsh
752index b461b0c9be7d5b39a27ebc7d646e93434e57e15a..164b4319f34c402dfd5054e2e06060ed29fcad0f 100644
753--- a/plugins/chruby/chruby.plugin.zsh
754+++ b/plugins/chruby/chruby.plugin.zsh
755@@ -24,7 +24,7 @@ _homebrew-installed() {
756 }
757
758 _chruby-from-homebrew-installed() {
759- [ -r $(brew --prefix chruby)] &> /dev/null
760+ [ -r $(brew --prefix chruby) ] &> /dev/null
761 }
762
763 _ruby-build_installed() {
764@@ -45,11 +45,11 @@ _source_from_omz_settings() {
765 zstyle -s :omz:plugins:chruby path _chruby_path
766 zstyle -s :omz:plugins:chruby auto _chruby_auto
767
768- if ${_chruby_path} && [[ -r ${_chruby_path} ]]; then
769+ if [[ -r ${_chruby_path} ]]; then
770 source ${_chruby_path}
771 fi
772
773- if ${_chruby_auto} && [[ -r ${_chruby_auto} ]]; then
774+ if [[ -r ${_chruby_auto} ]]; then
775 source ${_chruby_auto}
776 fi
777 }
778diff --git a/plugins/chucknorris/chucknorris.plugin.zsh b/plugins/chucknorris/chucknorris.plugin.zsh
779index 09636463350cf2b7a7e5b351d3a56c7992e9a574..1dbb04ef0d08928841a906d4f112ffc6eeb9b38c 100644
780--- a/plugins/chucknorris/chucknorris.plugin.zsh
781+++ b/plugins/chucknorris/chucknorris.plugin.zsh
782@@ -1,6 +1,28 @@
783-if [ ! -f $ZSH/plugins/chucknorris/fortunes/chucknorris.dat ]; then
784- strfile $ZSH/plugins/chucknorris/fortunes/chucknorris $ZSH/plugins/chucknorris/fortunes/chucknorris.dat
785+# chucknorris: Chuck Norris fortunes
786+
787+# Automatically generate or update Chuck's compiled fortune data file
788+# $0 must be used outside a local function. This variable name is unlikly to collide.
789+CHUCKNORRIS_PLUGIN_DIR=${0:h}
790+
791+() {
792+local DIR=$CHUCKNORRIS_PLUGIN_DIR/fortunes
793+if [[ ! -f $DIR/chucknorris.dat ]] || [[ $DIR/chucknorris.dat -ot $DIR/chucknorris ]]; then
794+ # For some reason, Cygwin puts strfile in /usr/sbin, which is not on the path by default
795+ local strfile=strfile
796+ if ! which strfile &>/dev/null && [[ -f /usr/sbin/strfile ]]; then
797+ strfile=/usr/sbin/strfile
798+ fi
799+ if which $strfile &> /dev/null; then
800+ $strfile $DIR/chucknorris $DIR/chucknorris.dat >/dev/null
801+ else
802+ echo "[oh-my-zsh] chucknorris depends on strfile, which is not installed" >&2
803+ echo "[oh-my-zsh] strfile is often provided as part of the 'fortune' package" >&2
804+ fi
805 fi
806
807-alias chuck="fortune -a $ZSH/plugins/chucknorris/fortunes"
808+# Aliases
809+alias chuck="fortune -a $DIR"
810 alias chuck_cow="chuck | cowthink"
811+}
812+
813+unset CHUCKNORRIS_PLUGIN_DIR
814diff --git a/plugins/codeclimate/_codeclimate b/plugins/codeclimate/_codeclimate
815new file mode 100644
816index 0000000000000000000000000000000000000000..fd2536a340d632108c3f04bdd130052445c8d02d
817--- /dev/null
818+++ b/plugins/codeclimate/_codeclimate
819@@ -0,0 +1,82 @@
820+#compdef codeclimate
821+
822+_codeclimate_all_engines() {
823+ engines_all=(`codeclimate engines:list | tail -n +2 | gawk '{ print $2 }' | gawk -F: '{ print $1 }'`)
824+}
825+
826+_codeclimate_installed_engines() {
827+ _codeclimate_all_engines
828+
829+ engines_installed=()
830+
831+ if [ -e .codeclimate.yml ]
832+ then
833+ for engine in $engines_all
834+ do
835+ if grep -q $engine ".codeclimate.yml"
836+ then
837+ engines_installed+=$engine
838+ fi
839+ done
840+ fi
841+}
842+
843+_codeclimate_not_installed_engines() {
844+ _codeclimate_all_engines
845+
846+ engines_not_installed=()
847+
848+ if [ -e .codeclimate.yml ]
849+ then
850+ for engine in $engines_all
851+ do
852+ if ! grep -q $engine ".codeclimate.yml"
853+ then
854+ engines_not_installed+=$engine
855+ fi
856+ done
857+ fi
858+}
859+
860+local curcontext="$curcontext" state line ret=1
861+local expl
862+local -a engines_all engines_installed engines_not_installed
863+
864+_arguments \
865+ '1: :->cmds' \
866+ '*:: :->args' && ret=0
867+
868+case $state in
869+ cmds)
870+ _values "bundle command" \
871+ "analyze[Analyze all relevant files in the current working directory]" \
872+ "console[Start an interactive session providing access to the classes within the CLI]" \
873+ "engines\:disable[Prevents the engine from being used in this project]" \
874+ "engines\:enable[This engine will be run the next time your project is analyzed]" \
875+ "engines\:install[Compares the list of engines in your .codeclimate.yml file to those that are currently installed, then installs any missing engines]" \
876+ "engines\:list[Lists all available engines in the Code Climate Docker Hub]" \
877+ "engines\:remove[Removes an engine from your .codeclimate.yml file]" \
878+ "help[Displays a list of commands that can be passed to the Code Climate CLI]" \
879+ "init[Generates a new .codeclimate.yml file in the current working directory]" \
880+ "validate-config[Validates the .codeclimate.yml file in the current working directory]" \
881+ "version[Displays the current version of the Code Climate CLI]"
882+ ret=0
883+ ;;
884+ args)
885+ case $line[1] in
886+ engines:enable)
887+ _codeclimate_not_installed_engines
888+ _wanted engines_not_installed expl 'not installed engines' compadd -a engines_not_installed ;;
889+ engines:disable|engines:remove)
890+ _codeclimate_installed_engines
891+ _wanted engines_installed expl 'installed engines' compadd -a engines_installed ;;
892+ analyze)
893+ _arguments \
894+ '-f:Output Format:(text json)'
895+ ret=0
896+ ;;
897+ esac
898+ ;;
899+esac
900+
901+return ret
902diff --git a/plugins/coffee/coffee.plugin.zsh b/plugins/coffee/coffee.plugin.zsh
903index c7b486a6b27465f08fcecb6e91961039d9c38390..77cb663f7b62f1272e51e881f703f5f7c259f666 100644
904--- a/plugins/coffee/coffee.plugin.zsh
905+++ b/plugins/coffee/coffee.plugin.zsh
906@@ -2,11 +2,11 @@
907
908 # compile a string of coffeescript and print to output
909 cf () {
910- coffee -peb $1
911+ coffee -peb "$1"
912 }
913 # compile & copy to clipboard
914 cfc () {
915- cf $1 | clipcopy
916+ cf "$1" | clipcopy
917 }
918
919 # compile from clipboard & print
920diff --git a/plugins/docker/_docker b/plugins/docker/_docker
921index 25f55beca384ecdd3d4b9c970a322676e9e4599c..a82a31ad3441f78d1b79aca8220728b01fe86ff1 100644
922--- a/plugins/docker/_docker
923+++ b/plugins/docker/_docker
924@@ -27,7 +27,7 @@ __docker_all_containers() {
925 # output a selectable list of all docker images
926 __docker_images() {
927 declare -a img_cmd
928- img_cmd=($(docker images | awk 'NR>1{print $1}'))
929+ img_cmd=($(docker images | awk 'NR>1{print $1}'| sed 's/:/\\:/g'))
930 _describe 'images' img_cmd
931 }
932
933diff --git a/plugins/ember-cli/README.md b/plugins/ember-cli/README.md
934index d1dedf8843786d5800d1c53f1efd5f193e47cdbb..482c347d27aa3c6af0dea4c058900362f1cdb0ef 100644
935--- a/plugins/ember-cli/README.md
936+++ b/plugins/ember-cli/README.md
937@@ -1,22 +1,19 @@
938-# Ember-cli
939+# Ember CLI
940
941-**Maintainer:** [BilalBudhani](http://www.github.com/BilalBudhani)
942+**Maintainers:** [BilalBudhani](http://www.github.com/BilalBudhani), [eubenesa](http://www.github.com/eubenesa)
943
944-Ember-cli (http://www.ember-cli.com/)
945+Ember CLI (http://www.ember-cli.com/)
946
947 ### List of Aliases
948
949-alias es='ember serve'
950-alias ea='ember addon'
951-alias eb='ember build'
952-alias ed='ember destroy'
953-alias eg='ember generate'
954-alias eh='ember help'
955-alias ein='ember init'
956-alias eia='ember install:addon'
957-alias eib='ember install:bower'
958-alias ein='ember install:npm'
959-alias ei='ember install'
960-alias et='ember test'
961-alias eu='ember update'
962-alias ev='ember version'
963+ alias es='ember serve'
964+ alias ea='ember addon'
965+ alias eb='ember build'
966+ alias ed='ember destroy'
967+ alias eg='ember generate'
968+ alias eh='ember help'
969+ alias ein='ember init'
970+ alias ei='ember install'
971+ alias et='ember test'
972+ alias eu='ember update'
973+ alias ev='ember version'
974diff --git a/plugins/ember-cli/ember-cli.plugin.zsh b/plugins/ember-cli/ember-cli.plugin.zsh
975index 044a2c0438896a51e05d8dc4015e72db555442f0..a0f3468299e8587435bef1d63ff13ba02d33423e 100644
976--- a/plugins/ember-cli/ember-cli.plugin.zsh
977+++ b/plugins/ember-cli/ember-cli.plugin.zsh
978@@ -1,5 +1,5 @@
979-# Ember ClI
980-# visit http://www.ember-cli.com/ to view user guid
981+# Ember CLI
982+# Visit http://www.ember-cli.com/ to view user guide
983
984 alias es='ember serve'
985 alias ea='ember addon'
986@@ -8,9 +8,6 @@ alias ed='ember destroy'
987 alias eg='ember generate'
988 alias eh='ember help'
989 alias ein='ember init'
990-alias eia='ember install:addon'
991-alias eib='ember install:bower'
992-alias ein='ember install:npm'
993 alias ei='ember install'
994 alias et='ember test'
995 alias eu='ember update'
996diff --git a/plugins/emoji/emoji-char-definitions.zsh b/plugins/emoji/emoji-char-definitions.zsh
997index 7d110603ceb4d7b579acaf8f12f4cea3e2b05833..04693da0593b98620161e2d52aaeba3115d953c9 100644
998--- a/plugins/emoji/emoji-char-definitions.zsh
999+++ b/plugins/emoji/emoji-char-definitions.zsh
1000@@ -7,8 +7,12 @@
1001 # $emoji - which maps character names to Unicode characters
1002 # $emoji_flags - maps country names to Unicode flag characters using region indicators
1003
1004+# Main emoji
1005 typeset -gAH emoji
1006+# National flags
1007 typeset -gAH emoji_flags
1008+# Combining modifiers
1009+typeset -gAH emoji_mod
1010
1011 emoji[copyright_sign]=$'\U00A9'
1012 emoji[registered_sign]=$'\U00AE'
1013@@ -448,10 +452,15 @@ emoji[badminton_racquet_and_shuttlecock]=$'\U1F3F8'
1014 emoji[bow_and_arrow]=$'\U1F3F9'
1015 emoji[amphora]=$'\U1F3FA'
1016 emoji[emoji_modifier_fitzpatrick_type_1_2]=$'\U1F3FB'
1017+emoji_mod[emoji_modifier_fitzpatrick_type_1_2]=$'\U1F3FB'
1018 emoji[emoji_modifier_fitzpatrick_type_3]=$'\U1F3FC'
1019+emoji_mod[emoji_modifier_fitzpatrick_type_3]=$'\U1F3FC'
1020 emoji[emoji_modifier_fitzpatrick_type_4]=$'\U1F3FD'
1021+emoji_mod[emoji_modifier_fitzpatrick_type_4]=$'\U1F3FD'
1022 emoji[emoji_modifier_fitzpatrick_type_5]=$'\U1F3FE'
1023+emoji_mod[emoji_modifier_fitzpatrick_type_5]=$'\U1F3FE'
1024 emoji[emoji_modifier_fitzpatrick_type_6]=$'\U1F3FF'
1025+emoji_mod[emoji_modifier_fitzpatrick_type_6]=$'\U1F3FF'
1026 emoji[rat]=$'\U1F400'
1027 emoji[mouse]=$'\U1F401'
1028 emoji[ox]=$'\U1F402'
1029diff --git a/plugins/emoji/emoji.plugin.zsh b/plugins/emoji/emoji.plugin.zsh
1030index a98d0b714c4794bc9a7744108b2a66066bcc3fe2..7876f1c89e5580d8b57bd1fd2d3ae756bba36c80 100644
1031--- a/plugins/emoji/emoji.plugin.zsh
1032+++ b/plugins/emoji/emoji.plugin.zsh
1033@@ -76,8 +76,6 @@ emoji_skintone[6]=$'\U1F3FF'
1034 # These are stored in a single associative array, $emoji_groups, to avoid cluttering up the global
1035 # namespace, and to allow adding additional group definitions at run time.
1036 # The keys are the group names, and the values are whitespace-separated lists of emoji character names.
1037-#
1038-# These extra local arrays are used to allow more convenient formatting of the source code.
1039
1040 emoji_groups[fruits]="
1041 tomato
1042@@ -255,9 +253,10 @@ function random_emoji() {
1043 if [[ -z "$group" || "$group" == "all" ]]; then
1044 names=(${(k)emoji})
1045 else
1046- names=(${=emoji_groups[$group_name]})
1047+ names=(${=emoji_groups[$group]})
1048 fi
1049- local list_size=$#names
1050+ local list_size=${#names}
1051+ [[ $list_size -eq 0 ]] && return 1
1052 local random_index=$(( ( RANDOM % $list_size ) + 1 ))
1053 local name=${names[$random_index]}
1054 echo ${emoji[$name]}
1055diff --git a/plugins/emoji/update_emoji.pl b/plugins/emoji/update_emoji.pl
1056index d90c6e31622e362038880a64d26c41dc6f860580..04f3ce8e77f2e3f18ca6ded37e0a95b2b5520b04 100644
1057--- a/plugins/emoji/update_emoji.pl
1058+++ b/plugins/emoji/update_emoji.pl
1059@@ -88,7 +88,7 @@ typeset -gAH emoji_mod
1060 }
1061 # Modifiers are included in both the main set and their separate map,
1062 # because they have a standalone representation as a color swatch.
1063- if ( $modifier_status == "modifier" ) {
1064+ if ( $modifier_status eq "modifier" ) {
1065 $outfh->print("emoji_mod[$omz_name]=\$'$zsh_code'\n");
1066 }
1067 } else {
1068diff --git a/plugins/emotty/emotty.plugin.zsh b/plugins/emotty/emotty.plugin.zsh
1069new file mode 100644
1070index 0000000000000000000000000000000000000000..b32dd1a4c52b0a76ec21b6b7a5485db6f6a5af5a
1071--- /dev/null
1072+++ b/plugins/emotty/emotty.plugin.zsh
1073@@ -0,0 +1,43 @@
1074+# ------------------------------------------------------------------------------
1075+# FILE: emotty.plugin.zsh
1076+# DESCRIPTION: Return an emoji for the current $TTY number.
1077+# AUTHOR: Alexis Hildebrandt (afh[at]surryhill.net)
1078+# VERSION: 1.0.0
1079+# DEPENDS: emoji plugin
1080+#
1081+# There are different sets of emoji characters available, to choose a different
1082+# set export emotty_set to the name of the set you would like to use, e.g.:
1083+# % export emotty_set=nature
1084+# ------------------------------------------------------------------------------
1085+
1086+typeset -gAH _emotty_sets
1087+local _emotty_plugin_dir="${0:h}"
1088+source "$_emotty_plugin_dir/emotty_stellar_set.zsh"
1089+source "$_emotty_plugin_dir/emotty_floral_set.zsh"
1090+source "$_emotty_plugin_dir/emotty_zodiac_set.zsh"
1091+source "$_emotty_plugin_dir/emotty_nature_set.zsh"
1092+source "$_emotty_plugin_dir/emotty_emoji_set.zsh"
1093+source "$_emotty_plugin_dir/emotty_love_set.zsh"
1094+unset _emotty_plugin_dir
1095+
1096+emotty_default_set=emoji
1097+
1098+function emotty() {
1099+ # Use emotty set defined by user, fallback to default
1100+ local emotty=${_emotty_sets[${emotty_set:-$emotty_default_set}]}
1101+ # Parse $TTY number, normalizing it to an emotty set index
1102+ (( tty = (${TTY##/dev/ttys} % ${#${=emotty}}) + 1 ))
1103+ local character_name=${${=emotty}[tty]}
1104+ echo "${emoji[${character_name}]}${emoji2[emoji_style]}"
1105+}
1106+
1107+function display_emotty() {
1108+ local name=$1
1109+ for i in ${=_emotty_sets[$name]}; do
1110+ printf "${emoji[$i]}${emoji2[emoji_style]} "
1111+ done
1112+ print
1113+ for i in ${=_emotty_sets[$name]}; do
1114+ print "${emoji[$i]}${emoji2[emoji_style]} = $i"
1115+ done
1116+}
1117diff --git a/plugins/emotty/emotty_emoji_set.zsh b/plugins/emotty/emotty_emoji_set.zsh
1118new file mode 100644
1119index 0000000000000000000000000000000000000000..00e3171312aa7da12ba138f19904d2184e58b0e7
1120--- /dev/null
1121+++ b/plugins/emotty/emotty_emoji_set.zsh
1122@@ -0,0 +1,24 @@
1123+#!/usr/bin/env zsh
1124+# vim:ft=zsh ts=2 sw=2 sts=2
1125+
1126+_emotty_sets[emoji]="
1127+ crystal_ball
1128+ ghost
1129+ jack_o_lantern
1130+ see_no_evil_monkey
1131+ hear_no_evil_monkey
1132+ speak_no_evil_monkey
1133+ smiling_cat_face_with_open_mouth
1134+ extraterrestrial_alien
1135+ rocket
1136+ billiards
1137+ bomb
1138+ pill
1139+ japanese_symbol_for_beginner
1140+ direct_hit
1141+ cyclone
1142+ diamond_shape_with_a_dot_inside
1143+ sparkle
1144+ eight_spoked_asterisk
1145+ eight_pointed_black_star
1146+ "
1147diff --git a/plugins/emotty/emotty_floral_set.zsh b/plugins/emotty/emotty_floral_set.zsh
1148new file mode 100644
1149index 0000000000000000000000000000000000000000..f761feae6de186cf83e68f8398d535472dc1fd82
1150--- /dev/null
1151+++ b/plugins/emotty/emotty_floral_set.zsh
1152@@ -0,0 +1,18 @@
1153+#!/usr/bin/env zsh
1154+# vim:ft=zsh ts=2 sw=2 sts=2
1155+
1156+_emotty_sets[floral]="
1157+ hibiscus
1158+ cherry_blossom
1159+ blossom
1160+ sunflower
1161+ bouquet
1162+ tulip
1163+ rose
1164+ four_leaf_clover
1165+ seedling
1166+ herb
1167+ palm_tree
1168+ evergreen_tree
1169+ deciduous_tree
1170+ "
1171diff --git a/plugins/emotty/emotty_love_set.zsh b/plugins/emotty/emotty_love_set.zsh
1172new file mode 100644
1173index 0000000000000000000000000000000000000000..8f19e6902e2e5842eba4ed2dfb53e36ef619b391
1174--- /dev/null
1175+++ b/plugins/emotty/emotty_love_set.zsh
1176@@ -0,0 +1,34 @@
1177+#!/usr/bin/env zsh
1178+# vim:ft=zsh ts=2 sw=2 sts=2
1179+
1180+# Note: The heavy_black_heart emoji requires $emoji2[emoji_style]
1181+# to be rendered as the emoji red heart.
1182+_emotty_sets[love]="
1183+ green_heart
1184+ blue_heart
1185+ purple_heart
1186+ yellow_heart
1187+ heavy_black_heart
1188+ broken_heart
1189+ heart_with_arrow
1190+ heart_with_ribbon
1191+ sparkling_heart
1192+ two_hearts
1193+ revolving_hearts
1194+ growing_heart
1195+ beating_heart
1196+ heart_decoration
1197+ couple_with_heart
1198+ kiss
1199+ man_and_woman_holding_hands
1200+ two_women_holding_hands
1201+ two_men_holding_hands
1202+ kiss_mark
1203+ smiling_face_with_heart_shaped_eyes
1204+ kissing_face
1205+ face_throwing_a_kiss
1206+ kissing_face_with_smiling_eyes
1207+ kissing_face_with_closed_eyes
1208+ smiling_cat_face_with_heart_shaped_eyes
1209+ kissing_cat_face_with_closed_eyes
1210+ "
1211diff --git a/plugins/emotty/emotty_nature_set.zsh b/plugins/emotty/emotty_nature_set.zsh
1212new file mode 100644
1213index 0000000000000000000000000000000000000000..8dab4c1ba2eee2ad59bb8335dea79aabb007dadd
1214--- /dev/null
1215+++ b/plugins/emotty/emotty_nature_set.zsh
1216@@ -0,0 +1,58 @@
1217+#!/usr/bin/env zsh
1218+# vim:ft=zsh ts=2 sw=2 sts=2
1219+
1220+_emotty_sets[nature]="
1221+ mouse_face
1222+ hamster_face
1223+ rabbit_face
1224+ dog_face
1225+ cat_face
1226+ tiger_face
1227+ bear_face
1228+ monkey_face
1229+ koala
1230+ panda_face
1231+ chicken
1232+ baby_chick
1233+ bird
1234+ penguin
1235+ cow_face
1236+ pig_face
1237+ frog_face
1238+ boar
1239+ wolf_face
1240+ horse_face
1241+ snail
1242+ bug
1243+ ant
1244+ honeybee
1245+ lady_beetle
1246+ spouting_whale
1247+ dolphin
1248+ octopus
1249+ fish
1250+ tropical_fish
1251+ snake
1252+ turtle
1253+ lemon
1254+ tangerine
1255+ peach
1256+ mushroom
1257+ tomato
1258+ strawberry
1259+ red_apple
1260+ cherries
1261+ grapes
1262+ aubergine
1263+ watermelon
1264+ banana
1265+ pineapple
1266+ melon
1267+ pear
1268+ green_apple
1269+ ear_of_maize
1270+ sunflower
1271+ seedling
1272+ herb
1273+ four_leaf_clover
1274+ "
1275diff --git a/plugins/emotty/emotty_stellar_set.zsh b/plugins/emotty/emotty_stellar_set.zsh
1276new file mode 100644
1277index 0000000000000000000000000000000000000000..8e7e61068a523461cd1dbd4b5d0e8e023a35ce6c
1278--- /dev/null
1279+++ b/plugins/emotty/emotty_stellar_set.zsh
1280@@ -0,0 +1,25 @@
1281+#!/usr/bin/env zsh
1282+# vim:ft=zsh ts=2 sw=2 sts=2
1283+
1284+# NOTE: The following emoji show as $'character' in the title
1285+# white_medium_star
1286+# sparkles
1287+# dizzy_symbol
1288+
1289+_emotty_sets[stellar]="
1290+ full_moon_symbol
1291+ waning_gibbous_moon_symbol
1292+ waning_crescent_moon_symbol
1293+ last_quarter_moon_symbol
1294+ new_moon_symbol
1295+ new_moon_with_face
1296+ waxing_crescent_moon_symbol
1297+ first_quarter_moon_symbol
1298+ waxing_gibbous_moon_symbol
1299+ full_moon_with_face
1300+ sun_with_face
1301+ glowing_star
1302+ crescent_moon
1303+ first_quarter_moon_with_face
1304+ last_quarter_moon_with_face
1305+ "
1306diff --git a/plugins/emotty/emotty_zodiac_set.zsh b/plugins/emotty/emotty_zodiac_set.zsh
1307new file mode 100644
1308index 0000000000000000000000000000000000000000..bde6e3d2e764477ce3ed0e3a0186d02a09ed6bff
1309--- /dev/null
1310+++ b/plugins/emotty/emotty_zodiac_set.zsh
1311@@ -0,0 +1,29 @@
1312+#!/usr/bin/env zsh
1313+# vim:ft=zsh ts=2 sw=2 sts=2
1314+
1315+_emotty_sets[zodiac]="
1316+ aries
1317+ taurus
1318+ gemini
1319+ cancer
1320+ leo
1321+ virgo
1322+ libra
1323+ scorpius
1324+ sagittarius
1325+ capricorn
1326+ aquarius
1327+ pisces
1328+ rat
1329+ ox
1330+ tiger
1331+ rabbit
1332+ dragon
1333+ snake
1334+ horse
1335+ goat
1336+ monkey
1337+ rooster
1338+ dog
1339+ pig
1340+ "
1341diff --git a/plugins/fancy-ctrl-z/README.md b/plugins/fancy-ctrl-z/README.md
1342new file mode 100644
1343index 0000000000000000000000000000000000000000..a7670fa2c2d9a21ea1c5aeeeb06ed07c6ece2988
1344--- /dev/null
1345+++ b/plugins/fancy-ctrl-z/README.md
1346@@ -0,0 +1,14 @@
1347+# Use Ctrl-Z to switch back to Vim
1348+
1349+I frequently need to execute random command in my shell. To achieve it I pause
1350+Vim by pressing Ctrl-z, type command and press fg<Enter> to switch back to Vim.
1351+The fg part really hurt sme. I just wanted to hit Ctrl-z once again to get back
1352+to Vim. I could not find a solution, so I developed one on my own that
1353+works wonderfully with ZSH
1354+
1355+Source: http://sheerun.net/2014/03/21/how-to-boost-your-vim-productivity/
1356+
1357+Credits:
1358+- original idea by @sheerun
1359+- added to OMZ by @mbologna
1360+
1361diff --git a/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh b/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh
1362new file mode 100644
1363index 0000000000000000000000000000000000000000..8ab2979133efda46a4ce1990f4d159da69d603e6
1364--- /dev/null
1365+++ b/plugins/fancy-ctrl-z/fancy-ctrl-z.plugin.zsh
1366@@ -0,0 +1,12 @@
1367+fancy-ctrl-z () {
1368+ if [[ $#BUFFER -eq 0 ]]; then
1369+ BUFFER="fg"
1370+ zle accept-line
1371+ else
1372+ zle push-input
1373+ zle clear-screen
1374+ fi
1375+}
1376+zle -N fancy-ctrl-z
1377+bindkey '^Z' fancy-ctrl-z
1378+
1379diff --git a/plugins/fedora/README.md b/plugins/fedora/README.md
1380new file mode 100644
1381index 0000000000000000000000000000000000000000..f384b0ffdc3375b33da38af90f73257d82bd562a
1382--- /dev/null
1383+++ b/plugins/fedora/README.md
1384@@ -0,0 +1,3 @@
1385+This is a plugin based on yum plugin, but using dnf as main frontend
1386+(from Fedora 22 onwards, yum is deprecated in favor of dnf).
1387+
1388diff --git a/plugins/fedora/fedora.plugin.zsh b/plugins/fedora/fedora.plugin.zsh
1389new file mode 100644
1390index 0000000000000000000000000000000000000000..eddc3627b11e10c9ca9dd01f2fdf45b4db21d62c
1391--- /dev/null
1392+++ b/plugins/fedora/fedora.plugin.zsh
1393@@ -0,0 +1,16 @@
1394+## Aliases
1395+
1396+alias dnfs="dnf search" # search package
1397+alias dnfp="dnf info" # show package info
1398+alias dnfl="dnf list" # list packages
1399+alias dnfgl="dnf grouplist" # list package groups
1400+alias dnfli="dnf list installed" # print all installed packages
1401+alias dnfmc="dnf makecache" # rebuilds the dnf package list
1402+
1403+alias dnfu="sudo dnf upgrade" # upgrade packages
1404+alias dnfi="sudo dnf install" # install package
1405+alias dnfgi="sudo dnf groupinstall" # install package group
1406+alias dnfr="sudo dnf remove" # remove package
1407+alias dnfgr="sudo dnf groupremove" # remove pagage group
1408+alias dnfrl="sudo dnf remove --remove-leaves" # remove package and leaves
1409+alias dnfc="sudo dnf clean all" # clean cache
1410diff --git a/plugins/frontend-search/README.md b/plugins/frontend-search/README.md
1411index 801d450f300db76af79370ce96f2ac9ef65ba024..d0bc5589f742e2dd3081242f2811b69d0571bff4 100644
1412--- a/plugins/frontend-search/README.md
1413+++ b/plugins/frontend-search/README.md
1414@@ -1,74 +1,60 @@
1415-## Rationale ##
1416+## Introduction ##
1417
1418-> Searches for your Frontend contents more easier
1419+> Searches for your frontend web development made easier
1420
1421
1422-## Instalation ##
1423+## Installation ##
1424
1425+Open your `~/.zshrc` file and enable the `frontend-search` plugin:
1426
1427-Open your `.zshrc` file and load `frontend-search` plugin
1428+```zsh
1429+
1430+plugins=( ... frontend-search)
1431
1432-```bash
1433-...
1434-plugins=( <your-plugins-list>... frontend-search)
1435-...
1436 ```
1437
1438
1439-## Commands ##
1440-
1441-All command searches are accept only in format
1442-
1443-* `frontend <search-content> <search-term>`
1444-
1445-The search content are
1446-
1447-* `jquery <api.jquery.com>`
1448-* `mdn <developer.mozilla.org>`
1449-* `compass <compass-style.org>`
1450-* `html5please <html5please.com>`
1451-* `caniuse <caniuse.com>`
1452-* `aurajs <aurajs.com>`
1453-* `dartlang <api.dartlang.org/apidocs/channels/stable/dartdoc-viewer>`
1454-* `lodash <search>`
1455-* `qunit <api.qunitjs.com>`
1456-* `fontello <fontello.com>`
1457-* `bootsnipp <bootsnipp.com>`
1458-* `cssflow <cssflow.com>`
1459-* `codepen <codepen.io>`
1460-* `unheap <www.unheap.com>`
1461-* `bem <google.com/search?as_q=<search-term>&as_sitesearch=bem.info>`
1462-* `smacss <google.com/search?as_q=<search-term>&as_sitesearch=smacss.com>`
1463-* `angularjs <google.com/search?as_q=<search-term>&as_sitesearch=angularjs.org>`
1464-* `reactjs <google.com/search?as_q=<search-term>&as_sitesearch=facebook.github.io/react>`
1465-* `emberjs <emberjs.com>`
1466-* `stackoverflow <stackoverflow.com>`
1467-
1468-
1469-## Aliases ##
1470-
1471-There are a few aliases presented as well:
1472-
1473-* `jquery` A shorthand for `frontend jquery`
1474-* `mdn` A shorthand for `frontend mdn`
1475-* `compass` A shorthand for `frontend compass`
1476-* `html5please` A shorthand for `frontend html5please`
1477-* `caniuse` A shorthand for `frontend caniuse`
1478-* `aurajs` A shorthand for `frontend aurajs`
1479-* `dartlang` A shorthand for `frontend dartlang`
1480-* `lodash` A shorthand for `frontend lodash`
1481-* `qunit` A shorthand for `frontend qunit`
1482-* `fontello` A shorthand for `frontend fontello`
1483-* `bootsnipp` A shorthand for `frontend bootsnipp`
1484-* `cssflow` A shorthand for `frontend cssflow`
1485-* `codepen` A shorthand for `frontend codepen`
1486-* `unheap` A shorthand for `frontend unheap`
1487-* `bem` A shorthand for `frontend bem`
1488-* `smacss` A shorthand for `frontend smacss`
1489-* `angularjs` A shorthand for `frontend angularjs`
1490-* `reactjs` A shorthand for `frontend reactjs`
1491-* `emberjs` A shorthand for `frontend emberjs`
1492-* `stackoverflow` A shorthand for `frontend stackoverflow`
1493+## Usage ##
1494+
1495+You can use the frontend-search plugin in these two forms:
1496+
1497+* `frontend <context> <term> [more terms if you want]`
1498+* `<context> <term> [more terms if you want]`
1499+
1500+For example, these two are equivalent:
1501+
1502+```zsh
1503+$ frontend angularjs dependency injection
1504+$ angularjs dependency injection
1505+```
1506+
1507+Available search contexts are:
1508+
1509+| context | URL |
1510+|---------------|--------------------------------------------------------------------------|
1511+| angularjs | `https://google.com/search?as_sitesearch=angularjs.org&as_q=` |
1512+| aurajs | `http://aurajs.com/api/#stq=` |
1513+| bem | `https://google.com/search?as_sitesearch=bem.info&as_q=` |
1514diff --git a/plugins/frontend-search/_frontend-search.sh b/plugins/frontend-search/_frontend-search.sh
1515index 252f215707240ce8c11236d919b601c51791be62..b12f829a1c58e52388c7a613b9569ec7406ce3cf 100644
1516--- a/plugins/frontend-search/_frontend-search.sh
1517+++ b/plugins/frontend-search/_frontend-search.sh
1518@@ -37,6 +37,7 @@ function _frontend() {
1519 'reactjs: Search in React website'
1520 'emberjs: Search in Ember website'
1521 'stackoverflow: Search in StackOverflow website'
1522+ 'npmjs: Search in NPMJS website'
1523 )
1524
1525 _arguments -C \
1526@@ -110,6 +111,9 @@ function _frontend() {
1527 stackoverflow)
1528 _describe -t points "Warp points" frontend_points && ret=0
1529 ;;
1530+ npmjs)
1531+ _describe -t points "Warp points" frontend_points && ret=0
1532+ ;;
1533 esac
1534 ;;
1535 esac
1536diff --git a/plugins/frontend-search/frontend-search.plugin.zsh b/plugins/frontend-search/frontend-search.plugin.zsh
1537index f7485621bf444e479a6bd23e37eef220d733d317..2fd5416b3c032aaab73f1ea780aa717881ddb680 100644
1538--- a/plugins/frontend-search/frontend-search.plugin.zsh
1539+++ b/plugins/frontend-search/frontend-search.plugin.zsh
1540@@ -1,150 +1,91 @@
1541-# frontend from terminal
1542+alias angularjs='frontend angularjs'
1543+alias aurajs='frontend aurajs'
1544+alias bem='frontend bem'
1545+alias bootsnipp='frontend bootsnipp'
1546+alias caniuse='frontend caniuse'
1547+alias codepen='frontend codepen'
1548+alias compass='frontend compass'
1549+alias cssflow='frontend cssflow'
1550+alias dartlang='frontend dartlang'
1551+alias emberjs='frontend emberjs'
1552+alias fontello='frontend fontello'
1553+alias html5please='frontend html5please'
1554+alias jquery='frontend jquery'
1555+alias lodash='frontend lodash'
1556+alias mdn='frontend mdn'
1557+alias npmjs='frontend npmjs'
1558+alias qunit='frontend qunit'
1559+alias reactjs='frontend reactjs'
1560+alias smacss='frontend smacss'
1561+alias stackoverflow='frontend stackoverflow'
1562+alias unheap='frontend unheap'
1563
1564 function frontend() {
1565-
1566- # no keyword provided, simply show how call methods
1567- if [[ $# -le 1 ]]; then
1568- echo "Please provide a search-content and a search-term for app.\nEx:\nfrontend <search-content> <search-term>\n"
1569- return 1
1570+ emulate -L zsh
1571+
1572+ # define search context URLS
1573+ typeset -A urls
1574+ urls=(
1575+ angularjs 'https://google.com/search?as_sitesearch=angularjs.org&as_q='
1576+ aurajs 'http://aurajs.com/api/#stq='
1577+ bem 'https://google.com/search?as_sitesearch=bem.info&as_q='
1578+ bootsnipp 'http://bootsnipp.com/search?q='
1579+ caniuse 'http://caniuse.com/#search='
1580+ codepen 'http://codepen.io/search?q='
1581+ compass 'http://compass-style.org/search?q='
1582+ cssflow 'http://www.cssflow.com/search?q='
1583+ dartlang 'https://api.dartlang.org/apidocs/channels/stable/dartdoc-viewer/dart:'
1584+ emberjs 'http://emberjs.com/api/#stp=1&stq='
1585+ fontello 'http://fontello.com/#search='
1586+ html5please 'http://html5please.com/#'
1587+ jquery 'https://api.jquery.com/?s='
1588+ lodash 'https://devdocs.io/lodash/index#'
1589+ mdn 'https://developer.mozilla.org/search?q='
1590+ npmjs 'https://www.npmjs.com/search?q='
1591+ qunit 'https://api.qunitjs.com/?s='
1592+ reactjs 'https://google.com/search?as_sitesearch=facebook.github.io/react&as_q='
1593+ smacss 'https://google.com/search?as_sitesearch=smacss.com&as_q='
1594+ stackoverflow 'http://stackoverflow.com/search?q='
1595+ unheap 'http://www.unheap.com/?s='
1596+ )
1597+
1598+ # show help for command list
1599+ if [[ $# -lt 2 ]]
1600+ then
1601+ print -P "Usage: frontend %Ucontext%u %Uterm%u [...%Umore%u] (or just: %Ucontext%u %Uterm%u [...%Umore%u])"
1602+ print -P ""
1603+ print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website,"
1604+ print -P "and %Ucontext%u is one of the following:"
1605+ print -P ""
1606+ print -P " angularjs, aurajs, bem, bootsnipp, caniuse, codepen, compass, cssflow,"
1607+ print -P " dartlang, emberjs, fontello, html5please, jquery, lodash, mdn, npmjs,"
1608+ print -P " qunit, reactjs, smacss, stackoverflow, unheap"
1609+ print -P ""
1610+ print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
1611+ print -P ""
1612+ return 1
1613 fi
1614
1615- # check whether the search engine is supported
1616- if [[ ! $1 =~ '(jquery|mdn|compass|html5please|caniuse|aurajs|dartlang|qunit|fontello|bootsnipp|cssflow|codepen|unheap|bem|smacss|angularjs|reactjs|emberjs|stackoverflow)' ]];
1617+ # check whether the search context is supported
1618+ if [[ -z "$urls[$1]" ]]
1619 then
1620- echo "Search valid search content $1 not supported."
1621- echo "Valid contents: (formats 'frontend <search-content>' or '<search-content>')"
1622- echo "* jquery"
1623- echo "* mdn"
1624- echo "* compass"
1625- echo "* html5please"
1626- echo "* caniuse"
1627- echo "* aurajs"
1628- echo "* dartlang"
1629- echo "* lodash"
1630- echo "* qunit"
1631- echo "* fontello"
1632- echo "* bootsnipp"
1633- echo "* cssflow"
1634- echo "* codepen"
1635- echo "* unheap"
1636- echo "* bem"
1637- echo "* smacss"
1638- echo "* angularjs"
1639- echo "* reactjs"
1640diff --git a/plugins/git-extras/git-extras.plugin.zsh b/plugins/git-extras/git-extras.plugin.zsh
1641index 8419166abc10b7f05a30fe02d39aa34d3c33cddb..d91c1af81c6391c17249449e8cd5bc554201a73a 100644
1642--- a/plugins/git-extras/git-extras.plugin.zsh
1643+++ b/plugins/git-extras/git-extras.plugin.zsh
1644@@ -3,19 +3,20 @@
1645 # Description
1646 # -----------
1647 #
1648-# Completion script for git-extras (http://github.com/visionmedia/git-extras).
1649+# Completion script for git-extras (http://github.com/tj/git-extras).
1650 #
1651 # ------------------------------------------------------------------------------
1652 # Authors
1653 # -------
1654 #
1655 # * Alexis GRIMALDI (https://github.com/agrimaldi)
1656+# * spacewander (https://github.com/spacewander)
1657 #
1658 # ------------------------------------------------------------------------------
1659 # Inspirations
1660 # -----------
1661 #
1662-# * git-extras (http://github.com/visionmedia/git-extras)
1663+# * git-extras (http://github.com/tj/git-extras)
1664 # * git-flow-completion (http://github.com/bobthecow/git-flow-completion)
1665 #
1666 # ------------------------------------------------------------------------------
1667@@ -30,10 +31,21 @@ __git_command_successful () {
1668 }
1669
1670
1671+__git_commits() {
1672+ declare -A commits
1673+ git log --oneline -15 | sed 's/\([[:alnum:]]\{7\}\) /\1:/' | while read commit
1674+ do
1675+ hash=$(echo $commit | cut -d':' -f1)
1676+ commits[$hash]="$commit"
1677+ done
1678+ local ret=1
1679+ _describe -t commits commit commits && ret=0
1680+}
1681+
1682 __git_tag_names() {
1683 local expl
1684 declare -a tag_names
1685- tag_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
1686+ tag_names=(${${(f)"$(_call_program tags git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
1687 __git_command_successful || return
1688 _wanted tag-names expl tag-name compadd $* - $tag_names
1689 }
1690@@ -47,31 +59,27 @@ __git_branch_names() {
1691 _wanted branch-names expl branch-name compadd $* - $branch_names
1692 }
1693
1694-
1695-__git_feature_branch_names() {
1696+__git_specific_branch_names() {
1697 local expl
1698 declare -a branch_names
1699- branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/feature 2>/dev/null)"}#refs/heads/feature/})
1700+ branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/"$1" 2>/dev/null)"}#refs/heads/$1/})
1701 __git_command_successful || return
1702 _wanted branch-names expl branch-name compadd $* - $branch_names
1703 }
1704
1705
1706+__git_feature_branch_names() {
1707+ __git_specific_branch_names 'feature'
1708+}
1709+
1710+
1711 __git_refactor_branch_names() {
1712- local expl
1713- declare -a branch_names
1714- branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/refactor 2>/dev/null)"}#refs/heads/refactor/})
1715- __git_command_successful || return
1716- _wanted branch-names expl branch-name compadd $* - $branch_names
1717+ __git_specific_branch_names 'refactor'
1718 }
1719
1720
1721 __git_bug_branch_names() {
1722- local expl
1723- declare -a branch_names
1724- branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads/bug 2>/dev/null)"}#refs/heads/bug/})
1725- __git_command_successful || return
1726- _wanted branch-names expl branch-name compadd $* - $branch_names
1727+ __git_specific_branch_names 'bug'
1728 }
1729
1730
1731@@ -92,19 +100,43 @@ __git_author_names() {
1732 _wanted author-names expl author-name compadd $* - $author_names
1733 }
1734
1735+# subcommands
1736
1737-_git-changelog() {
1738- _arguments \
1739- '(-l --list)'{-l,--list}'[list commits]' \
1740+_git-bug() {
1741+ local curcontext=$curcontext state line ret=1
1742+ declare -A opt_args
1743+
1744diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh
1745index 4357c08957e6f7373df0dbcd465db2d59719f6f9..444440bcb8afeff1a3f699e694d834210d793087 100644
1746--- a/plugins/git-flow/git-flow.plugin.zsh
1747+++ b/plugins/git-flow/git-flow.plugin.zsh
1748@@ -21,7 +21,7 @@
1749 #
1750
1751 #Alias
1752-alias gf='git flow'
1753+alias gfl='git flow'
1754 alias gcd='git checkout develop'
1755 alias gch='git checkout hotfix'
1756 alias gcr='git checkout release'
1757diff --git a/plugins/git-prompt/git-prompt.plugin.zsh b/plugins/git-prompt/git-prompt.plugin.zsh
1758index d868a5fe1d1bf6b6117db674b093d1a632f5d0d7..5175bf70f91d0fafddebfd72a74eea5435131213 100644
1759--- a/plugins/git-prompt/git-prompt.plugin.zsh
1760+++ b/plugins/git-prompt/git-prompt.plugin.zsh
1761@@ -1,57 +1,92 @@
1762 # ZSH Git Prompt Plugin from:
1763 # http://github.com/olivierverdier/zsh-git-prompt
1764-#
1765-export __GIT_PROMPT_DIR=$ZSH/plugins/git-prompt
1766
1767-# Allow for functions in the prompt.
1768-setopt PROMPT_SUBST
1769+__GIT_PROMPT_DIR="${0:A:h}"
1770
1771-## Enable auto-execution of functions.
1772-typeset -ga preexec_functions
1773-typeset -ga precmd_functions
1774-typeset -ga chpwd_functions
1775-
1776-# Append git functions needed for prompt.
1777-preexec_functions+='preexec_update_git_vars'
1778-precmd_functions+='precmd_update_git_vars'
1779-chpwd_functions+='chpwd_update_git_vars'
1780+## Hook function definitions
1781+function chpwd_update_git_vars() {
1782+ update_current_git_vars
1783+}
1784
1785-## Function definitions
1786 function preexec_update_git_vars() {
1787 case "$2" in
1788- git*)
1789+ git*|hub*|gh*|stg*)
1790 __EXECUTED_GIT_COMMAND=1
1791 ;;
1792 esac
1793 }
1794
1795 function precmd_update_git_vars() {
1796- if [ -n "$__EXECUTED_GIT_COMMAND" ]; then
1797+ if [ -n "$__EXECUTED_GIT_COMMAND" ] || [ ! -n "$ZSH_THEME_GIT_PROMPT_CACHE" ]; then
1798 update_current_git_vars
1799 unset __EXECUTED_GIT_COMMAND
1800 fi
1801 }
1802
1803-function chpwd_update_git_vars() {
1804- update_current_git_vars
1805-}
1806+chpwd_functions+=(chpwd_update_git_vars)
1807+precmd_functions+=(precmd_update_git_vars)
1808+preexec_functions+=(preexec_update_git_vars)
1809+
1810
1811+## Function definitions
1812 function update_current_git_vars() {
1813 unset __CURRENT_GIT_STATUS
1814
1815 local gitstatus="$__GIT_PROMPT_DIR/gitstatus.py"
1816- _GIT_STATUS=`python ${gitstatus}`
1817- __CURRENT_GIT_STATUS=("${(f)_GIT_STATUS}")
1818+ _GIT_STATUS=$(python ${gitstatus} 2>/dev/null)
1819+ __CURRENT_GIT_STATUS=("${(@s: :)_GIT_STATUS}")
1820+ GIT_BRANCH=$__CURRENT_GIT_STATUS[1]
1821+ GIT_AHEAD=$__CURRENT_GIT_STATUS[2]
1822+ GIT_BEHIND=$__CURRENT_GIT_STATUS[3]
1823+ GIT_STAGED=$__CURRENT_GIT_STATUS[4]
1824+ GIT_CONFLICTS=$__CURRENT_GIT_STATUS[5]
1825+ GIT_CHANGED=$__CURRENT_GIT_STATUS[6]
1826+ GIT_UNTRACKED=$__CURRENT_GIT_STATUS[7]
1827 }
1828
1829-function prompt_git_info() {
1830+git_super_status() {
1831+ precmd_update_git_vars
1832 if [ -n "$__CURRENT_GIT_STATUS" ]; then
1833- echo "(%{${fg[red]}%}$__CURRENT_GIT_STATUS[1]%{${fg[default]}%}$__CURRENT_GIT_STATUS[2]%{${fg[magenta]}%}$__CURRENT_GIT_STATUS[3]%{${fg[default]}%})"
1834+ STATUS="$ZSH_THEME_GIT_PROMPT_PREFIX$ZSH_THEME_GIT_PROMPT_BRANCH$GIT_BRANCH%{${reset_color}%}"
1835+ if [ "$GIT_BEHIND" -ne "0" ]; then
1836+ STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_BEHIND$GIT_BEHIND%{${reset_color}%}"
1837+ fi
1838+ if [ "$GIT_AHEAD" -ne "0" ]; then
1839+ STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_AHEAD$GIT_AHEAD%{${reset_color}%}"
1840+ fi
1841+ STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_SEPARATOR"
1842+ if [ "$GIT_STAGED" -ne "0" ]; then
1843+ STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_STAGED$GIT_STAGED%{${reset_color}%}"
1844+ fi
1845+ if [ "$GIT_CONFLICTS" -ne "0" ]; then
1846+ STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CONFLICTS$GIT_CONFLICTS%{${reset_color}%}"
1847+ fi
1848+ if [ "$GIT_CHANGED" -ne "0" ]; then
1849+ STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CHANGED$GIT_CHANGED%{${reset_color}%}"
1850+ fi
1851+ if [ "$GIT_UNTRACKED" -ne "0" ]; then
1852+ STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED%{${reset_color}%}"
1853+ fi
1854+ if [ "$GIT_CHANGED" -eq "0" ] && [ "$GIT_CONFLICTS" -eq "0" ] && [ "$GIT_STAGED" -eq "0" ] && [ "$GIT_UNTRACKED" -eq "0" ]; then
1855+ STATUS="$STATUS$ZSH_THEME_GIT_PROMPT_CLEAN"
1856+ fi
1857+ STATUS="$STATUS%{${reset_color}%}$ZSH_THEME_GIT_PROMPT_SUFFIX"
1858+ echo "$STATUS"
1859 fi
1860 }
1861diff --git a/plugins/git-prompt/gitstatus.py b/plugins/git-prompt/gitstatus.py
1862index 2568414320a79140ab387ad4fe788d8cd78367fd..a8eb8284b7ad8ed601890d84f0ffbfe92f6c00a1 100644
1863--- a/plugins/git-prompt/gitstatus.py
1864+++ b/plugins/git-prompt/gitstatus.py
1865@@ -1,82 +1,84 @@
1866 #!/usr/bin/env python
1867-# -*- coding: UTF-8 -*-
1868-from subprocess import Popen, PIPE
1869-import re
1870+from __future__ import print_function
1871
1872-# change those symbols to whatever you prefer
1873-symbols = {
1874- 'ahead of': '↑',
1875- 'behind': '↓',
1876- 'staged': '♦',
1877- 'changed': '‣',
1878- 'untracked': '…',
1879- 'clean': '⚡',
1880- 'unmerged': '≠',
1881- 'sha1': ':'
1882-}
1883+import sys
1884+import re
1885+import shlex
1886+from subprocess import Popen, PIPE, check_output
1887
1888-output, error = Popen(
1889- ['git', 'status'], stdout=PIPE, stderr=PIPE, universal_newlines=True).communicate()
1890
1891-if error:
1892- import sys
1893- sys.exit(0)
1894-lines = output.splitlines()
1895+def get_tagname_or_hash():
1896+ """return tagname if exists else hash"""
1897+ cmd = 'git log -1 --format="%h%d"'
1898+ output = check_output(shlex.split(cmd)).decode('utf-8').strip()
1899+ hash_, tagname = None, None
1900+ # get hash
1901+ m = re.search('\(.*\)$', output)
1902+ if m:
1903+ hash_ = output[:m.start()-1]
1904+ # get tagname
1905+ m = re.search('tag: .*[,\)]', output)
1906+ if m:
1907+ tagname = 'tags/' + output[m.start()+len('tag: '): m.end()-1]
1908
1909-behead_re = re.compile(
1910- r"^# Your branch is (ahead of|behind) '(.*)' by (\d+) commit")
1911-diverge_re = re.compile(r"^# and have (\d+) and (\d+) different")
1912+ if tagname:
1913+ return tagname
1914+ elif hash_:
1915+ return hash_
1916+ return None
1917
1918-status = ''
1919-staged = re.compile(r'^# Changes to be committed:$', re.MULTILINE)
1920-changed = re.compile(r'^# Changed but not updated:$', re.MULTILINE)
1921-untracked = re.compile(r'^# Untracked files:$', re.MULTILINE)
1922-unmerged = re.compile(r'^# Unmerged paths:$', re.MULTILINE)
1923
1924+# `git status --porcelain --branch` can collect all information
1925+# branch, remote_branch, untracked, staged, changed, conflicts, ahead, behind
1926+po = Popen(['git', 'status', '--porcelain', '--branch'], stdout=PIPE, stderr=PIPE)
1927+stdout, sterr = po.communicate()
1928+if po.returncode != 0:
1929+ sys.exit(0) # Not a git repository
1930
1931-def execute(*command):
1932- out, err = Popen(stdout=PIPE, stderr=PIPE, *command).communicate()
1933- if not err:
1934- nb = len(out.splitlines())
1935+# collect git status information
1936+untracked, staged, changed, conflicts = [], [], [], []
1937+ahead, behind = 0, 0
1938+status = [(line[0], line[1], line[2:]) for line in stdout.decode('utf-8').splitlines()]
1939+for st in status:
1940+ if st[0] == '#' and st[1] == '#':
1941+ if re.search('Initial commit on', st[2]):
1942+ branch = st[2].split(' ')[-1]
1943+ elif re.search('no branch', st[2]): # detached status
1944+ branch = get_tagname_or_hash()
1945+ elif len(st[2].strip().split('...')) == 1:
1946+ branch = st[2].strip()
1947+ else:
1948+ # current and remote branch info
1949+ branch, rest = st[2].strip().split('...')
1950+ if len(rest.split(' ')) == 1:
1951+ # remote_branch = rest.split(' ')[0]
1952+ pass
1953+ else:
1954+ # ahead or behind
1955+ divergence = ' '.join(rest.split(' ')[1:])
1956+ divergence = divergence.lstrip('[').rstrip(']')
1957+ for div in divergence.split(', '):
1958+ if 'ahead' in div:
1959+ ahead = int(div[len('ahead '):].strip())
1960+ elif 'behind' in div:
1961+ behind = int(div[len('behind '):].strip())
1962+ elif st[0] == '?' and st[1] == '?':
1963+ untracked.append(st)
1964 else:
1965diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
1966index cc6eb1031b1063be5639af3312713ca95fe79513..4f27450380a8ae395c287839532cdc6927f20e50 100644
1967--- a/plugins/git/git.plugin.zsh
1968+++ b/plugins/git/git.plugin.zsh
1969@@ -68,10 +68,12 @@ alias gc!='git commit -v --amend'
1970 alias gca='git commit -v -a'
1971 alias gca!='git commit -v -a --amend'
1972 alias gcan!='git commit -v -a -s --no-edit --amend'
1973+alias gcam='git commit -a -m'
1974 alias gcb='git checkout -b'
1975 alias gcf='git config --list'
1976 alias gcl='git clone --recursive'
1977-alias gclean='git reset --hard && git clean -dfx'
1978+alias gclean='git clean -fd'
1979+alias gpristine='git reset --hard && git clean -dfx'
1980 alias gcm='git checkout master'
1981 alias gcmsg='git commit -m'
1982 alias gco='git checkout'
1983@@ -82,6 +84,7 @@ alias gcs='git commit -S'
1984
1985 alias gd='git diff'
1986 alias gdca='git diff --cached'
1987+alias gdct='git describe --tags `git rev-list --tags --max-count=1`'
1988 alias gdt='git diff-tree --no-commit-id --name-only -r'
1989 gdv() { git diff -w "$@" | view - }
1990 compdef _git gdv=git-diff
1991diff --git a/plugins/gnu-utils/gnu-utils.plugin.zsh b/plugins/gnu-utils/gnu-utils.plugin.zsh
1992index e59265d664fa6f0022c52d2791bcf78a84d2b793..de95f7e6c0824a736fccdcb8fa4f23a576db6823 100644
1993--- a/plugins/gnu-utils/gnu-utils.plugin.zsh
1994+++ b/plugins/gnu-utils/gnu-utils.plugin.zsh
1995@@ -29,7 +29,10 @@ if [[ -x "${commands[gwhoami]}" ]]; then
1996 'gunexpand' 'guniq' 'gunlink' 'guptime' 'gusers' 'gvdir' 'gwc' 'gwho'
1997 'gwhoami' 'gyes')
1998
1999- # Not part of coreutils, installed separately.
2000+ # findutils
2001+ gcmds+=('gfind' 'gxargs' 'glocate')
2002+
2003+ # Not part of either coreutils or findutils, installed separately.
2004 gcmds+=('gsed' 'gtar' 'gtime')
2005
2006 for gcmd in "${gcmds[@]}"; do
2007diff --git a/plugins/golang/golang.plugin.zsh b/plugins/golang/golang.plugin.zsh
2008index 900fc630dbe3c346ea014588ad854d3f97c80864..1ce3cea58e861e6540509143d1e3f1913056177e 100644
2009--- a/plugins/golang/golang.plugin.zsh
2010+++ b/plugins/golang/golang.plugin.zsh
2011@@ -54,23 +54,42 @@ __go_tool_complete() {
2012 '-installsuffix[suffix to add to package directory]:suffix'
2013 '-tags[list of build tags to consider satisfied]:tags'
2014 )
2015- __go_list() {
2016- local expl importpaths
2017- declare -a importpaths
2018- importpaths=($(go list ${words[$CURRENT]}... 2>/dev/null))
2019- _wanted importpaths expl 'import paths' compadd "$@" - "${importpaths[@]}"
2020+ __go_packages() {
2021+ local gopaths
2022+ declare -a gopaths
2023+ gopaths=("${(s/:/)$(go env GOPATH)}")
2024+ gopaths+=("$(go env GOROOT)")
2025+ for p in $gopaths; do
2026+ _path_files -W "$p/src" -/
2027+ done
2028+ }
2029+ __go_identifiers() {
2030+ compadd $(godoc -templates $ZSH/plugins/golang/templates ${words[-2]} 2> /dev/null)
2031 }
2032 case ${words[2]} in
2033- clean|doc)
2034- _arguments -s -w : '*:importpaths:__go_list'
2035+ doc)
2036+ _arguments -s -w \
2037+ "-c[symbol matching honors case (paths not affected)]" \
2038+ "-cmd[show symbols with package docs even if package is a command]" \
2039+ "-u[show unexported symbols as well as exported]" \
2040+ "2:importpaths:__go_packages" \
2041+ ":next identifiers:__go_identifiers"
2042+ ;;
2043+ clean)
2044+ _arguments -s -w \
2045+ "-i[remove the corresponding installed archive or binary (what 'go install' would create)]" \
2046+ "-n[print the remove commands it would execute, but not run them]" \
2047+ "-r[apply recursively to all the dependencies of the packages named by the import paths]" \
2048+ "-x[print remove commands as it executes them]" \
2049+ "*:importpaths:__go_packages"
2050 ;;
2051 fix|fmt|list|vet)
2052- _alternative ':importpaths:__go_list' ':files:_path_files -g "*.go"'
2053+ _alternative ':importpaths:__go_packages' ':files:_path_files -g "*.go"'
2054 ;;
2055 install)
2056 _arguments -s -w : ${build_flags[@]} \
2057 "-v[show package names]" \
2058- '*:importpaths:__go_list'
2059+ '*:importpaths:__go_packages'
2060 ;;
2061 get)
2062 _arguments -s -w : \
2063@@ -81,7 +100,7 @@ __go_tool_complete() {
2064 ${build_flags[@]} \
2065 "-v[show package names]" \
2066 "-o[output file]:file:_files" \
2067- "*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }"
2068+ "*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }"
2069 ;;
2070 test)
2071 _arguments -s -w : \
2072@@ -103,7 +122,7 @@ __go_tool_complete() {
2073 "-cpuprofile[write CPU profile to file]:file:_files" \
2074 "-memprofile[write heap profile to file]:file:_files" \
2075 "-memprofilerate[set heap profiling rate]:number" \
2076- "*:args:{ _alternative ':importpaths:__go_list' ':files:_path_files -g \"*.go\"' }"
2077+ "*:args:{ _alternative ':importpaths:__go_packages' ':files:_path_files -g \"*.go\"' }"
2078 ;;
2079 help)
2080 _values "${commands[@]}" \
2081diff --git a/plugins/golang/templates/package.txt b/plugins/golang/templates/package.txt
2082new file mode 100644
2083index 0000000000000000000000000000000000000000..2b75cce35d43b2cf93883d9c278a104b1bde71b0
2084--- /dev/null
2085+++ b/plugins/golang/templates/package.txt
2086@@ -0,0 +1,29 @@
2087+{{with .PDoc}}{{/*
2088+
2089+Constants
2090+---------------------------------------
2091+
2092+*/}}{{with .Consts}}{{range .}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{/*
2093+
2094+Variables
2095+---------------------------------------
2096+
2097+*/}}{{with .Vars}}{{range .}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{/*
2098+
2099+Functions
2100+---------------------------------------
2101+
2102+*/}}{{with .Funcs}}{{range .}}{{ .Name }} {{end}}{{end}}{{/*
2103+
2104+Types
2105+---------------------------------------
2106+
2107+*/}}{{with .Types}}{{range .}}{{ $TypeName := .Name }}{{ $TypeName }} {{/*
2108+
2109+*/}}{{range .Methods}}{{ $TypeName }}.{{.Name}} {{end}}{{/*
2110+
2111+*/}}{{range .Funcs}}{{.Name}} {{end}}{{/*
2112+
2113+*/}}{{range .Consts}}{{range .Names}}{{.}} {{end}}{{end}}{{/*
2114+
2115+*/}}{{range .Vars}}{{range .Names}}{{.}} {{end}}{{end}}{{end}}{{end}}{{end}}