mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-17 04:29:14 +02:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
80cea3638a
15 changed files with 69 additions and 62 deletions
|
|
@ -87,7 +87,7 @@ fi
|
|||
|
||||
# zsh is able to auto-do some kungfoo
|
||||
# depends on the SUFFIX :)
|
||||
if [ ${ZSH_VERSION//\./} -ge 420 ]; then
|
||||
if is-at-least 4.2.0; then
|
||||
# open browser on urls
|
||||
_browser_fts=(htm html de org net com at cx nl se dk dk php)
|
||||
for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
|
||||
# Composer basic command completion
|
||||
_composer_get_command_list () {
|
||||
$_comp_command1 --no-ansi | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
|
||||
$_comp_command1 --no-ansi 2>/dev/null | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
|
||||
}
|
||||
|
||||
_composer_get_required_list () {
|
||||
$_comp_command1 show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
|
||||
$_comp_command1 show -s --no-ansi 2>/dev/null | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
|
||||
}
|
||||
|
||||
_composer () {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ function extract() {
|
|||
(*.xz) unxz "$1" ;;
|
||||
(*.lzma) unlzma "$1" ;;
|
||||
(*.Z) uncompress "$1" ;;
|
||||
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw) unzip "$1" -d $extract_dir ;;
|
||||
(*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk) unzip "$1" -d $extract_dir ;;
|
||||
(*.rar) unrar x -ad "$1" ;;
|
||||
(*.7z) 7za x "$1" ;;
|
||||
(*.deb)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
# To achieve git-flow completion nirvana:
|
||||
#
|
||||
# 0. Update your zsh's git-completion module to the newest version.
|
||||
# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD
|
||||
# From here. https://raw.githubusercontent.com/zsh-users/zsh/master/Completion/Unix/Command/_git
|
||||
#
|
||||
# 1. Install this file. Either:
|
||||
#
|
||||
|
|
|
|||
|
|
@ -13,11 +13,14 @@ fi
|
|||
|
||||
|
||||
# Bind terminal-specific up and down keys
|
||||
|
||||
# Bind in both emacs and vi modes so it works in both, and is not
|
||||
# sensitive to whether this is loaded before or after the vi-mode plugin
|
||||
if [[ -n "$terminfo[kcuu1]" ]]; then
|
||||
bindkey "$terminfo[kcuu1]" history-substring-search-up
|
||||
bindkey -M emacs "$terminfo[kcuu1]" history-substring-search-up
|
||||
bindkey -M viins "$terminfo[kcuu1]" history-substring-search-up
|
||||
fi
|
||||
if [[ -n "$terminfo[kcud1]" ]]; then
|
||||
bindkey "$terminfo[kcud1]" history-substring-search-down
|
||||
bindkey -M emacs "$terminfo[kcud1]" history-substring-search-down
|
||||
bindkey -M viins "$terminfo[kcud1]" history-substring-search-down
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -76,10 +76,12 @@ cat >> $plugin_basename.plugin.zsh <<EOF
|
|||
# Bind terminal-specific up and down keys
|
||||
|
||||
if [[ -n "\$terminfo[kcuu1]" ]]; then
|
||||
bindkey "\$terminfo[kcuu1]" history-substring-search-up
|
||||
bindkey -M emacs "\$terminfo[kcuu1]" history-substring-search-up
|
||||
bindkey -M viins "\$terminfo[kcuu1]" history-substring-search-up
|
||||
fi
|
||||
if [[ -n "\$terminfo[kcud1]" ]]; then
|
||||
bindkey "\$terminfo[kcud1]" history-substring-search-down
|
||||
bindkey -M emacs "\$terminfo[kcud1]" history-substring-search-down
|
||||
bindkey -M viins "\$terminfo[kcud1]" history-substring-search-down
|
||||
fi
|
||||
|
||||
EOF
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ alias hgo='hg outgoing'
|
|||
alias hgp='hg push'
|
||||
alias hgs='hg status'
|
||||
alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n" '
|
||||
# this is the 'git commit --amend' equivalent
|
||||
alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip'
|
||||
alias hgca='hg commit --amend'
|
||||
# list unresolved files (since hg does not list unmerged files in the status command)
|
||||
alias hgun='hg resolve --list'
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ function web_search() {
|
|||
yandex "https://yandex.ru/yandsearch?text="
|
||||
github "https://github.com/search?q="
|
||||
baidu "https://www.baidu.com/s?wd="
|
||||
ecosia "https://www.ecosia.org/search?q="
|
||||
)
|
||||
|
||||
# check whether the search engine is supported
|
||||
|
|
@ -43,6 +44,7 @@ alias ddg='web_search duckduckgo'
|
|||
alias yandex='web_search yandex'
|
||||
alias github='web_search github'
|
||||
alias baidu='web_search baidu'
|
||||
alias ecosia='web_search ecosia'
|
||||
|
||||
#add your own !bang searches here
|
||||
alias wiki='web_search duckduckgo \!w'
|
||||
|
|
|
|||
|
|
@ -105,8 +105,7 @@ colorize output of the tools, via their config files (check out e.g. n-cd.conf,
|
|||
it uses this).
|
||||
|
||||
## Performance
|
||||
ZNT are fastest with Zsh before 5.0.8 and starting from 5.2 (the version yet to
|
||||
be released).
|
||||
ZNT are fastest with Zsh before 5.0.8 and starting from 5.2
|
||||
|
||||
|
||||
vim:filetype=conf
|
||||
|
|
|
|||
|
|
@ -116,15 +116,15 @@ _nlist_setup_user_vars() {
|
|||
fi
|
||||
}
|
||||
|
||||
_nlist_coloring_list_into_col_list() {
|
||||
_nlist_colorify_disp_list() {
|
||||
local col=$'\x1b[00;34m' reset=$'\x1b[0m'
|
||||
[ -n "$NLIST_COLORING_COLOR" ] && col="$NLIST_COLORING_COLOR"
|
||||
[ -n "$NLIST_COLORING_END_COLOR" ] && reset="$NLIST_COLORING_END_COLOR"
|
||||
|
||||
if [ "$NLIST_COLORING_MATCH_MULTIPLE" -eq 1 ]; then
|
||||
col_list=( "${(@)list//(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" )
|
||||
disp_list=( "${(@)disp_list//(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" )
|
||||
else
|
||||
col_list=( "${(@)list/(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" )
|
||||
disp_list=( "${(@)disp_list/(#mi)$~NLIST_COLORING_PATTERN/$col${MATCH}$reset}" )
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -154,7 +154,7 @@ integer inner_width=term_width-3
|
|||
integer page_height=inner_height
|
||||
integer page_width=inner_width
|
||||
|
||||
typeset -a list col_list disp_list
|
||||
typeset -a list disp_list
|
||||
integer last_element=$#
|
||||
local action
|
||||
local final_key
|
||||
|
|
@ -224,19 +224,17 @@ zcurses timeout main -1
|
|||
key=""
|
||||
keypad=""
|
||||
|
||||
list=( "$@" )
|
||||
last_element="$#list"
|
||||
# This loop makes script faster on some Zsh's (e.g. 5.0.8)
|
||||
repeat 1; do
|
||||
list=( "$@" )
|
||||
done
|
||||
|
||||
integer is_colored=0
|
||||
if [[ -z "$NLIST_SEARCH_BUFFER" && -n "$NLIST_COLORING_PATTERN" ]]; then
|
||||
is_colored=1
|
||||
_nlist_coloring_list_into_col_list
|
||||
fi
|
||||
last_element="$#list"
|
||||
|
||||
while (( 1 )); do
|
||||
# Do searching (filtering with string)
|
||||
if [ -n "$NLIST_SEARCH_BUFFER" ]; then
|
||||
# Compute new list, col_list ?
|
||||
# Compute new list?
|
||||
if [[ "$NLIST_SEARCH_BUFFER" != "$prev_search_buffer" || "$NLIST_IS_UNIQ_MODE" -ne "$prev_uniq_mode" ]]; then
|
||||
prev_search_buffer="$NLIST_SEARCH_BUFFER"
|
||||
prev_uniq_mode="$NLIST_IS_UNIQ_MODE"
|
||||
|
|
@ -290,7 +288,7 @@ while (( 1 )); do
|
|||
disp_list=( "${(@)disp_list//(#mi)($~colsearch_pattern)/$red${MATCH}$reset}" )
|
||||
fi
|
||||
|
||||
# We have display list, lets replace newlines with "\n" when needed (1/3)
|
||||
# We have display list, lets replace newlines with "\n" when needed (1/2)
|
||||
[ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" )
|
||||
fi
|
||||
|
||||
|
|
@ -302,7 +300,7 @@ while (( 1 )); do
|
|||
# There is no search, but there was in previous loop
|
||||
# OR
|
||||
# Uniq mode was entered or left out
|
||||
# -> compute new list (maybe also col_list)
|
||||
# -> compute new list
|
||||
if [[ -n "$prev_search_buffer" || "$NLIST_IS_UNIQ_MODE" -ne "$prev_uniq_mode" ]]; then
|
||||
prev_search_buffer=""
|
||||
prev_uniq_mode="$NLIST_IS_UNIQ_MODE"
|
||||
|
|
@ -322,13 +320,6 @@ while (( 1 )); do
|
|||
# Remove duplicates when in uniq mode
|
||||
[ "$NLIST_IS_UNIQ_MODE" -eq 1 ] && typeset -U list
|
||||
|
||||
# Apply coloring pattern (when not with search query)
|
||||
is_colored=0
|
||||
if [ -n "$NLIST_COLORING_PATTERN" ]; then
|
||||
is_colored=1
|
||||
_nlist_coloring_list_into_col_list
|
||||
fi
|
||||
|
||||
last_element="$#list"
|
||||
# Called after processing list
|
||||
_nlist_verify_vars
|
||||
|
|
@ -340,22 +331,14 @@ while (( 1 )); do
|
|||
integer end_idx=$(( NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN + page_height - 1 ))
|
||||
[ "$end_idx" -gt "$last_element" ] && end_idx=last_element
|
||||
|
||||
if [ "$is_colored" -eq 0 ]; then
|
||||
if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then
|
||||
prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN"
|
||||
disp_list=( "${(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" )
|
||||
if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then
|
||||
prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN"
|
||||
disp_list=( "${(@)list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" )
|
||||
|
||||
# We have display list, lets replace newlines with "\n" when needed (2/3)
|
||||
[ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" )
|
||||
fi
|
||||
else
|
||||
if [ "$prev_start_idx" -ne "$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN" ]; then
|
||||
prev_start_idx="$NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN"
|
||||
disp_list=( "${(@)col_list[NLIST_FROM_WHAT_IDX_LIST_IS_SHOWN, end_idx]}" )
|
||||
[ -n "$NLIST_COLORING_PATTERN" ] && _nlist_colorify_disp_list
|
||||
|
||||
# We have display list, lets replace newlines with "\n" when needed (3/3)
|
||||
[ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" )
|
||||
fi
|
||||
# We have display list, lets replace newlines with "\n" when needed (2/2)
|
||||
[ "$NLIST_REPLACE_NEWLINES" -eq 1 ] && disp_list=( "${(@)disp_list//$'\n'/\\n}" )
|
||||
fi
|
||||
|
||||
# Output the list
|
||||
|
|
@ -380,6 +363,11 @@ while (( 1 )); do
|
|||
fi
|
||||
|
||||
zcurses border main
|
||||
|
||||
local top_msg="${(C)ZSH_NAME} $ZSH_VERSION, shell level $SHLVL, $USER"
|
||||
zcurses move main 0 $(( term_width / 2 - $#top_msg / 2 ))
|
||||
zcurses string main $top_msg
|
||||
|
||||
zcurses refresh main inner
|
||||
zcurses move main $(( term_height - 1 - 1 )) $(( status_msg_strlen + 2 ))
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,11 @@ if [ -t 0 ]; then
|
|||
return 1
|
||||
fi
|
||||
|
||||
list=( `"$@"` )
|
||||
# This loop makes script faster on some Zsh's (e.g. 5.0.8)
|
||||
repeat 1; do
|
||||
list=( `"$@"` )
|
||||
done
|
||||
|
||||
# TODO: $? doesn't reach user
|
||||
[ "$?" -eq 127 ] && return $?
|
||||
else
|
||||
|
|
@ -42,7 +46,10 @@ else
|
|||
return 1
|
||||
fi
|
||||
|
||||
list=( "${(@f)"$(<&0)"}" )
|
||||
# This loop makes script faster on some Zsh's (e.g. 5.0.8)
|
||||
repeat 1; do
|
||||
list=( "${(@f)"$(<&0)"}" )
|
||||
done
|
||||
|
||||
if [[ ! -c /dev/tty ]]; then
|
||||
exec <&2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue