diff options
author | Tuowen Zhao <ztuowen@gmail.com> | 2020-02-12 18:07:38 -0700 |
---|---|---|
committer | Tuowen Zhao <ztuowen@gmail.com> | 2020-02-12 18:07:38 -0700 |
commit | 93a2003db7738e2255a4589ef2073df1be34fe02 (patch) | |
tree | c2f6b378ffae6d4f433acf2a1931d1cc1f3f0574 /lib | |
parent | 891ef3d57b6d5e38e10c0894c3d956416adc95e2 (diff) | |
parent | a6df94d2c677c6d28c5ee339975b7a56a2f67e21 (diff) | |
download | zsh-93a2003db7738e2255a4589ef2073df1be34fe02.tar.gz zsh-93a2003db7738e2255a4589ef2073df1be34fe02.tar.bz2 zsh-93a2003db7738e2255a4589ef2073df1be34fe02.zip |
Merge branch 'master' of https://github.com/ohmyzsh/ohmyzsh
Diffstat (limited to 'lib')
-rw-r--r-- | lib/clipboard.zsh | 4 | ||||
-rw-r--r-- | lib/completion.zsh | 3 | ||||
-rw-r--r-- | lib/git.zsh | 9 |
3 files changed, 14 insertions, 2 deletions
diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh index 2c93d1bb5..5bba11d16 100644 --- a/lib/clipboard.zsh +++ b/lib/clipboard.zsh @@ -24,7 +24,7 @@ function clipcopy() { else cat $file | pbcopy fi - elif [[ $OSTYPE == cygwin* ]]; then + elif [[ $OSTYPE == (cygwin|msys)* ]]; then if [[ -z $file ]]; then cat > /dev/clipboard else @@ -71,7 +71,7 @@ function clippaste() { emulate -L zsh if [[ $OSTYPE == darwin* ]]; then pbpaste - elif [[ $OSTYPE == cygwin* ]]; then + elif [[ $OSTYPE == (cygwin|msys)* ]]; then cat /dev/clipboard else if (( $+commands[xclip] )); then diff --git a/lib/completion.zsh b/lib/completion.zsh index c7db2eb7b..c932bc925 100644 --- a/lib/completion.zsh +++ b/lib/completion.zsh @@ -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 diff --git a/lib/git.zsh b/lib/git.zsh index 2054fe272..00cb00b19 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -199,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 +} |