Merge branch 'master' into clipboard
This commit is contained in:
@@ -54,7 +54,7 @@ function detect-clipboard() {
|
||||
if [[ "${OSTYPE}" == darwin* ]] && (( ${+commands[pbcopy]} )) && (( ${+commands[pbpaste]} )); then
|
||||
function clipcopy() { pbcopy < "${1:-/dev/stdin}"; }
|
||||
function clippaste() { pbpaste; }
|
||||
elif [[ "${OSTYPE}" == cygwin* ]]; then
|
||||
elif [[ "${OSTYPE}" == (cygwin|msys)* ]]; then
|
||||
function clipcopy() { cat "${1:-/dev/stdin}" > /dev/clipboard; }
|
||||
function clippaste() { cat /dev/clipboard; }
|
||||
elif [ -n "${WAYLAND_DISPLAY:-}" ] && (( ${+commands[wl-copy]} )) && (( ${+commands[wl-paste]} )); then
|
||||
|
||||
@@ -71,3 +71,6 @@ if [[ $COMPLETION_WAITING_DOTS = true ]]; then
|
||||
zle -N expand-or-complete-with-dots
|
||||
bindkey "^I" expand-or-complete-with-dots
|
||||
fi
|
||||
|
||||
# automatically load bash completion functions
|
||||
autoload -Uz bashcompinit && bashcompinit
|
||||
|
||||
@@ -3,11 +3,12 @@ function zsh_stats() {
|
||||
}
|
||||
|
||||
function uninstall_oh_my_zsh() {
|
||||
env ZSH=$ZSH sh $ZSH/tools/uninstall.sh
|
||||
env ZSH="$ZSH" sh "$ZSH/tools/uninstall.sh"
|
||||
}
|
||||
|
||||
function upgrade_oh_my_zsh() {
|
||||
env ZSH=$ZSH sh $ZSH/tools/upgrade.sh
|
||||
env ZSH="$ZSH" sh "$ZSH/tools/upgrade.sh"
|
||||
rm -rf "$ZSH/log/update.lock"
|
||||
}
|
||||
|
||||
function take() {
|
||||
@@ -21,7 +22,7 @@ function open_command() {
|
||||
case "$OSTYPE" in
|
||||
darwin*) open_cmd='open' ;;
|
||||
cygwin*) open_cmd='cygstart' ;;
|
||||
linux*) ! [[ $(uname -a) =~ "Microsoft" ]] && open_cmd='xdg-open' || {
|
||||
linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || {
|
||||
open_cmd='cmd.exe /c start ""'
|
||||
[[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
|
||||
} ;;
|
||||
@@ -31,12 +32,7 @@ function open_command() {
|
||||
;;
|
||||
esac
|
||||
|
||||
# don't use nohup on OSX
|
||||
if [[ "$OSTYPE" == darwin* ]]; then
|
||||
${=open_cmd} "$@" &>/dev/null
|
||||
else
|
||||
nohup ${=open_cmd} "$@" &>/dev/null
|
||||
fi
|
||||
${=open_cmd} "$@" &>/dev/null
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
21
lib/git.zsh
21
lib/git.zsh
@@ -12,11 +12,21 @@ function git_prompt_info() {
|
||||
function parse_git_dirty() {
|
||||
local STATUS
|
||||
local -a FLAGS
|
||||
FLAGS=('--porcelain' '--ignore-submodules=dirty')
|
||||
FLAGS=('--porcelain')
|
||||
if [[ "$(command git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
|
||||
if [[ "$DISABLE_UNTRACKED_FILES_DIRTY" == "true" ]]; then
|
||||
FLAGS+='--untracked-files=no'
|
||||
fi
|
||||
case "$GIT_STATUS_IGNORE_SUBMODULES" in
|
||||
git)
|
||||
# let git decide (this respects per-repo config in .gitmodules)
|
||||
;;
|
||||
*)
|
||||
# if unset: ignore dirty submodules
|
||||
# other values are passed to --ignore-submodules
|
||||
FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
|
||||
;;
|
||||
esac
|
||||
STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
|
||||
fi
|
||||
if [[ -n $STATUS ]]; then
|
||||
@@ -189,3 +199,12 @@ function git_current_user_name() {
|
||||
function git_current_user_email() {
|
||||
command git config user.email 2>/dev/null
|
||||
}
|
||||
|
||||
# Output the name of the root directory of the git repository
|
||||
# Usage example: $(git_repo_name)
|
||||
function git_repo_name() {
|
||||
local repo_path
|
||||
if repo_path="$(git rev-parse --show-toplevel 2>/dev/null)" && [[ -n "$repo_path" ]]; then
|
||||
echo ${repo_path:t}
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ env_default 'PAGER' 'less'
|
||||
env_default 'LESS' '-R'
|
||||
|
||||
## super user alias
|
||||
alias _='sudo'
|
||||
alias _='sudo '
|
||||
|
||||
## more intelligent acking for ubuntu users
|
||||
if which ack-grep &> /dev/null; then
|
||||
@@ -31,10 +31,5 @@ else
|
||||
alias afind='ack -il'
|
||||
fi
|
||||
|
||||
# only define LC_CTYPE if undefined
|
||||
if [[ -z "$LC_CTYPE" && -z "$LC_ALL" ]]; then
|
||||
export LC_CTYPE=${LANG%%:*} # pick the first entry from LANG
|
||||
fi
|
||||
|
||||
# recognize comments
|
||||
setopt interactivecomments
|
||||
|
||||
@@ -75,8 +75,9 @@ function omz_termsupport_preexec {
|
||||
title '$CMD' '%100>...>$LINE%<<'
|
||||
}
|
||||
|
||||
precmd_functions+=(omz_termsupport_precmd)
|
||||
preexec_functions+=(omz_termsupport_preexec)
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook precmd omz_termsupport_precmd
|
||||
add-zsh-hook preexec omz_termsupport_preexec
|
||||
|
||||
|
||||
# Keep Apple Terminal.app's current working directory updated
|
||||
@@ -99,7 +100,7 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
|
||||
}
|
||||
|
||||
# Use a precmd hook instead of a chpwd hook to avoid contaminating output
|
||||
precmd_functions+=(update_terminalapp_cwd)
|
||||
add-zsh-hook precmd update_terminalapp_cwd
|
||||
# Run once to get initial cwd set
|
||||
update_terminalapp_cwd
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user