mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-14 22:47:45 +08:00
Compare commits
4 Commits
6101106916
...
115cee1701
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
115cee1701 | ||
|
|
d1c64bfda3 | ||
|
|
b36c90d9ab | ||
|
|
62ab5406dd |
@ -1,10 +1,12 @@
|
||||
# You can put files here to add functionality separated per file, which
|
||||
# will be ignored by git.
|
||||
# Files on the custom/ directory will be automatically loaded by the init
|
||||
# script, in alphabetical order.
|
||||
|
||||
# For example: add yourself some shortcuts to projects you often work on.
|
||||
#
|
||||
# Put files in this folder to add your own custom functionality.
|
||||
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization
|
||||
#
|
||||
# Files in the custom/ directory will be:
|
||||
# - loaded automatically by the init script, in alphabetical order
|
||||
# - loaded last, after all built-ins in the lib/ directory, to override them
|
||||
# - ignored by git by default
|
||||
#
|
||||
# Example: add custom/shortcuts.zsh for shortcuts to your local projects
|
||||
#
|
||||
# brainstormr=~/Projects/development/planetargon/brainstormr
|
||||
# cd $brainstormr
|
||||
#
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
# 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.
|
||||
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-plugins
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
# Put your custom themes in this folder.
|
||||
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes
|
||||
#
|
||||
# Example:
|
||||
|
||||
PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "
|
||||
|
||||
@ -17,9 +17,13 @@ if ! type autoenv_init >/dev/null; then
|
||||
/usr/local/bin
|
||||
/usr/share/autoenv-git
|
||||
~/Library/Python/bin
|
||||
.venv/bin
|
||||
venv/bin
|
||||
env/bin
|
||||
.env/bin
|
||||
)
|
||||
for d ( $install_locations ); do
|
||||
if [[ -e $d/activate.sh ]]; then
|
||||
if [[ -e $d/activate || -e $d/activate.sh ]]; then
|
||||
autoenv_dir=$d
|
||||
break
|
||||
fi
|
||||
@ -29,13 +33,13 @@ if ! type autoenv_init >/dev/null; then
|
||||
# Look for Homebrew path as a last resort
|
||||
if [[ -z "$autoenv_dir" ]] && (( $+commands[brew] )); then
|
||||
d=$(brew --prefix)/opt/autoenv
|
||||
if [[ -e $d/activate.sh ]]; then
|
||||
if [[ -e $d/activate || -e $d/activate.sh ]]; then
|
||||
autoenv_dir=$d
|
||||
fi
|
||||
fi
|
||||
|
||||
# Complain if autoenv is not installed
|
||||
if [[ -z $autoenv_dir ]]; then
|
||||
if [[ -z $autoenv_dir ]]; then
|
||||
cat <<END >&2
|
||||
-------- AUTOENV ---------
|
||||
Could not locate autoenv installation.
|
||||
@ -46,7 +50,11 @@ END
|
||||
return 1
|
||||
fi
|
||||
# Load autoenv
|
||||
source $autoenv_dir/activate.sh
|
||||
if [[ -e $autoenv_dir/activate ]]; then
|
||||
source $autoenv_dir/activate
|
||||
else
|
||||
source $autoenv_dir/activate.sh
|
||||
fi
|
||||
fi
|
||||
}
|
||||
[[ $? != 0 ]] && return $?
|
||||
|
||||
@ -254,6 +254,7 @@ These features allow to pause a branch development and switch to another one (_"
|
||||
| work_in_progress | Echoes a warning if the current branch is a wip |
|
||||
| gwip | Commit wip branch |
|
||||
| gunwip | Uncommit wip branch |
|
||||
| gunwipall | Uncommit `--wip--` commits recursively |
|
||||
|
||||
### Deprecated functions
|
||||
|
||||
|
||||
@ -27,6 +27,20 @@ function work_in_progress() {
|
||||
command git -c log.showSignature=false log -n 1 2>/dev/null | grep -q -- "--wip--" && echo "WIP!!"
|
||||
}
|
||||
|
||||
# Same as `gunwip` but recursive
|
||||
# "Unwips" all recent `--wip--` commits in loop until there is no left
|
||||
function gunwipall() {
|
||||
while true; do
|
||||
commit_message=$(git rev-list --max-count=1 --format="%s" HEAD)
|
||||
if [[ $commit_message =~ "--wip--" ]]; then
|
||||
git reset "HEAD~1"
|
||||
(( $? )) && return 1
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Check if main exists and use instead of master
|
||||
function git_main_branch() {
|
||||
command git rev-parse --git-dir &>/dev/null || return
|
||||
|
||||
Loading…
Reference in New Issue
Block a user