mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Merge remote-tracking branch 'sjl/master'
Conflicts: .gitignore lib/directories.zsh lib/functions.zsh lib/git.zsh templates/zshrc.zsh-template
This commit is contained in:
commit
2f046e7e4a
9 changed files with 36 additions and 64 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
|
@ -1,7 +1,9 @@
|
|||
locals.zsh
|
||||
log/.zsh_history
|
||||
projects.zsh
|
||||
custom/*
|
||||
!custom/example
|
||||
!custom/example.zsh
|
||||
custom
|
||||
custom/*.zsh
|
||||
*.un~
|
||||
cache
|
||||
|
||||
.DS_Store
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
# Add your own custom plugins in the custom/plugins directory. Plugins placed
|
||||
# here will override ones with the same name in the main plugins directory.
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
# Push and pop directories on directory stack
|
||||
alias pu='pushd'
|
||||
alias po='popd'
|
||||
|
||||
# Basic directory operations
|
||||
alias ...='cd ../..'
|
||||
alias -- -='cd -'
|
||||
|
||||
# Super user
|
||||
alias _='sudo'
|
||||
|
||||
#alias g='grep -in'
|
||||
|
||||
# Show history
|
||||
alias history='fc -l 1'
|
||||
|
||||
# List direcory contents
|
||||
alias lsa='ls -lah'
|
||||
alias l='ls -la'
|
||||
alias ll='ls -l'
|
||||
alias sl=ls # often screw this up
|
||||
|
||||
alias afind='ack-grep -il'
|
||||
|
||||
alias x=extract
|
||||
|
|
@ -28,13 +28,6 @@ alias md='mkdir -p'
|
|||
alias rd=rmdir
|
||||
alias d='dirs -v'
|
||||
|
||||
# mkdir & cd to it
|
||||
function mcd() {
|
||||
mkdir -p "$1" && cd "$1";
|
||||
}
|
||||
|
||||
alias d='dirs -v'
|
||||
|
||||
# List direcory contents
|
||||
alias l1='tree --dirsfirst -ChFL 1'
|
||||
alias l2='tree --dirsfirst -ChFL 2'
|
||||
|
|
@ -46,3 +39,8 @@ alias ll3='tree --dirsfirst -ChFupDaL 3'
|
|||
|
||||
alias l='l1'
|
||||
alias ll='ll1'
|
||||
|
||||
# mkdir & cd to it
|
||||
function mcd() {
|
||||
mkdir -p "$1" && cd "$1";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,6 @@ function upgrade_oh_my_zsh() {
|
|||
/bin/sh $ZSH/tools/upgrade.sh
|
||||
}
|
||||
|
||||
function take() {
|
||||
mkdir -p $1
|
||||
cd $1
|
||||
}
|
||||
|
||||
function extract() {
|
||||
unset REMOVE_ARCHIVE
|
||||
|
||||
|
|
|
|||
28
lib/git.zsh
28
lib/git.zsh
|
|
@ -4,12 +4,19 @@ function git_prompt_info() {
|
|||
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
}
|
||||
|
||||
# Checks if working tree is dirty
|
||||
parse_git_dirty() {
|
||||
if [[ -n $(git status -s 2> /dev/null) ]]; then
|
||||
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||
else
|
||||
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
parse_git_dirty () {
|
||||
gitstat=$(git status 2>/dev/null | grep '\(# Untracked\|# Changes\|# Changed but not updated:\)')
|
||||
|
||||
if [[ $(echo ${gitstat} | grep -c "^# Changes to be committed:$") > 0 ]]; then
|
||||
echo -n "$ZSH_THEME_GIT_PROMPT_DIRTY"
|
||||
fi
|
||||
|
||||
if [[ $(echo ${gitstat} | grep -c "^\(# Untracked files:\|# Changed but not updated:\)$") > 0 ]]; then
|
||||
echo -n "$ZSH_THEME_GIT_PROMPT_UNTRACKED"
|
||||
fi
|
||||
|
||||
if [[ $(echo ${gitstat} | grep -v '^$' | wc -l | tr -d ' ') == 0 ]]; then
|
||||
echo -n "$ZSH_THEME_GIT_PROMPT_CLEAN"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -20,6 +27,15 @@ function git_prompt_ahead() {
|
|||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Will return the current branch name
|
||||
# Usage example: git pull origin $(current_branch)
|
||||
#
|
||||
function current_branch() {
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
|
||||
echo ${ref#refs/heads/}
|
||||
}
|
||||
|
||||
# Formats prompt string for current git commit short SHA
|
||||
function git_prompt_short_sha() {
|
||||
SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"
|
||||
|
|
|
|||
|
|
@ -25,21 +25,6 @@ bindkey "^[[3~" delete-char
|
|||
bindkey "^[3;5~" delete-char
|
||||
bindkey "\e[3~" delete-char
|
||||
|
||||
# consider emacs keybindings:
|
||||
|
||||
#bindkey -e ## emacs key bindings
|
||||
#
|
||||
#bindkey '^[[A' up-line-or-search
|
||||
#bindkey '^[[B' down-line-or-search
|
||||
#bindkey '^[^[[C' emacs-forward-word
|
||||
#bindkey '^[^[[D' emacs-backward-word
|
||||
#
|
||||
#bindkey -s '^X^Z' '%-^M'
|
||||
#bindkey '^[e' expand-cmd-path
|
||||
#bindkey '^[^I' reverse-menu-complete
|
||||
#bindkey '^X^N' accept-and-infer-next-history
|
||||
#bindkey '^W' kill-region
|
||||
#bindkey '^I' complete-word
|
||||
## Fix weird sequence that rxvt produces
|
||||
#bindkey -s '^[[Z' '\t'
|
||||
#
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ export ZSH=$HOME/.oh-my-zsh
|
|||
# Look in ~/.oh-my-zsh/themes/
|
||||
# Optionally, if you set this to "random", it'll load a random theme each
|
||||
# time that oh-my-zsh is loaded.
|
||||
export ZSH_THEME="robbyrussell"
|
||||
export ZSH_THEME="prose"
|
||||
|
||||
# Set to this to use case-sensitive completion
|
||||
# export CASE_SENSITIVE="true"
|
||||
|
|
|
|||
|
|
@ -27,3 +27,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
|||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}"
|
||||
RPROMPT='${return_status}%{$reset_color%}'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue