Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
kareefardi committed Dec 20, 2021
2 parents cb13e98 + 904f868 commit 8776af7
Show file tree
Hide file tree
Showing 45 changed files with 1,231 additions and 832 deletions.
2 changes: 1 addition & 1 deletion .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3456,6 +3456,7 @@ sheerun
shellcheck
shellinit
shellperson
SHELLPROXY
shitload
SHLVL
shm
Expand Down Expand Up @@ -3687,7 +3688,6 @@ Subsubcommands
Subsubsubcommands
sudo
sudoedit
SUFIX
suitenames
sunaku
sunion
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Oh My Zsh is installed by running one of the following commands in your terminal
| **wget** | `sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
| **fetch** | `sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |

_Note that previous configuration in `.zshrc` will be placed in `.pre-oh-my-zsh`. After installation you can move configuration you want to preserve into `.zshrc`._

#### Manual inspection

It's a good idea to inspect the install script from projects you don't yet know. You can do
Expand Down
6 changes: 4 additions & 2 deletions lib/cli.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ function _omz {

_describe 'plugin' valid_plugins ;;
plugin::info)
local -aU plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t))
local -aU plugins
plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t))
_describe 'plugin' plugins ;;
theme::(set|use))
local -aU themes=("$ZSH"/themes/*.zsh-theme(.N:t:r) "$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::))
local -aU themes
themes=("$ZSH"/themes/*.zsh-theme(.N:t:r) "$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::))
_describe 'theme' themes ;;
esac
elif (( CURRENT > 4 )); then
Expand Down
2 changes: 1 addition & 1 deletion lib/git.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function git_prompt_info() {
&& upstream=" -> ${upstream}"
fi

echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref}${upstream}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
}

# Checks if working tree is dirty
Expand Down
2 changes: 1 addition & 1 deletion lib/prompt_info_functions.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function rvm_prompt_info() {
local rvm_prompt
rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${=ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null)
[[ -z "${rvm_prompt}" ]] && return 1
echo "${ZSH_THEME_RUBY_PROMPT_PREFIX}${rvm_prompt}${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
echo "${ZSH_THEME_RUBY_PROMPT_PREFIX}${rvm_prompt:gs/%/%%}${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
}

ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
Expand Down
11 changes: 11 additions & 0 deletions plugins/archlinux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ plugins=(... archlinux)
| pacin | `sudo pacman -S` | Install packages from the repositories |
| pacins | `sudo pacman -U` | Install a package from a local file |
| pacinsd | `sudo pacman -S --asdeps` | Install packages as dependencies of another package |
| paclean | `sudo pacman -Sc` | Clean out old and unused caches and packages |
| pacloc | `pacman -Qi` | Display information about a package in the local database |
| paclocs | `pacman -Qs` | Search for packages in the local database |
| paclr | `sudo pacman -Scc` | Remove all files from the cache |
| paclsorphans | `sudo pacman -Qdt` | List all orphaned packages |
| pacmir | `sudo pacman -Syy` | Force refresh of all package lists after updating mirrorlist |
| pacre | `sudo pacman -R` | Remove packages, keeping its settings and dependencies |
Expand Down Expand Up @@ -52,6 +54,8 @@ upgrades were available. Use `pacman -Que` instead.

| Alias | Command | Description |
|---------|-------------------------------------------------|-------------------------------------------------------------------------|
| auclean | `sudo aura -Sc` | Clean out old and unused caches and packages |
| auclr | `sudo aura -Scc` | Remove all files from the cache |
| auin | `sudo aura -S` | Install packages from the repositories |
| aurin | `sudo aura -A` | Install packages from the repositories |
| auins | `sudo aura -U` | Install a package from a local file |
Expand Down Expand Up @@ -84,6 +88,8 @@ upgrades were available. Use `pacman -Que` instead.

| Alias | Command | Description |
|---------|-----------------------------------|---------------------------------------------------------------------|
| pacclean| `pacaur -Sc` | Clean out old and unused caches and packages |
| pacclr | `pacaur -Scc` | Remove all files from the cache |
| pain | `pacaur -S` | Install packages from the repositories |
| pains | `pacaur -U` | Install a package from a local file |
| painsd | `pacaur -S --asdeps` | Install packages as dependencies of another package |
Expand All @@ -106,6 +112,8 @@ upgrades were available. Use `pacman -Que` instead.
| Alias | Command | Description |
|---------|-----------------------------------|---------------------------------------------------------------------|
| trconf | `trizen -C` | Fix all configuration files with vimdiff |
| trclean | `trizen -Sc` | Clean out old and unused caches and packages |
| trclr | `trizen -Scc` | Remove all files from the cache |
| trin | `trizen -S` | Install packages from the repositories |
| trins | `trizen -U` | Install a package from a local file |
| trinsd | `trizen -S --asdeps` | Install packages as dependencies of another package |
Expand All @@ -128,6 +136,8 @@ upgrades were available. Use `pacman -Que` instead.
| Alias | Command | Description |
|---------|--------------------------------|-------------------------------------------------------------------|
| yaconf | `yay -Pg` | Print current configuration |
| yaclean | `yay -Sc` | Clean out old and unused caches and packages |
| yaclr | `yay -Scc` | Remove all files from the cache |
| yain | `yay -S` | Install packages from the repositories |
| yains | `yay -U` | Install a package from a local file |
| yainsd | `yay -S --asdeps` | Install packages as dependencies of another package |
Expand Down Expand Up @@ -170,3 +180,4 @@ whether the package manager is installed, checked in the following order:
- ornicar - thibault.duplessis@gmail.com
- Ybalrid (Arthur Brainville) - ybalrid@ybalrid.info
- Jeff M. Hubbard - jeffmhubbard@gmail.com
- K. Harishankar(harishnkr) - hari2menon1234@gmail.com
10 changes: 10 additions & 0 deletions plugins/archlinux/archlinux.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
alias pacupg='sudo pacman -Syu'
alias pacin='sudo pacman -S'
alias paclean='sudo pacman -Sc'
alias pacins='sudo pacman -U'
alias paclr='sudo pacman -Scc'
alias pacre='sudo pacman -R'
alias pacrem='sudo pacman -Rns'
alias pacrep='pacman -Si'
Expand Down Expand Up @@ -88,6 +90,8 @@ fi
if (( $+commands[aura] )); then
alias auin='sudo aura -S'
alias aurin='sudo aura -A'
alias auclean='sudo aura -Sc'
alias auclr='sudo aura -Scc'
alias auins='sudo aura -U'
alias auinsd='sudo aura -S --asdeps'
alias aurinsd='sudo aura -A --asdeps'
Expand Down Expand Up @@ -115,6 +119,8 @@ if (( $+commands[aura] )); then
fi

if (( $+commands[pacaur] )); then
alias pacclean='pacaur -Sc'
alias pacclr='pacaur -Scc'
alias paupg='pacaur -Syu'
alias pasu='pacaur -Syu --noconfirm'
alias pain='pacaur -S'
Expand All @@ -138,6 +144,8 @@ if (( $+commands[trizen] )); then
alias trupg='trizen -Syua'
alias trsu='trizen -Syua --noconfirm'
alias trin='trizen -S'
alias trclean='trizen -Sc'
alias trclr='trizen -Scc'
alias trins='trizen -U'
alias trre='trizen -R'
alias trrem='trizen -Rns'
Expand All @@ -155,6 +163,8 @@ fi

if (( $+commands[yay] )); then
alias yaconf='yay -Pg'
alias yaclean='yay -Sc'
alias yaclr='yay -Scc'
alias yaupg='yay -Syu'
alias yasu='yay -Syu --noconfirm'
alias yain='yay -S'
Expand Down
14 changes: 13 additions & 1 deletion plugins/brew/brew.plugin.zsh
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
alias brewp='brew pin'
alias brews='brew list -1'
alias brewsp='brew list --pinned'
alias bubo='brew update && brew outdated'
alias bubc='brew upgrade && brew cleanup'
alias bubu='bubo && bubc'
alias buf='brew upgrade --formula'
alias bcubo='brew update && brew outdated --cask'
alias bcubc='brew upgrade --cask && brew cleanup'

function brews() {
local formulae="$(brew leaves | xargs brew deps --installed --for-each)"
local casks="$(brew list --cask)"

local blue="$(tput setaf 4)"
local bold="$(tput bold)"
local off="$(tput sgr0)"

echo "${blue}==>${off} ${bold}Formulae${off}"
echo "${formulae}" | sed "s/^\(.*\):\(.*\)$/\1${blue}\2${off}/"
echo "\n${blue}==>${off} ${bold}Casks${off}\n${casks}"
}
3 changes: 2 additions & 1 deletion plugins/chruby/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ current Ruby version, and completion and a prompt function to display the Ruby v
Supports brew and manual installation of chruby.

To use it, add `chruby` to the plugins array in your zshrc file:

```zsh
plugins=(... chruby)
```
Expand All @@ -14,7 +15,7 @@ plugins=(... chruby)
If you'd prefer to specify an explicit path to load chruby from
you can set variables like so:

```
```zsh
zstyle :omz:plugins:chruby path /local/path/to/chruby.sh
zstyle :omz:plugins:chruby auto /local/path/to/auto.sh
```
165 changes: 69 additions & 96 deletions plugins/chruby/chruby.plugin.zsh
Original file line number Diff line number Diff line change
@@ -1,121 +1,94 @@
#
# INSTRUCTIONS
#
# With either a manual or brew installed chruby things should just work.
#
# If you'd prefer to specify an explicit path to load chruby from
# you can set variables like so:
#
# zstyle :omz:plugins:chruby path /local/path/to/chruby.sh
# zstyle :omz:plugins:chruby auto /local/path/to/auto.sh
#
# TODO
# - autodetermine correct source path on non OS X systems
# - completion if ruby-install exists
## load chruby from different locations

# rvm and rbenv plugins also provide this alias
alias rubies='chruby'
_source-from-omz-settings() {
local _chruby_path _chruby_auto

zstyle -s :omz:plugins:chruby path _chruby_path || return 1
zstyle -s :omz:plugins:chruby auto _chruby_auto || return 1

if [[ -r ${_chruby_path} ]]; then
source ${_chruby_path}
fi

_homebrew-installed() {
whence brew &> /dev/null
_xit=$?
if [ $_xit -eq 0 ];then
# ok , we have brew installed
# speculatively we check default brew prefix
if [ -h /usr/local/opt/chruby ];then
_brew_prefix="/usr/local/opt/chruby"
else
# ok , it is not default prefix
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
_brew_prefix=$(brew --prefix chruby)
fi
return 0
else
return $_xit
fi
if [[ -r ${_chruby_auto} ]]; then
source ${_chruby_auto}
fi
}

_chruby-from-homebrew-installed() {
[ -r $_brew_prefix ] &> /dev/null
}
_source-from-homebrew() {
(( $+commands[brew] )) || return 1

_ruby-build_installed() {
whence ruby-build &> /dev/null
}
local _brew_prefix
# check default brew prefix
if [[ -h /usr/local/opt/chruby ]];then
_brew_prefix="/usr/local/opt/chruby"
else
# ok , it is not default prefix
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
_brew_prefix=$(brew --prefix chruby)
fi

_ruby-install-installed() {
whence ruby-install &> /dev/null
}
[[ -r "$_brew_prefix" ]] || return 1

# Simple definition completer for ruby-build
if _ruby-build_installed; then
_ruby-build() { compadd $(ruby-build --definitions) }
compdef _ruby-build ruby-build
fi

_source_from_omz_settings() {
local _chruby_path
local _chruby_auto

zstyle -s :omz:plugins:chruby path _chruby_path
zstyle -s :omz:plugins:chruby auto _chruby_auto

if [[ -r ${_chruby_path} ]]; then
source ${_chruby_path}
fi

if [[ -r ${_chruby_auto} ]]; then
source ${_chruby_auto}
fi
source $_brew_prefix/share/chruby/chruby.sh
source $_brew_prefix/share/chruby/auto.sh
}

_chruby_dirs() {
chrubydirs=($HOME/.rubies/ $PREFIX/opt/rubies)
for dir in chrubydirs; do
if [[ -d $dir ]]; then
RUBIES+=$dir
fi
done
_load-chruby-dirs() {
local dir
for dir in "$HOME/.rubies" "$PREFIX/opt/rubies"; do
if [[ -d "$dir" ]]; then
RUBIES+=("$dir")
fi
done
}

if _homebrew-installed && _chruby-from-homebrew-installed ; then
source $_brew_prefix/share/chruby/chruby.sh
source $_brew_prefix/share/chruby/auto.sh
_chruby_dirs
# Load chruby
if _source-from-omz-settings; then
_load-chruby-dirs
elif [[ -r "/usr/local/share/chruby/chruby.sh" ]] ; then
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
_chruby_dirs
else
_source_from_omz_settings
_chruby_dirs
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
_load-chruby-dirs
elif _source-from-homebrew; then
_load-chruby-dirs
fi

function ensure_chruby() {
$(whence chruby)
}
unfunction _source-from-homebrew _source-from-omz-settings _load-chruby-dirs


## chruby utility functions and aliases

# rvm and rbenv plugins also provide this alias
alias rubies='chruby'

function current_ruby() {
local _ruby
_ruby="$(chruby |grep \* |tr -d '* ')"
if [[ $(chruby |grep -c \*) -eq 1 ]]; then
echo ${_ruby}
else
echo "system"
fi
local ruby
ruby="$(chruby | grep \* | tr -d '* ')"
if [[ $(chruby | grep -c \*) -eq 1 ]]; then
echo ${ruby}
else
echo "system"
fi
}

function chruby_prompt_info() {
echo "$(current_ruby)"
echo "${$(current_ruby):gs/%/%%}"
}

# complete on installed rubies
# Complete chruby command with installed rubies
_chruby() {
compadd $(chruby | tr -d '* ')
local default_path='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
if PATH=${default_path} type ruby &> /dev/null; then
compadd system
fi
compadd $(chruby | tr -d '* ')
if PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command ruby &>/dev/null; then
compadd system
fi
}

compdef _chruby chruby


# Simple definition completer for ruby-build
if command ruby-build &> /dev/null; then
_ruby-build() { compadd $(ruby-build --definitions) }
compdef _ruby-build ruby-build
fi
1 change: 1 addition & 0 deletions plugins/command-not-found/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ It works out of the box with the command-not-found packages for:
- [Fedora](https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound)
- [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found)
- [Termux](https://github.com/termux/command-not-found)
- [SUSE](https://www.unix.com/man-page/suse/1/command-not-found/)

You can add support for other platforms by submitting a Pull Request.

0 comments on commit 8776af7

Please sign in to comment.