mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
Merge branch 'master' of github.com:ohmyzsh/ohmyzsh
This commit is contained in:
commit
e3d5de6904
6 changed files with 39 additions and 14 deletions
|
|
@ -2,6 +2,6 @@ certifi==2025.4.26
|
||||||
charset-normalizer==3.4.2
|
charset-normalizer==3.4.2
|
||||||
idna==3.10
|
idna==3.10
|
||||||
PyYAML==6.0.2
|
PyYAML==6.0.2
|
||||||
requests==2.32.3
|
requests==2.32.4
|
||||||
semver==3.0.4
|
semver==3.0.4
|
||||||
urllib3==2.4.0
|
urllib3==2.5.0
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,9 @@ function open_command() {
|
||||||
linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || {
|
linux*) [[ "$(uname -r)" != *icrosoft* ]] && open_cmd='nohup xdg-open' || {
|
||||||
open_cmd='cmd.exe /c start ""'
|
open_cmd='cmd.exe /c start ""'
|
||||||
[[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
|
[[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
|
||||||
|
[[ "$1" = (http|https)://* ]] && {
|
||||||
|
1="$(echo "$1" | sed -E 's/([&|()<>^])/^\1/g')" || return 1
|
||||||
|
}
|
||||||
} ;;
|
} ;;
|
||||||
msys*) open_cmd='start ""' ;;
|
msys*) open_cmd='start ""' ;;
|
||||||
*) echo "Platform $OSTYPE not supported"
|
*) echo "Platform $OSTYPE not supported"
|
||||||
|
|
|
||||||
|
|
@ -99,8 +99,8 @@ done
|
||||||
|
|
||||||
# Figure out the SHORT hostname
|
# Figure out the SHORT hostname
|
||||||
if [[ "$OSTYPE" = darwin* ]]; then
|
if [[ "$OSTYPE" = darwin* ]]; then
|
||||||
# macOS's $HOST changes with dhcp, etc. Use ComputerName if possible.
|
# macOS's $HOST changes with dhcp, etc. Use LocalHostName if possible.
|
||||||
SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST="${HOST/.*/}"
|
SHORT_HOST=$(scutil --get LocalHostName 2>/dev/null) || SHORT_HOST="${HOST/.*/}"
|
||||||
else
|
else
|
||||||
SHORT_HOST="${HOST/.*/}"
|
SHORT_HOST="${HOST/.*/}"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,11 @@ plugins=(... ubuntu)
|
||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
Commands that use `$APT` will use `apt` if installed or defer to `apt-get` otherwise.
|
Commands that use `$APT` will use `apt-fast` if installed, or `apt` if installed, or defer to `apt-get`
|
||||||
|
otherwise.
|
||||||
|
|
||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
|---------|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
|
| ------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
|
||||||
| age | `sudo $APT` | Run apt-get with sudo |
|
| age | `sudo $APT` | Run apt-get with sudo |
|
||||||
| acs | `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 |
|
| acsp | `apt-cache showpkg` | Shows information about the listed packages |
|
||||||
|
|
@ -26,7 +27,7 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other
|
||||||
| agd | `sudo $APT dselect-upgrade` | Follows dselect choices for package installation |
|
| agd | `sudo $APT dselect-upgrade` | Follows dselect choices for package installation |
|
||||||
| agi | `sudo $APT install <pkg>` | Install the specified package |
|
| agi | `sudo $APT install <pkg>` | Install the specified package |
|
||||||
| agli | `apt list --installed` | List the installed packages |
|
| agli | `apt list --installed` | List the installed packages |
|
||||||
| aglu | `sudo apt-get -u upgrade --assume-no` | Run an apt-get upgrade assuming no to all prompts |
|
| aglu | `apt list --upgradable` | List available updates only |
|
||||||
| agp | `sudo $APT purge <pkg>` | Remove a package including any configuration files |
|
| agp | `sudo $APT purge <pkg>` | Remove a package including any configuration files |
|
||||||
| agr | `sudo $APT remove <pkg>` | Remove a package |
|
| agr | `sudo $APT remove <pkg>` | Remove a package |
|
||||||
| ags | `$APT source <pkg>` | Fetch the source for the specified package |
|
| ags | `$APT source <pkg>` | Fetch the source for the specified package |
|
||||||
|
|
@ -36,21 +37,20 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other
|
||||||
| agar | `sudo $APT autoremove` | Remove automatically installed packages no longer needed |
|
| agar | `sudo $APT autoremove` | Remove automatically installed packages no longer needed |
|
||||||
| aguu | `sudo $APT update && sudo $APT upgrade` | Update packages list and upgrade available packages |
|
| aguu | `sudo $APT update && sudo $APT upgrade` | Update packages list and upgrade available packages |
|
||||||
| allpkgs | `dpkg --get-selections \| grep -v deinstall` | Print all installed packages |
|
| allpkgs | `dpkg --get-selections \| grep -v deinstall` | Print all installed packages |
|
||||||
| kclean | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` |Remove ALL kernel images and headers EXCEPT the one in use |
|
| kclean | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` | Remove ALL kernel images and headers EXCEPT the one in use |
|
||||||
| mydeb | `time dpkg-buildpackage -rfakeroot -us -uc` | Create a basic .deb package |
|
| mydeb | `time dpkg-buildpackage -rfakeroot -us -uc` | Create a basic .deb package |
|
||||||
| ppap | `sudo ppa-purge <ppa>` | Remove the specified PPA |
|
| ppap | `sudo ppa-purge <ppa>` | Remove the specified PPA |
|
||||||
|
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
| Function | Usage |Description |
|
| Function | Usage | Description |
|
||||||
|-------------------|---------------------------------------|--------------------------------------------------------------------------|
|
| ----------------- | ------------------------------------- | ------------------------------------------------------------------------ |
|
||||||
| aar | `aar ppa:xxxxxx/xxxxxx [packagename]` | apt-add-repository with automatic install/upgrade of the desired package |
|
| aar | `aar ppa:xxxxxx/xxxxxx [packagename]` | apt-add-repository with automatic install/upgrade of the desired package |
|
||||||
| apt-history | `apt-history <action>` | Prints the Apt history of the specified action |
|
| apt-history | `apt-history <action>` | Prints the Apt history of the specified action |
|
||||||
| apt-list-packages | `apt-list-packages` | List packages by size |
|
| apt-list-packages | `apt-list-packages` | List packages by size |
|
||||||
| kerndeb | `kerndeb` | Kernel-package building shortcut |
|
| kerndeb | `kerndeb` | Kernel-package building shortcut |
|
||||||
|
|
||||||
## Authors:
|
## Authors
|
||||||
|
|
||||||
- [@AlexBio](https://github.com/AlexBio)
|
- [@AlexBio](https://github.com/AlexBio)
|
||||||
- [@dbb](https://github.com/dbb)
|
- [@dbb](https://github.com/dbb)
|
||||||
|
|
@ -59,3 +59,4 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other
|
||||||
- [Nicolas Jonas](https://nextgenthemes.com)
|
- [Nicolas Jonas](https://nextgenthemes.com)
|
||||||
- [@loctauxphilippe](https://github.com/loctauxphilippe)
|
- [@loctauxphilippe](https://github.com/loctauxphilippe)
|
||||||
- [@HaraldNordgren](https://github.com/HaraldNordgren)
|
- [@HaraldNordgren](https://github.com/HaraldNordgren)
|
||||||
|
- [@AmrElsayyad](https://github.com/AmrElsayyad)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,22 @@
|
||||||
(( $+commands[apt] )) && APT=apt || APT=apt-get
|
# Detect available package manager (prefer apt-fast > apt > apt-get)
|
||||||
|
if (( $+commands[apt-fast] )); then
|
||||||
|
APT=apt-fast
|
||||||
|
elif (( $+commands[apt] )); then
|
||||||
|
APT=apt
|
||||||
|
else
|
||||||
|
APT=apt-get
|
||||||
|
fi
|
||||||
|
|
||||||
alias acs='apt-cache search'
|
alias acs='apt-cache search'
|
||||||
|
|
||||||
alias afs='apt-file search --regexp'
|
alias afs='apt-file search --regexp'
|
||||||
|
|
||||||
# These are apt/apt-get only
|
# These are apt/apt-get only
|
||||||
alias ags="$APT source"
|
if (( $+commands[apt] )); then
|
||||||
|
alias ags="apt source"
|
||||||
|
else
|
||||||
|
alias ags="apt-get source"
|
||||||
|
fi
|
||||||
|
|
||||||
alias acp='apt-cache policy'
|
alias acp='apt-cache policy'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -314,6 +314,9 @@ prompt_dir() {
|
||||||
|
|
||||||
# Virtualenv: current working virtualenv
|
# Virtualenv: current working virtualenv
|
||||||
prompt_virtualenv() {
|
prompt_virtualenv() {
|
||||||
|
if [ -n "$CONDA_DEFAULT_ENV" ]; then
|
||||||
|
prompt_segment magenta $CURRENT_FG "🐍 $CONDA_DEFAULT_ENV"
|
||||||
|
fi
|
||||||
if [[ -n "$VIRTUAL_ENV" && -n "$VIRTUAL_ENV_DISABLE_PROMPT" ]]; then
|
if [[ -n "$VIRTUAL_ENV" && -n "$VIRTUAL_ENV_DISABLE_PROMPT" ]]; then
|
||||||
prompt_segment "$AGNOSTER_VENV_BG" "$AGNOSTER_VENV_FG" "(${VIRTUAL_ENV:t:gs/%/%%})"
|
prompt_segment "$AGNOSTER_VENV_BG" "$AGNOSTER_VENV_FG" "(${VIRTUAL_ENV:t:gs/%/%%})"
|
||||||
fi
|
fi
|
||||||
|
|
@ -350,12 +353,19 @@ prompt_aws() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prompt_terraform() {
|
||||||
|
local terraform_info=$(tf_prompt_info)
|
||||||
|
[[ -z "$terraform_info" ]] && return
|
||||||
|
prompt_segment magenta yellow "TF: $terraform_info"
|
||||||
|
}
|
||||||
|
|
||||||
## Main prompt
|
## Main prompt
|
||||||
build_prompt() {
|
build_prompt() {
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
prompt_status
|
prompt_status
|
||||||
prompt_virtualenv
|
prompt_virtualenv
|
||||||
prompt_aws
|
prompt_aws
|
||||||
|
prompt_terraform
|
||||||
prompt_context
|
prompt_context
|
||||||
prompt_dir
|
prompt_dir
|
||||||
prompt_git
|
prompt_git
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue