mirror of https://github.com/ohmyzsh/ohmyzsh.git
Compare commits
9 Commits
5be752e741
...
4630fda3b6
Author | SHA1 | Date |
---|---|---|
mattmc3 | 4630fda3b6 | |
Abhijeet Vashistha | 028d653632 | |
Nico Just | 04cba220f7 | |
Michele Bologna | 7a3695aadf | |
Thomas | cae2e45193 | |
Carlo Sala | 276e540eed | |
Bhanu | 5c17bcd21f | |
mattmc3 | d2f071f8dd | |
mattmc3 | 440b66da14 |
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
function omz {
|
function omz {
|
||||||
|
setopt localoptions noksharrays
|
||||||
[[ $# -gt 0 ]] || {
|
[[ $# -gt 0 ]] || {
|
||||||
_omz::help
|
_omz::help
|
||||||
return 1
|
return 1
|
||||||
|
|
|
@ -65,6 +65,29 @@ If `yes`, sets the `--icons` option of `eza`, adding icons for files and folders
|
||||||
|
|
||||||
Default: `no`
|
Default: `no`
|
||||||
|
|
||||||
|
### `color-scale`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'color-scale' all|age|size
|
||||||
|
```
|
||||||
|
|
||||||
|
Highlight levels of field(s) distinctly. Use comma(,) separated list of `all`, `age`, `size`
|
||||||
|
|
||||||
|
Default: `none`
|
||||||
|
|
||||||
|
### `color-scale-mode`
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
zstyle ':omz:plugins:eza' 'color-scale-mode' gradient|fixed
|
||||||
|
```
|
||||||
|
|
||||||
|
Choose the mode for highlighting:
|
||||||
|
|
||||||
|
- `gradient` (default) -- gradient coloring
|
||||||
|
- `fixed` -- fixed coloring
|
||||||
|
|
||||||
|
Default: `gradient`
|
||||||
|
|
||||||
### `size-prefix`
|
### `size-prefix`
|
||||||
|
|
||||||
```zsh
|
```zsh
|
||||||
|
|
|
@ -34,6 +34,14 @@ function _configure_eza() {
|
||||||
if zstyle -t ':omz:plugins:eza' 'icons'; then
|
if zstyle -t ':omz:plugins:eza' 'icons'; then
|
||||||
_EZA_TAIL+=("--icons=auto")
|
_EZA_TAIL+=("--icons=auto")
|
||||||
fi
|
fi
|
||||||
|
zstyle -s ':omz:plugins:eza' 'color-scale' _val
|
||||||
|
if [[ $_val ]]; then
|
||||||
|
_EZA_TAIL+=("--color-scale=$_val")
|
||||||
|
fi
|
||||||
|
zstyle -s ':omz:plugins:eza' 'color-scale-mode' _val
|
||||||
|
if [[ $_val == (gradient|fixed) ]]; then
|
||||||
|
_EZA_TAIL+=("--color-scale-mode=$_val")
|
||||||
|
fi
|
||||||
zstyle -s ':omz:plugins:eza' 'time-style' _val
|
zstyle -s ':omz:plugins:eza' 'time-style' _val
|
||||||
if [[ $_val ]]; then
|
if [[ $_val ]]; then
|
||||||
_EZA_TAIL+=("--time-style='$_val'")
|
_EZA_TAIL+=("--time-style='$_val'")
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# git-commit plugin
|
# git-commit plugin
|
||||||
|
|
||||||
The git-commit plugin adds several
|
The git-commit plugin adds several git subcommands for
|
||||||
[git aliases](https://www.git-scm.com/docs/git-config#Documentation/git-config.txt-alias) for
|
|
||||||
[conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages.
|
[conventional commit](https://www.conventionalcommits.org/en/v1.0.0/#summary) messages.
|
||||||
|
|
||||||
To use it, add `git-commit` to the plugins array in your zshrc file:
|
To use it, add `git-commit` to the plugins array in your zshrc file:
|
||||||
|
@ -31,15 +30,13 @@ Where `type` is one of the following:
|
||||||
- `test`
|
- `test`
|
||||||
- `wip`
|
- `wip`
|
||||||
|
|
||||||
> NOTE: the alias for `revert` type is `rev`, as otherwise it conflicts with the git command of the same name.
|
> NOTE: the subcommand for `revert` type is `rev`, as otherwise it conflicts with the
|
||||||
> It will still generate a commit message in the format `revert: <message>`
|
> git command of the same name. It will still generate a commit message in the format
|
||||||
|
> `revert: <message>`
|
||||||
> ⚠️ Enabling this plugin will (potentially) overwrite all `alias.<type>` that you manually set. Use with
|
|
||||||
> care!
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
| Git alias | Command |
|
| Git subcommand | Command |
|
||||||
| --------------------------------------------- | ---------------------------------------------------- |
|
| --------------------------------------------- | ---------------------------------------------------- |
|
||||||
| `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` |
|
| `git style "remove trailing whitespace"` | `git commit -m "style: remove trailing whitespace"` |
|
||||||
| `git wip "work in progress"` | `git commit -m "work in progress"` |
|
| `git wip "work in progress"` | `git commit -m "work in progress"` |
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
./omz_git_commit
|
|
@ -0,0 +1 @@
|
||||||
|
./omz_git_commit
|
|
@ -0,0 +1 @@
|
||||||
|
./omz_git_commit
|
|
@ -0,0 +1 @@
|
||||||
|
./omz_git_commit
|
|
@ -0,0 +1 @@
|
||||||
|
./omz_git_commit
|
|
@ -0,0 +1 @@
|
||||||
|
./omz_git_commit
|
|
@ -0,0 +1 @@
|
||||||
|
./omz_git_commit
|
|
@ -0,0 +1 @@
|
||||||
|
./omz_git_commit
|
|
@ -0,0 +1 @@
|
||||||
|
./omz_git_commit
|
|
@ -0,0 +1 @@
|
||||||
|
./omz_git_commit
|
|
@ -0,0 +1 @@
|
||||||
|
./omz_git_commit
|
|
@ -0,0 +1 @@
|
||||||
|
./omz_git_commit
|
|
@ -0,0 +1,34 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
_omz_git_commit() {
|
||||||
|
0=${(%):-%x}
|
||||||
|
if [[ "$0" != */git-* ]]; then
|
||||||
|
echo >&2 "Expecting command named git-foo. Got '$0'."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local _type="${0##*/git-}"
|
||||||
|
local _scope _attention _message
|
||||||
|
while [ $# -ne 0 ]; do
|
||||||
|
case $1 in
|
||||||
|
-s | --scope )
|
||||||
|
if [ -z $2 ]; then
|
||||||
|
echo >&2 "Missing scope!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
_scope="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-a | --attention )
|
||||||
|
_attention="!"
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
_message="${_message} $1"
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
git commit -m "${_type}${_scope:+(${_scope})}${_attention}:${_message}"
|
||||||
|
}
|
||||||
|
_omz_git_commit "$@"
|
|
@ -1,58 +1,48 @@
|
||||||
local _rev="$(git -C $ZSH rev-parse HEAD 2> /dev/null)"
|
# Add git-commit commands directory to path
|
||||||
if [[ $_rev == $(git config --global --get oh-my-zsh.git-commit-alias 2> /dev/null) ]]; then
|
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||||
return
|
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||||
fi
|
path=("${0:a:h}/git-commands" $path)
|
||||||
git config --global oh-my-zsh.git-commit-alias "$_rev"
|
|
||||||
|
|
||||||
local -a _git_commit_aliases
|
# Append completions for custom git commands
|
||||||
_git_commit_aliases=(
|
() {
|
||||||
'build'
|
local -a git_user_commands
|
||||||
'chore'
|
zstyle -a ':completion:*:*:git:*' user-commands 'git_user_commands' \
|
||||||
'ci'
|
|| git_user_commands=()
|
||||||
'docs'
|
git_user_commands+=(
|
||||||
'feat'
|
build:'Commit with a message indicating a build' \
|
||||||
'fix'
|
chore:'Commit with a message indicating a chore' \
|
||||||
'perf'
|
ci:'Commit with a message indicating a CI change' \
|
||||||
'refactor'
|
docs:'Commit with a message indicating an update to the documentation' \
|
||||||
'revert'
|
feat:'Commit with a message indicating a feature' \
|
||||||
'style'
|
fix:'Commit with a message indicating a fix' \
|
||||||
'test'
|
perf:'Commit with a message indicating a performance enhancement' \
|
||||||
'wip'
|
refactor:'Commit with a message indicating a refactor' \
|
||||||
)
|
revert:'Commit with a message indicating a revert' \
|
||||||
|
style:'Commit with a message indicating a style change' \
|
||||||
|
test:'Commit with a message indicating updates to tests' \
|
||||||
|
wip:'Commit with a message indicating a work in progress'
|
||||||
|
)
|
||||||
|
zstyle ':completion:*:*:git:*' user-commands "${git_user_commands[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
local _alias _type
|
########################################################################################
|
||||||
for _type in "${_git_commit_aliases[@]}"; do
|
### Remove below after Jan 2025:
|
||||||
# an alias can't be named "revert" because the git command takes precedence
|
########################################################################################
|
||||||
# https://stackoverflow.com/a/3538791
|
# Clean up aliases from the prior implementation of git-commit. Can be safely removed
|
||||||
case "$_type" in
|
# once everyone's .gitconfig has been restored.
|
||||||
revert) _alias=rev ;;
|
() {
|
||||||
*) _alias=$_type ;;
|
git config --global --get oh-my-zsh.git-commit-alias &> /dev/null || return 0
|
||||||
esac
|
local -a old_git_aliases=(
|
||||||
|
'build' 'chore' 'ci'
|
||||||
local _func='!a() {
|
'docs' 'feat' 'fix'
|
||||||
local _scope _attention _message
|
'perf' 'refactor' 'rev'
|
||||||
while [ $# -ne 0 ]; do
|
'style' 'test' 'wip'
|
||||||
case $1 in
|
)
|
||||||
-s | --scope )
|
local git_alias
|
||||||
if [ -z $2 ]; then
|
for git_alias in $old_git_aliases; do
|
||||||
echo "Missing scope!"
|
if [[ "$(git config --global --get alias.$git_alias | tr '\n' ' ')" == "!a() { local _scope _attention _message"* ]]; then
|
||||||
return 1
|
git config --global --unset alias.$git_alias
|
||||||
fi
|
fi
|
||||||
_scope="$2"
|
done
|
||||||
shift 2
|
git config --global --unset oh-my-zsh.git-commit-alias
|
||||||
;;
|
}
|
||||||
-a | --attention )
|
|
||||||
_attention="!"
|
|
||||||
shift 1
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
_message="${_message} $1"
|
|
||||||
shift 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
git commit -m "'$_type'${_scope:+(${_scope})}${_attention}:${_message}"
|
|
||||||
}; a'
|
|
||||||
|
|
||||||
git config --global alias.$_alias "$_func"
|
|
||||||
done
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ files=(
|
||||||
/etc/grc.zsh # default
|
/etc/grc.zsh # default
|
||||||
/usr/local/etc/grc.zsh # homebrew darwin-x64
|
/usr/local/etc/grc.zsh # homebrew darwin-x64
|
||||||
/opt/homebrew/etc/grc.zsh # homebrew darwin-arm64
|
/opt/homebrew/etc/grc.zsh # homebrew darwin-arm64
|
||||||
|
/home/linuxbrew/.linuxbrew/etc/grc.zsh # linuxbrew
|
||||||
/usr/share/grc/grc.zsh # Gentoo Linux (app-misc/grc)
|
/usr/share/grc/grc.zsh # Gentoo Linux (app-misc/grc)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -22,5 +22,5 @@ fi
|
||||||
rustup completions zsh >| "$ZSH_CACHE_DIR/completions/_rustup" &|
|
rustup completions zsh >| "$ZSH_CACHE_DIR/completions/_rustup" &|
|
||||||
cat >| "$ZSH_CACHE_DIR/completions/_cargo" <<'EOF'
|
cat >| "$ZSH_CACHE_DIR/completions/_cargo" <<'EOF'
|
||||||
#compdef cargo
|
#compdef cargo
|
||||||
source "$(rustc +${${(z)$(rustup default)}[1]} --print sysroot)"/share/zsh/site-functions/_cargo
|
source "$(rustup run ${${(z)$(rustup default)}[1]} rustc --print sysroot)"/share/zsh/site-functions/_cargo
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -52,6 +52,7 @@ Available search contexts are:
|
||||||
| `gopkg` | `https://pkg.go.dev/search?m=package&q=` |
|
| `gopkg` | `https://pkg.go.dev/search?m=package&q=` |
|
||||||
| `chatgpt` | `https://chatgpt.com/?q=` |
|
| `chatgpt` | `https://chatgpt.com/?q=` |
|
||||||
| `reddit` | `https://www.reddit.com/search/?q=` |
|
| `reddit` | `https://www.reddit.com/search/?q=` |
|
||||||
|
| `ppai` | `https://www.perplexity.ai/search/new?q=` |
|
||||||
|
|
||||||
Also there are aliases for bang-searching DuckDuckGo:
|
Also there are aliases for bang-searching DuckDuckGo:
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ function web_search() {
|
||||||
gopkg "https://pkg.go.dev/search?m=package&q="
|
gopkg "https://pkg.go.dev/search?m=package&q="
|
||||||
chatgpt "https://chatgpt.com/?q="
|
chatgpt "https://chatgpt.com/?q="
|
||||||
reddit "https://www.reddit.com/search/?q="
|
reddit "https://www.reddit.com/search/?q="
|
||||||
|
ppai "https://www.perplexity.ai/search/new?q="
|
||||||
)
|
)
|
||||||
|
|
||||||
# check whether the search engine is supported
|
# check whether the search engine is supported
|
||||||
|
@ -87,6 +88,7 @@ alias packagist='web_search packagist'
|
||||||
alias gopkg='web_search gopkg'
|
alias gopkg='web_search gopkg'
|
||||||
alias chatgpt='web_search chatgpt'
|
alias chatgpt='web_search chatgpt'
|
||||||
alias reddit='web_search reddit'
|
alias reddit='web_search reddit'
|
||||||
|
alias ppai='web_search ppai'
|
||||||
|
|
||||||
#add your own !bang searches here
|
#add your own !bang searches here
|
||||||
alias wiki='web_search duckduckgo \!w'
|
alias wiki='web_search duckduckgo \!w'
|
||||||
|
|
|
@ -29,7 +29,7 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%} :"
|
||||||
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘"
|
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘"
|
||||||
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔"
|
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔"
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[103]%}✚%{$rset_color%}"
|
ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[103]%}✚%{$reset_color%}"
|
||||||
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[103]%}✹%{$reset_color%}"
|
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[103]%}✹%{$reset_color%}"
|
||||||
ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[103]%}✖%{$reset_color%}"
|
ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[103]%}✖%{$reset_color%}"
|
||||||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[103]%}➜%{$reset_color%}"
|
ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[103]%}➜%{$reset_color%}"
|
||||||
|
|
Loading…
Reference in New Issue