mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-23 02:35:38 +01:00
Merge branch 'master' of https://github.com/ohmyzsh/ohmyzsh
This commit is contained in:
commit
2a5ec9028a
16 changed files with 49 additions and 45 deletions
|
|
@ -15,14 +15,14 @@ Requirements: Python needs to be installed.
|
|||
|
||||
## Usage
|
||||
|
||||
- `acs`: show all aliases by group
|
||||
- `als`: show all aliases by group
|
||||
|
||||
- `acs -h/--help`: print help mesage
|
||||
- `als -h/--help`: print help mesage
|
||||
|
||||
- `acs <keyword(s)>`: filter and highlight aliases by `<keyword>`
|
||||
- `als <keyword(s)>`: filter and highlight aliases by `<keyword>`
|
||||
|
||||
- `acs -g <group>/--group <group>`: show only aliases for group `<group>`. Multiple uses of the flag show all groups
|
||||
- `als -g <group>/--group <group>`: show only aliases for group `<group>`. Multiple uses of the flag show all groups
|
||||
|
||||
- `acs --groups`: show only group names
|
||||
- `als --groups`: show only group names
|
||||
|
||||

|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||
|
||||
eval '
|
||||
function acs(){
|
||||
function als(){
|
||||
(( $+commands[python3] )) || {
|
||||
echo "[error] No python executable detected"
|
||||
return
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ def pretty_print(cheatsheet, wfilter, group_list=None, groups_only=False):
|
|||
pretty_print_group(key, [ alias for alias in aliases if alias[0].find(wfilter)>-1 or alias[1].find(wfilter)>-1], wfilter)
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description="Pretty print aliases.", prog="acs")
|
||||
parser = argparse.ArgumentParser(description="Pretty print aliases.", prog="als")
|
||||
parser.add_argument('filter', nargs="*", metavar="<keyword>", help="search aliases matching keywords")
|
||||
parser.add_argument('-g', '--group', dest="group_list", action='append', help="only print aliases in given groups")
|
||||
parser.add_argument('--groups', dest='groups_only', action='store_true', help="only print alias groups")
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh
|
|||
| ------ | ---------------------------------------------------------------------- | ---------------------------------------------------------- |
|
||||
| `age` | `apt-get` | Command line tool for handling packages |
|
||||
| `api` | `aptitude` | Same functionality as `apt-get`, provides extra options |
|
||||
| `acse` | `apt-cache search` | Command line tool for searching apt software package cache |
|
||||
| `acs` | `apt-cache search` | Command line tool for searching apt software package cache |
|
||||
| `aps` | `aptitude search` | Searches installed packages using aptitude |
|
||||
| `as` | `aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search` | Print searched packages using a custom format |
|
||||
| `afs` | `apt-file search --regexp` | Search file in packages |
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ alias age='apt-get'
|
|||
alias api='aptitude'
|
||||
|
||||
# Some self-explanatory aliases
|
||||
alias acse="apt-cache search"
|
||||
alias acs="apt-cache search"
|
||||
alias aps='aptitude search'
|
||||
alias as="aptitude -F '* %p -> %d \n(%v/%V)' --no-gui --disable-columns search"
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,15 @@ file**, but be aware of the side effects:
|
|||
> zstyle ':completion:*:*:docker-*:*' option-stacking yes
|
||||
> ```
|
||||
|
||||
### Use old-style completion
|
||||
|
||||
If the current completion does not work well for you, you can enable legacy completion instead with the
|
||||
following setting. See https://github.com/ohmyzsh/ohmyzsh/issues/11789 for more information.
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:docker' legacy-completion yes
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|
|
@ -58,7 +67,7 @@ file**, but be aware of the side effects:
|
|||
| drm | `docker container rm` | Remove the specified container(s) |
|
||||
| drm! | `docker container rm -f` | Force the removal of a running container (uses SIGKILL) |
|
||||
| dst | `docker container start` | Start one or more stopped containers |
|
||||
| drs | `docker container restart` | Restart one or more containers
|
||||
| drs | `docker container restart` | Restart one or more containers |
|
||||
| dsta | `docker stop $(docker ps -q)` | Stop all running containers |
|
||||
| dstp | `docker container stop` | Stop one or more running containers |
|
||||
| dtop | `docker top` | Display the running processes of a container |
|
||||
|
|
|
|||
|
|
@ -41,21 +41,22 @@ fi
|
|||
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
||||
0="${${(M)0:#/*}:-$PWD/$0}"
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `docker`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_docker" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _docker
|
||||
_comps[docker]=_docker
|
||||
fi
|
||||
|
||||
{
|
||||
# `docker completion` is only available from 23.0.0 on
|
||||
# docker version returns `Docker version 24.0.2, build cb74dfcd85`
|
||||
# with `s:,:` remove the comma after the version, and select third word of it
|
||||
local _docker_version=${${(s:,:z)"$(command docker --version)"}[3]}
|
||||
# `docker completion` is only available from 23.0.0 on
|
||||
if is-at-least 23.0.0 $_docker_version; then
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `docker`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_docker" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _docker
|
||||
_comps[docker]=_docker
|
||||
fi
|
||||
command docker completion zsh >| "$ZSH_CACHE_DIR/completions/_docker"
|
||||
else
|
||||
command cp "${0:h}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker"
|
||||
if zstyle -t ':omz:plugins:docker' legacy-completion || \
|
||||
! is-at-least 23.0.0 ${${(s:,:z)"$(command docker --version)"}[3]}; then
|
||||
command cp "${0:h}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker"
|
||||
else
|
||||
command docker completion zsh >| "$ZSH_CACHE_DIR/completions/_docker"
|
||||
fi
|
||||
} &|
|
||||
|
|
|
|||
|
|
@ -52,12 +52,7 @@ version to load. This can be done, similar as previous options, adding:
|
|||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:nvm' autoload yes
|
||||
```
|
||||
|
||||
To remove the output generated by NVM when autoloading, you can set the following option:
|
||||
|
||||
```zsh
|
||||
zstyle ':omz:plugins:nvm' silent-autoload yes
|
||||
zstyle ':omz:plugins:nvm' silent-autoload yes # optionally remove the output generated by NVM when autoloading
|
||||
```
|
||||
|
||||
Note: _this will not remove regular `nvm` output_
|
||||
|
|
|
|||
|
|
@ -16,13 +16,7 @@ fi
|
|||
# Note: nvm is a function so we need to use `which`
|
||||
which nvm &>/dev/null && return
|
||||
|
||||
if [[ -z "$NVM_DIR" ]]; then
|
||||
echo "[oh-my-zsh] nvm installation cannot be found"
|
||||
echo "[oh-my-zsh] set NVM_DIR to your installation"
|
||||
return
|
||||
fi
|
||||
if [[ ! -f "$NVM_DIR/nvm.sh" ]]; then
|
||||
echo "[oh-my-zsh] nvm.sh does not exist in $NVM_DIR"
|
||||
if [[ -z "$NVM_DIR" ]] || [[ ! -f "$NVM_DIR/nvm.sh" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ function per-directory-history-toggle-history() {
|
|||
autoload per-directory-history-toggle-history
|
||||
zle -N per-directory-history-toggle-history
|
||||
bindkey $PER_DIRECTORY_HISTORY_TOGGLE per-directory-history-toggle-history
|
||||
bindkey -M vicmd $PER_DIRECTORY_HISTORY_TOGGLE per-directory-history-toggle-history
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# implementation details
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
alias tis='tig status'
|
||||
alias til='tig log'
|
||||
alias tib='tig blame -C'
|
||||
alias tif='tig reflog'
|
||||
alias tia='tig --all'
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other
|
|||
| Alias | Command | Description |
|
||||
|---------|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
|
||||
| age | `sudo $APT` | Run apt-get with sudo |
|
||||
| acse | `apt-cache search` | Search the apt-cache with the specified criteria |
|
||||
| acs | `apt-cache search` | Search the apt-cache with the specified criteria |
|
||||
| acsp | `apt-cache showpkg` | Shows information about the listed packages |
|
||||
| acp | `apt-cache policy` | Display the package source priorities |
|
||||
| afs | `apt-file search --regexp` | Perform a regular expression apt-file search |
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
(( $+commands[apt] )) && APT=apt || APT=apt-get
|
||||
|
||||
alias acse='apt-cache search'
|
||||
alias acs='apt-cache search'
|
||||
|
||||
alias afs='apt-file search --regexp'
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,9 @@ prompt_git() {
|
|||
if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]]; then
|
||||
repo_path=$(git rev-parse --git-dir 2>/dev/null)
|
||||
dirty=$(parse_git_dirty)
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref="◈ $(git describe --exact-match --tags HEAD 2> /dev/null)" || \
|
||||
ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
|
||||
if [[ -n $dirty ]]; then
|
||||
prompt_segment yellow black
|
||||
else
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
# Also borrowing from http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/
|
||||
|
||||
function virtualenv_info {
|
||||
[ $CONDA_DEFAULT_ENV ] && echo "($CONDA_DEFAULT_ENV) "
|
||||
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') '
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,14 +29,13 @@ local cyan="%{$fg_bold[cyan]%}"
|
|||
local yellow="%{$fg_bold[yellow]%}"
|
||||
local blue="%{$fg_bold[blue]%}"
|
||||
local magenta="%{$fg_bold[magenta]%}"
|
||||
local white="%{$fg_bold[white]%}"
|
||||
local reset="%{$reset_color%}"
|
||||
|
||||
local -a color_array
|
||||
color_array=($green $red $cyan $yellow $blue $magenta $white)
|
||||
color_array=($green $red $cyan $yellow $blue $magenta)
|
||||
|
||||
local username_color=$white
|
||||
local hostname_color=$color_array[$[((#HOST))%7+1]] # choose hostname color based on first character
|
||||
local username_color=$blue
|
||||
local hostname_color=$color_array[$[((#HOST))%6+1]] # choose hostname color based on first character
|
||||
local current_dir_color=$blue
|
||||
|
||||
local username="%n"
|
||||
|
|
@ -66,10 +65,10 @@ function michelebologna_git_prompt {
|
|||
local out=$(git_prompt_info)$(git_prompt_status)$(git_remote_status)
|
||||
[[ -n $out ]] || return
|
||||
printf " %s(%s%s%s)%s" \
|
||||
"%{$fg_bold[white]%}" \
|
||||
"%{$fg_bold[blue]%}" \
|
||||
"%{$fg_bold[green]%}" \
|
||||
"$out" \
|
||||
"%{$fg_bold[white]%}" \
|
||||
"%{$fg_bold[blue]%}" \
|
||||
"%{$reset_color%}"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue