From 4a74349635cf30d305766b459c7cc3246831676e Mon Sep 17 00:00:00 2001 From: Janusz Mordarski Date: Tue, 9 Nov 2021 09:50:25 +0100 Subject: feat(refined): allow selecting git branch by changing prefix to `:` (#10400) --- themes/refined.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'themes') diff --git a/themes/refined.zsh-theme b/themes/refined.zsh-theme index 2a4188c9d..5d39bd757 100644 --- a/themes/refined.zsh-theme +++ b/themes/refined.zsh-theme @@ -33,8 +33,8 @@ autoload -Uz vcs_info zstyle ':vcs_info:*' enable hg bzr git zstyle ':vcs_info:*:*' unstagedstr '!' zstyle ':vcs_info:*:*' stagedstr '+' -zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%%u%c" -zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%u%c (%a)" +zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s:%b" "%%u%c" +zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s:%b" "%u%c (%a)" zstyle ':vcs_info:*:*' nvcsformats "%~" "" "" # Fastest possible way to check if repo is dirty -- cgit v1.2.3-70-g09d2 From 3dc66bd3676a564e3864fb5ccf5641c65fd42c6f Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 9 Nov 2021 10:25:23 +0100 Subject: fix(emotty): fix glyphs output width in emotty theme --- themes/emotty.zsh-theme | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'themes') diff --git a/themes/emotty.zsh-theme b/themes/emotty.zsh-theme index 13adad78d..044b317e8 100644 --- a/themes/emotty.zsh-theme +++ b/themes/emotty.zsh-theme @@ -51,9 +51,9 @@ root_prompt="$emoji[skull]" warn_prompt="$emoji[collision_symbol]" vcs_unstaged_glyph="%{$emoji[circled_latin_capital_letter_m]$emoji2[emoji_style] %2G%}" -vcs_staged_glyph="%{$emoji[high_voltage_sign] %2G%}" -vcs_branch_glyph=$(print -P $'\Ue0a0') #  -vcs_action_glyph=$(print -P $'\U276f') # ❯ +vcs_staged_glyph="%{$emoji[high_voltage_sign]%2G%}" +vcs_branch_glyph=$'\Ue0a0' #  +vcs_action_glyph=$'\U276f' # ❯ red="$FG[001]" yellow="$FG[003]" -- cgit v1.2.3-70-g09d2 From b3ba9978cc42a5031c7b68e3cf917ec2e64643bc Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 9 Nov 2021 09:54:21 +0100 Subject: fix(themes): fix potential command injection in `pygmalion`, `pygmalion-virtualenv` and `refined` The pygmalion and pygmalion-virtualenv themes unsafely handle git prompt information which results in a double evaluation of this information, so a malicious git repository could trigger a command injection if the user cloned and entered the repository. A similar method could be used in the refined theme. All themes have been patched against this vulnerability. --- themes/pygmalion-virtualenv.zsh-theme | 11 ++++++----- themes/pygmalion.zsh-theme | 6 +++--- themes/refined.zsh-theme | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) (limited to 'themes') diff --git a/themes/pygmalion-virtualenv.zsh-theme b/themes/pygmalion-virtualenv.zsh-theme index 47b0b4fb1..c2ab7f4e6 100644 --- a/themes/pygmalion-virtualenv.zsh-theme +++ b/themes/pygmalion-virtualenv.zsh-theme @@ -35,19 +35,20 @@ prompt_setup_pygmalion(){ } prompt_pygmalion_precmd(){ - setopt localoptions extendedglob + setopt localoptions nopromptsubst extendedglob local gitinfo=$(git_prompt_info) local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}} - local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")" + local exp_nocolor="$(print -P \"${base_prompt_nocolor}${gitinfo_nocolor}${post_prompt_nocolor}\")" local prompt_length=${#exp_nocolor} + # add new line on prompt longer than 40 characters local nl="" - if [[ $prompt_length -gt 40 ]]; then - nl=$'\n%{\r%}'; + nl=$'\n%{\r%}' fi - PROMPT="$base_prompt$gitinfo$nl$post_prompt" + + PROMPT="${base_prompt}\$(git_prompt_info)${nl}${post_prompt}" } prompt_setup_pygmalion diff --git a/themes/pygmalion.zsh-theme b/themes/pygmalion.zsh-theme index b13adfd5f..be9ca3889 100644 --- a/themes/pygmalion.zsh-theme +++ b/themes/pygmalion.zsh-theme @@ -19,14 +19,14 @@ prompt_setup_pygmalion(){ } prompt_pygmalion_precmd(){ - setopt localoptions extendedglob + setopt localoptions nopromptsubst extendedglob local gitinfo=$(git_prompt_info) local gitinfo_nocolor=${gitinfo//\%\{[^\}]##\}} - local exp_nocolor="$(print -P \"$base_prompt_nocolor$gitinfo_nocolor$post_prompt_nocolor\")" + local exp_nocolor="$(print -P \"${base_prompt_nocolor}${gitinfo_nocolor}${post_prompt_nocolor}\")" local prompt_length=${#exp_nocolor} - PROMPT="${base_prompt}${gitinfo}${post_prompt}" + PROMPT="${base_prompt}\$(git_prompt_info)${post_prompt}" } prompt_setup_pygmalion diff --git a/themes/refined.zsh-theme b/themes/refined.zsh-theme index 5d39bd757..5e2de7a87 100644 --- a/themes/refined.zsh-theme +++ b/themes/refined.zsh-theme @@ -70,6 +70,7 @@ preexec() { # Output additional information about paths, repos and exec time # precmd() { + setopt localoptions nopromptsubst vcs_info # Get version control info before we start outputting stuff print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f" unset cmd_timestamp #Reset cmd exec time. -- cgit v1.2.3-70-g09d2 From 0e41181d547e2f89ffc503a7afc8b0f3991dd1a8 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Wed, 1 Dec 2021 06:20:31 -0500 Subject: chore: fix spelling errors across the project (#10459) Co-authored-by: Josh Soref --- plugins/aliases/cheatsheet.py | 8 ++++---- plugins/aliases/termcolor.py | 2 +- plugins/bower/bower.plugin.zsh | 8 ++++---- plugins/catimg/catimg.plugin.zsh | 2 +- plugins/catimg/catimg.sh | 2 +- plugins/chucknorris/fortunes/chucknorris | 10 +++++----- plugins/colorize/colorize.plugin.zsh | 2 +- plugins/cpanm/_cpanm | 2 +- plugins/docker-machine/_docker-machine | 6 +++--- plugins/dotnet/dotnet.plugin.zsh | 2 +- plugins/emoji/emoji.plugin.zsh | 2 +- plugins/fastfile/fastfile.plugin.zsh | 12 ++++++------ plugins/fd/README.md | 2 +- plugins/flutter/README.md | 2 +- plugins/fzf/README.md | 2 +- plugins/gitfast/git-completion.bash | 2 +- plugins/grails/grails.plugin.zsh | 2 +- plugins/grunt/grunt.plugin.zsh | 4 ++-- .../history-substring-search/history-substring-search.zsh | 4 ++-- plugins/ipfs/_ipfs | 2 +- plugins/iterm2/iterm2.plugin.zsh | 2 +- plugins/jenv/README.md | 2 +- plugins/macos/spotify | 2 +- plugins/mercurial/README.md | 2 +- plugins/npm/README.md | 2 +- plugins/pep8/_pep8 | 2 +- plugins/please/README.md | 2 +- plugins/pm2/_pm2 | 4 ++-- plugins/powify/_powify | 2 +- plugins/rake/rake.plugin.zsh | 2 +- plugins/rebar/_rebar | 2 +- plugins/redis-cli/_redis-cli | 10 +++++----- plugins/salt/_salt | 2 +- plugins/scala/_scala | 2 +- plugins/sfdx/_sfdx | 2 +- plugins/sprunge/README.md | 2 +- plugins/supervisor/_supervisorctl | 10 +++++----- plugins/supervisor/supervisor.plugin.zsh | 2 +- plugins/suse/README.md | 2 +- plugins/symfony2/README.md | 2 +- plugins/systemadmin/systemadmin.plugin.zsh | 4 ++-- plugins/terminitor/_terminitor | 2 +- plugins/ubuntu/README.md | 2 +- plugins/vault/_vault | 4 ++-- plugins/yarn/_yarn | 2 +- plugins/yum/yum.plugin.zsh | 2 +- themes/dallas.zsh-theme | 2 +- themes/essembeh.zsh-theme | 2 +- themes/nicoulaj.zsh-theme | 2 +- 49 files changed, 79 insertions(+), 79 deletions(-) (limited to 'themes') diff --git a/plugins/aliases/cheatsheet.py b/plugins/aliases/cheatsheet.py index d6d507b92..694afd31c 100644 --- a/plugins/aliases/cheatsheet.py +++ b/plugins/aliases/cheatsheet.py @@ -26,16 +26,16 @@ def cheatsheet(lines): target_aliases.extend(group_list) return cheatsheet -def pretty_print_group(key, aliases, hightlight=None): +def pretty_print_group(key, aliases, highlight=None): if len(aliases) == 0: return group_hl_formatter = lambda g, hl: termcolor.colored(hl, 'yellow').join([termcolor.colored(part, 'red') for part in ('[%s]' % g).split(hl)]) alias_hl_formatter = lambda alias, hl: termcolor.colored(hl, 'yellow').join([termcolor.colored(part, 'green') for part in ('\t%s = %s' % alias[0:2]).split(hl)]) group_formatter = lambda g: termcolor.colored('[%s]' % g, 'red') alias_formatter = lambda alias: termcolor.colored('\t%s = %s' % alias[0:2], 'green') - if hightlight and len(hightlight)>0: - print (group_hl_formatter(key, hightlight)) - print ('\n'.join([alias_hl_formatter(alias, hightlight) for alias in aliases])) + if highlight and len(highlight)>0: + print (group_hl_formatter(key, highlight)) + print ('\n'.join([alias_hl_formatter(alias, highlight) for alias in aliases])) else: print (group_formatter(key)) print ('\n'.join([alias_formatter(alias) for alias in aliases])) diff --git a/plugins/aliases/termcolor.py b/plugins/aliases/termcolor.py index f11b824b2..bb725e905 100644 --- a/plugins/aliases/termcolor.py +++ b/plugins/aliases/termcolor.py @@ -21,7 +21,7 @@ # # Author: Konstantin Lepa -"""ANSII Color formatting for output in terminal.""" +"""ANSI Color formatting for output in terminal.""" from __future__ import print_function import os diff --git a/plugins/bower/bower.plugin.zsh b/plugins/bower/bower.plugin.zsh index 3a40b3af0..c4f71c2ae 100644 --- a/plugins/bower/bower.plugin.zsh +++ b/plugins/bower/bower.plugin.zsh @@ -9,7 +9,7 @@ _bower_installed_packages () { } _bower () { - local -a _1st_arguments _no_color _dopts _save_dev _force_lastest _production + local -a _1st_arguments _no_color _dopts _save_dev _force_latest _production local expl typeset -A opt_args @@ -22,7 +22,7 @@ _bower () _save_dev=('(--save-dev)--save-dev[Save installed packages into the project"s bower.json devDependencies]') - _force_lastest=('(--force-latest)--force-latest[Force latest version on conflict]') + _force_latest=('(--force-latest)--force-latest[Force latest version on conflict]') _production=('(--production)--production[Do not install project devDependencies]') @@ -54,7 +54,7 @@ _bower () _arguments \ $_dopts \ $_save_dev \ - $_force_lastest \ + $_force_latest \ $_no_color \ $_production ;; @@ -62,7 +62,7 @@ _bower () _arguments \ $_dopts \ $_no_color \ - $_force_lastest + $_force_latest _bower_installed_packages compadd "$@" $(echo $bower_package_list) ;; diff --git a/plugins/catimg/catimg.plugin.zsh b/plugins/catimg/catimg.plugin.zsh index ca46444cc..f4ff6f856 100644 --- a/plugins/catimg/catimg.plugin.zsh +++ b/plugins/catimg/catimg.plugin.zsh @@ -2,7 +2,7 @@ # catimg script by Eduardo San Martin Morote aka Posva # # https://posva.net # # # -# Ouput the content of an image to the stdout using the 256 colors of the # +# Output the content of an image to the stdout using the 256 colors of the # # terminal. # # GitHub: https://github.com/posva/catimg # ################################################################################ diff --git a/plugins/catimg/catimg.sh b/plugins/catimg/catimg.sh index 713a03291..f58392428 100644 --- a/plugins/catimg/catimg.sh +++ b/plugins/catimg/catimg.sh @@ -2,7 +2,7 @@ # catimg script by Eduardo San Martin Morote aka Posva # # https://posva.net # # # -# Ouput the content of an image to the stdout using the 256 colors of the # +# Output the content of an image to the stdout using the 256 colors of the # # terminal. # # GitHub: https://github.com/posva/catimg # ################################################################################ diff --git a/plugins/chucknorris/fortunes/chucknorris b/plugins/chucknorris/fortunes/chucknorris index 6ba5bb9b5..9e36ce89a 100644 --- a/plugins/chucknorris/fortunes/chucknorris +++ b/plugins/chucknorris/fortunes/chucknorris @@ -228,7 +228,7 @@ Chuck Norris once punched the ground to stop an earthquake. The resulting afters % Chuck Norris once round-house kicked a salesman. Over the phone. % -Chuck Norris once rounhouse kicked a football. The astronomical society now considers it a planet. +Chuck Norris once roundhouse kicked a football. The astronomical society now considers it a planet. % Chuck Norris once thought he was wrong. He was, however, mistaken. % @@ -342,7 +342,7 @@ Every time there's an earthquake, you know Chuck Norris is hungry. The earthquak % Evolution's driving mechanism is nature's desperate attempt to escape Chuck Norris. % -Fear of spiders is arachnaphobia. Fear of tight spaces is claustrophobia. Fear of Chuck Norris is called Logic. +Fear of spiders is arachnophobia. Fear of tight spaces is claustrophobia. Fear of Chuck Norris is called Logic. % Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face. % @@ -426,7 +426,7 @@ Some people ask for a Kleenex when they sneeze, Chuck Norris asks for a body bag % Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre. % -Staring at Chuck Norris for extended periods of time without proper eye protection will cause blindess, and possibly foot sized brusies on the face. +Staring at Chuck Norris for extended periods of time without proper eye protection will cause blindness, and possibly foot sized bruises on the face. % Taking Karate Lessons = $100, Buying MMA DVD's = $150, Subscribing to a UFC event = $50, Getting a Roundhouse Kick from Chuck Norris = PRICELESS. % @@ -452,7 +452,7 @@ The best part of waking up is not Folgers in your cup. it's knowing that Chuck N % The chief export of Chuck Norris is pain. % -The dictionary references Chuck Norris several times, he is metioned under Fear, Law, Order and Chucktatorship. +The dictionary references Chuck Norris several times, he is mentioned under Fear, Law, Order and Chucktatorship. % The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer. % @@ -468,7 +468,7 @@ The only way sharks will come near CN underwater is when CN is inside of a cage. % The only word that rhymes with orange is Chuck Norris. % -The producers of the movie "The Last Airbender" are now in talks with Chuck Norris in Order to star him in their next sequal "The Last Skull Bender". +The producers of the movie "The Last Airbender" are now in talks with Chuck Norris in Order to star him in their next sequel "The Last Skull Bender". % The quickest way to a man's heart is with Chuck Norris' fist. % diff --git a/plugins/colorize/colorize.plugin.zsh b/plugins/colorize/colorize.plugin.zsh index 8ea98f80a..a9da6cf83 100644 --- a/plugins/colorize/colorize.plugin.zsh +++ b/plugins/colorize/colorize.plugin.zsh @@ -82,7 +82,7 @@ colorize_less() { # This variable tells less to pipe every file through the specified command # (see the man page of less INPUT PREPROCESSOR). # 'zsh -ic "colorize_cat %s 2> /dev/null"' would not work for huge files like - # the ~/.zsh_history. For such files the tty of the preprocessor will be supended. + # the ~/.zsh_history. For such files the tty of the preprocessor will be suspended. # Therefore we must source this file to make colorize_cat available in the # preprocessor without the interactive mode. # `2>/dev/null` will suppress the error for large files 'broken pipe' of the python diff --git a/plugins/cpanm/_cpanm b/plugins/cpanm/_cpanm index ff9ae1c15..f328dd997 100644 --- a/plugins/cpanm/_cpanm +++ b/plugins/cpanm/_cpanm @@ -36,7 +36,7 @@ arguments=( '--reinstall[Reinstall the distribution even if you already have the latest version installed]' '--interactive[Turn on interactive configure]' - '--scandeps[Scan the depencencies of given modules and output the tree in a text format]' + '--scandeps[Scan the dependencies of given modules and output the tree in a text format]' '--format[Specify what format to display the scanned dependency tree]:scandeps format:(tree json yaml dists)' '--save-dists[Specify the optional directory path to copy downloaded tarballs]' diff --git a/plugins/docker-machine/_docker-machine b/plugins/docker-machine/_docker-machine index 7c19ba8e7..fbd36d7c6 100644 --- a/plugins/docker-machine/_docker-machine +++ b/plugins/docker-machine/_docker-machine @@ -90,7 +90,7 @@ __docker-machine_filters() { } __get_swarm_discovery() { - declare -a masters serivces + declare -a masters services local service services=() masters=($(docker-machine ls -f {{.Swarm}} |grep '(master)' |awk '{print $1}')) @@ -169,7 +169,7 @@ __get_create_argument() { __docker-machine_subcommand() { local -a opts_help opts_help=("(- :)--help[Print usage]") - local -a opts_only_host opts_driver opts_storage_driver opts_stragery + local -a opts_only_host opts_driver opts_storage_driver opts_state opts_only_host=( "$opts_help" "*:host:__docker-machine_hosts_all" @@ -330,7 +330,7 @@ _docker-machine() { _arguments -C \ "(- :)"{-h,--help}"[Show help]" \ "(-D --debug)"{-D,--debug}"[Enable debug mode]" \ - '(-s --stroage-path)'{-s,--storage-path}'[Configures storage path]:file:_files' \ + '(-s --storage-path)'{-s,--storage-path}'[Configures storage path]:file:_files' \ '--tls-ca-cert[CA to verify remotes against]:file:_files' \ '--tls-ca-key[Private key to generate certificates]:file:_files' \ '--tls-client-cert[Client cert to use for TLS]:file:_files' \ diff --git a/plugins/dotnet/dotnet.plugin.zsh b/plugins/dotnet/dotnet.plugin.zsh index 5bc1587c5..8ea31cdbd 100644 --- a/plugins/dotnet/dotnet.plugin.zsh +++ b/plugins/dotnet/dotnet.plugin.zsh @@ -12,7 +12,7 @@ _dotnet_zsh_complete() return fi - # This is not a variable assigment, don't remove spaces! + # This is not a variable assignment, don't remove spaces! _values = "${(ps:\n:)completions}" } diff --git a/plugins/emoji/emoji.plugin.zsh b/plugins/emoji/emoji.plugin.zsh index 7876f1c89..f70e09320 100644 --- a/plugins/emoji/emoji.plugin.zsh +++ b/plugins/emoji/emoji.plugin.zsh @@ -20,7 +20,7 @@ unset _omz_emoji_plugin_dir # These additional emoji are not in the definition file, but are useful in conjunction with it -# This is a combinin character that can be placed after any other character to surround +# This is a combining character that can be placed after any other character to surround # it in a "keycap" symbol. # The digits 0-9 are already in the emoji table as keycap_digit_, keycap_ten, etc. # It's unclear whether this should be in the $emoji array, because those characters are all ones diff --git a/plugins/fastfile/fastfile.plugin.zsh b/plugins/fastfile/fastfile.plugin.zsh index ccbbce3b2..6288bb275 100644 --- a/plugins/fastfile/fastfile.plugin.zsh +++ b/plugins/fastfile/fastfile.plugin.zsh @@ -18,7 +18,7 @@ default fastfile_var_prefix "§" # 1. name - The name of the shortcut (default: name of the file) # 2. file - The file or directory to make the shortcut for # STDOUT: -# => fastfle_print +# => fastfile_print # function fastfile() { test "$2" || 2="." @@ -75,14 +75,14 @@ function fastfile_print() { # List all shortcuts # # STDOUT: -# (=> fastfle_print) for each shortcut +# (=> fastfile_print) for each shortcut # function fastfile_ls() { for f in "${fastfile_dir}"/*(NF); do - file=`basename "$f"` # To enable simpler handeling of spaces in file names + file=`basename "$f"` # To enable simpler handling of spaces in file names varkey=`echo "$file" | tr " " "_"` - # Special format for colums + # Special format for columns echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")" done | column -t -s "|" } @@ -93,7 +93,7 @@ function fastfile_ls() { # Arguments: # 1. name - The name of the shortcut (default: name of the file) # STDOUT: -# => fastfle_print +# => fastfile_print # function fastfile_rm() { fastfile_print "$1" @@ -105,7 +105,7 @@ function fastfile_rm() { # function fastfile_sync() { for f in "${fastfile_dir}"/*(NF); do - file=`basename "$f"` # To enable simpler handeling of spaces in file names + file=`basename "$f"` # To enable simpler handling of spaces in file names varkey=`echo "$file" | tr " " "_"` alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'" diff --git a/plugins/fd/README.md b/plugins/fd/README.md index aabd624b8..4d9cf190f 100644 --- a/plugins/fd/README.md +++ b/plugins/fd/README.md @@ -10,4 +10,4 @@ plugins=(... fd) Completion is taken from the fd release [`7.3.0`](https://github.com/sharkdp/fd/releases/tag/v7.3.0). -Updated on Febrary 13th, 2019. +Updated on February 13th, 2019. diff --git a/plugins/flutter/README.md b/plugins/flutter/README.md index be419144f..9c8169afc 100644 --- a/plugins/flutter/README.md +++ b/plugins/flutter/README.md @@ -18,4 +18,4 @@ plugins=(... flutter) | `flb` | `flutter build` | Build flutter application | | `flattach` | `flutter attach` | Attaches flutter to a running flutter application with enabled observatory | | `flget` | `flutter packages get` | Installs dependencies | -| `flc` | `flutter clean` | Cleans flutter porject | +| `flc` | `flutter clean` | Cleans flutter project | diff --git a/plugins/fzf/README.md b/plugins/fzf/README.md index 791a3eb6f..15d4d31f3 100644 --- a/plugins/fzf/README.md +++ b/plugins/fzf/README.md @@ -26,7 +26,7 @@ export FZF_BASE=/path/to/fzf/install/dir Set default command to use when input is tty: ```zsh -export FZF_DEFAULT_COMMAND='' +export FZF_DEFAULT_COMMAND='' ``` If not set, the plugin will try to set it to these, in the order in which they're found: diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash index 4497a294f..f7b09b2c1 100644 --- a/plugins/gitfast/git-completion.bash +++ b/plugins/gitfast/git-completion.bash @@ -3383,7 +3383,7 @@ _git_worktree () # Here we are not completing an --option, it's either the # path or a ref. case "$prev" in - -b|-B) # Complete refs for branch to be created/reseted. + -b|-B) # Complete refs for branch to be created/reset. __git_complete_refs ;; -*) # The previous word is an -o|--option without an diff --git a/plugins/grails/grails.plugin.zsh b/plugins/grails/grails.plugin.zsh index 11777738c..ddc257428 100644 --- a/plugins/grails/grails.plugin.zsh +++ b/plugins/grails/grails.plugin.zsh @@ -1,5 +1,5 @@ _enumerateGrailsScripts() { - # Default directoryies + # Default directories directories=($GRAILS_HOME/scripts ~/.grails/scripts ./scripts) # Check all of the plugins directories, if they exist diff --git a/plugins/grunt/grunt.plugin.zsh b/plugins/grunt/grunt.plugin.zsh index 3f9695177..a89469a59 100644 --- a/plugins/grunt/grunt.plugin.zsh +++ b/plugins/grunt/grunt.plugin.zsh @@ -82,7 +82,7 @@ function __grunt() { update_msg=' (cache updated)' fi - # Make optioins completion. + # Make options completion. if [[ ${#__grunt_opts} -gt 0 ]]; then opts+=("${__grunt_opts[@]}") fi @@ -161,7 +161,7 @@ function __grunt_update_cache() { fi if [[ $is_updating -ne 0 ]]; then - # Update caceh. + # Update cache. __grunt_version=$version __grunt_gruntfile=$gruntfile is_updating=1 diff --git a/plugins/history-substring-search/history-substring-search.zsh b/plugins/history-substring-search/history-substring-search.zsh index a791cc4da..c326778d4 100644 --- a/plugins/history-substring-search/history-substring-search.zsh +++ b/plugins/history-substring-search/history-substring-search.zsh @@ -243,8 +243,8 @@ _history-substring-search-begin() { fi # - # Escape and join query parts with wildcard character '*' as seperator - # `(j:CHAR:)` join array to string with CHAR as seperator + # Escape and join query parts with wildcard character '*' as separator + # `(j:CHAR:)` join array to string with CHAR as separator # local search_pattern="*${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*" diff --git a/plugins/ipfs/_ipfs b/plugins/ipfs/_ipfs index 9ee8bd79c..90c0a61c8 100644 --- a/plugins/ipfs/_ipfs +++ b/plugins/ipfs/_ipfs @@ -596,7 +596,7 @@ case $MAIN_SUBCOMMAND in '(-v --headers)'{-v,--headers}'[Print table headers (Hash, Size, Name).]' \ '--resolve-type[Resolve linked objects to find out their types. Default: true.]' \ '--size[Resolve linked objects to find out their file size. Default: true.]' \ - '(-s --stream)'{-s,--stream}'[Enable exprimental streaming of directory entries as they are traversed.]' \ + '(-s --stream)'{-s,--stream}'[Enable experimental streaming of directory entries as they are traversed.]' \ ;; (mount) _arguments \ diff --git a/plugins/iterm2/iterm2.plugin.zsh b/plugins/iterm2/iterm2.plugin.zsh index e4ac72ee3..9d8e40bf6 100644 --- a/plugins/iterm2/iterm2.plugin.zsh +++ b/plugins/iterm2/iterm2.plugin.zsh @@ -8,7 +8,7 @@ if [[ "$OSTYPE" == darwin* ]] && [[ -n "$ITERM_SESSION_ID" ]] ; then ### - # Executes an arbitrary iTerm2 command via an escape code sequce. + # Executes an arbitrary iTerm2 command via an escape code sequence. # See https://iterm2.com/documentation-escape-codes.html for all supported commands. # Example: $ _iterm2_command "1337;StealFocus" function _iterm2_command() { diff --git a/plugins/jenv/README.md b/plugins/jenv/README.md index c043c626e..148794197 100644 --- a/plugins/jenv/README.md +++ b/plugins/jenv/README.md @@ -1,6 +1,6 @@ # jenv plugin -[jenv](https://www.jenv.be/) is a Java version manager similiar to [rbenv](https://github.com/rbenv/rbenv) +[jenv](https://www.jenv.be/) is a Java version manager similar to [rbenv](https://github.com/rbenv/rbenv) and [pyenv](https://github.com/yyuu/pyenv). This plugin initializes jenv and provides the `jenv_prompt_info` function to add Java diff --git a/plugins/macos/spotify b/plugins/macos/spotify index 663215a74..491a60686 100644 --- a/plugins/macos/spotify +++ b/plugins/macos/spotify @@ -191,7 +191,7 @@ while [ $# -gt 0 ]; do -d "grant_type=client_credentials" \ ) if ! [[ "${SPOTIFY_TOKEN_RESPONSE_DATA}" =~ "access_token" ]]; then - cecho "Autorization failed, please check ${USER_CONFG_FILE}" + cecho "Authorization failed, please check ${USER_CONFG_FILE}" cecho "${SPOTIFY_TOKEN_RESPONSE_DATA}" showAPIHelp return 1 diff --git a/plugins/mercurial/README.md b/plugins/mercurial/README.md index 756964896..4beee0a95 100644 --- a/plugins/mercurial/README.md +++ b/plugins/mercurial/README.md @@ -61,7 +61,7 @@ ZSH_THEME_HG_PROMPT_CLEAN="%{$fg[magenta]%})" This is the same as git plugin does. **Note**: additional changes to `.zshrc`, or using a theme designed to use `hg_prompt_info`, are required in order for this to work. -## Mantainers +## Maintainers - [ptrv](https://github.com/ptrv): original creator - [oshybystyi](https://github.com/oshybystyi) diff --git a/plugins/npm/README.md b/plugins/npm/README.md index 47d153619..e970c3c7a 100644 --- a/plugins/npm/README.md +++ b/plugins/npm/README.md @@ -10,7 +10,7 @@ plugins=(... npm) ## Aliases -| Alias | Command | Descripton | +| Alias | Command | Description | |:------ |:-----------------------------|:----------------------------------------------------------------| | `npmg` | `npm i -g` | Install dependencies globally | | `npmS` | `npm i -S` | Install and save to dependencies in your package.json | diff --git a/plugins/pep8/_pep8 b/plugins/pep8/_pep8 index ce19951dc..27b7fc544 100644 --- a/plugins/pep8/_pep8 +++ b/plugins/pep8/_pep8 @@ -29,6 +29,6 @@ _arguments -s -S \ "--max-line-length[set maximum allowed line length (default: 79)]::n:_files" \ "--format[set the error format \[default|pylint|\]]::format:_files" \ "--diff[report only lines changed according to the unified diff received on STDIN]" \ - "--benchmark[measure processing speed are read from the \[pep8\] section of the tox.ini fg file located in any parent folder of the path(s) llowed options are: exclude, filename, select, ngth, count, format, quiet, show-pep8, show-source, .]" \ + "--benchmark[measure processing speed are read from the \[pep8\] section of the tox.ini fg file located in any parent folder of the path(s) allowed options are: exclude, filename, select, ngth, count, format, quiet, show-pep8, show-source, .]" \ "--config[user config file location (default: /home/gsemet/.config/pep8)]::path:_files" \ "*::args:_files" diff --git a/plugins/please/README.md b/plugins/please/README.md index 89bfbf105..0a33f897b 100644 --- a/plugins/please/README.md +++ b/plugins/please/README.md @@ -1,7 +1,7 @@ # please plugin [Please](https://please.build) is a cross-language build system with an emphasis on -high performance, extensibility and reproduceability. It supports a number of popular +high performance, extensibility and reproducibility. It supports a number of popular languages and can automate nearly any aspect of your build process. This plugin adds autocomplete and major aliases for `plz`, the command line tool for diff --git a/plugins/pm2/_pm2 b/plugins/pm2/_pm2 index 6f1e89df5..86412aef1 100644 --- a/plugins/pm2/_pm2 +++ b/plugins/pm2/_pm2 @@ -124,7 +124,7 @@ logs_options=( '--out[only shows standard output]' '--lines[output the last N lines, instead of the last 15 by default]' '--timestamp[add timestamps (default format YYYY-MM-DD-HH:mm:ss)]' - '--nostream[print logs without lauching the log stream]' + '--nostream[print logs without launching the log stream]' '(-h --help)'{-h,--help}'[output usage information]' $id_all_comp ) @@ -139,7 +139,7 @@ case "$words[1]" in stop|restart|delete|reload|reset) _arguments $id_all_comp && return 0 ;; - env|inspect|monitor|unmonitor|discribe) + env|inspect|monitor|unmonitor|describe) _arguments $id_comp && return 0 ;; deploy|startOrRestart|startOrReload) diff --git a/plugins/powify/_powify b/plugins/powify/_powify index 9507f400e..57042aa63 100644 --- a/plugins/powify/_powify +++ b/plugins/powify/_powify @@ -15,7 +15,7 @@ _1st_arguments=( 'restart:restarts the pow app linked to the current directory' 'always_restart:reload the pow app after each request' 'always_restart_off:do not reload the pow app after each request' - 'rename:rename the current pow app to [NAME] or renmae [OLD] to [NEW]' + 'rename:rename the current pow app to [NAME] or rename [OLD] to [NEW]' 'environment:run the this pow app in a different environment (aliased `env`)' 'browse:opens and navigates the default browser to this app' 'logs:tail the application logs' diff --git a/plugins/rake/rake.plugin.zsh b/plugins/rake/rake.plugin.zsh index 121150017..3ceb20fea 100644 --- a/plugins/rake/rake.plugin.zsh +++ b/plugins/rake/rake.plugin.zsh @@ -2,7 +2,7 @@ # over the years. We will miss you dearly. alias jimweirich="rake" -alias rake="noglob rake" # allows square brackts for rake task invocation +alias rake="noglob rake" # allows square brackets for rake task invocation alias brake='noglob bundle exec rake' # execute the bundled rake gem alias srake='noglob sudo rake' # noglob must come before sudo alias sbrake='noglob sudo bundle exec rake' # altogether now ... diff --git a/plugins/rebar/_rebar b/plugins/rebar/_rebar index 7ac5a510c..ea0d8a674 100644 --- a/plugins/rebar/_rebar +++ b/plugins/rebar/_rebar @@ -32,7 +32,7 @@ _rebar () { 'create[Create skel based on template and vars]' \ 'create-app[Create simple app skel]' \ 'create-node[Create simple node skel]' \ - 'list-template[List avaiavle templates]' \ + 'list-template[List available templates]' \ 'doc[Generate Erlang program documentation]' \ 'check-deps[Display to be fetched dependencies]' \ 'get-deps[Fetch dependencies]' \ diff --git a/plugins/redis-cli/_redis-cli b/plugins/redis-cli/_redis-cli index 1569f2916..f93624565 100644 --- a/plugins/redis-cli/_redis-cli +++ b/plugins/redis-cli/_redis-cli @@ -8,7 +8,7 @@ _1st_arguments=( 'append:append a value to a key' 'auth:authenticate to the server' 'bgrewriteeaof:asynchronously rewrite the append-only file' - 'bgsave:asynchornously save the dataset to disk' + 'bgsave:asynchronously save the dataset to disk' 'blpop:remove and get the first element in a list, or block until one is available' 'brpop:remove and get the last element in a list, or block until one is available' 'brpoplpush:pop a value from a list, push it to another list and return it; or block until one is available' @@ -17,9 +17,9 @@ _1st_arguments=( # 'config resetstat: reset the stats returned by INFO' 'dbsize:return the number of keys in the selected database' # 'debug object:get debugging information about a key' - # 'debug setgfault:make the server crash' + # 'debug segfault:make the server crash' 'decr:decrement the integer value of a key by one' - 'decrby:decrement the integet value of a key by the given number' + 'decrby:decrement the integer value of a key by the given number' 'del:delete a key' 'discard:discard all commands issued after MULTI' 'echo:echo the given string' @@ -63,7 +63,7 @@ _1st_arguments=( 'mget:get the values of all the given keys' 'monitor:listen for all requests received by the server in real time' 'move:move a key to another database' - 'mset:set multiple keys to muliple values' + 'mset:set multiple keys to multiple values' 'msetnx:set multiple keys tom ultiple values, only if none of the keys exist' 'multi:mark the start of a transaction block' 'object:inspect the internals of Redis objects' @@ -122,7 +122,7 @@ _1st_arguments=( 'zrem:remove a member from a sorted set' 'zremrangebyrank:remove all members in a sorted set within the given indexes' 'zremrangebyscore:remove all members in a sorted set within the given scores' - 'zrevrange:return a range of membrs in a sorted set, by index, with scores ordered from high to low' + 'zrevrange:return a range of members in a sorted set, by index, with scores ordered from high to low' 'zrevrangebyscore:return a range of members in a sorted set, by score, with scores ordered from high to low' 'zrevrank:determine the index of a member in a sorted set, with scores ordered from high to low' 'zscore:get the score associated with the given member in a sorted set' diff --git a/plugins/salt/_salt b/plugins/salt/_salt index 78d8611d2..a1c55f350 100644 --- a/plugins/salt/_salt +++ b/plugins/salt/_salt @@ -145,7 +145,7 @@ _master_options=( '(-v --verbose)'{-v,--verbose}'[Turn on command verbosity, display jid and active job queries]' '--hide-timeout[Hide minions that timeout]' '(-b --batch --batch-size)'{-b,--batch,--batch-size}'[Execute the salt job in batch mode, pass number or percentage to batch.]:Batch Size:' - '(-a --auth --eauth --extrenal-auth)'{-a,--auth,--eauth,--external-auth}'[Specify an external authentication system to use.]:eauth:' + '(-a --auth --eauth --external-auth)'{-a,--auth,--eauth,--external-auth}'[Specify an external authentication system to use.]:eauth:' '(-T --make-token)'{-T,--make-token}'[Generate and save an authentication token for re-use.]' '--return[Set an alternative return method.]:Returners:_path_files -W "$salt_dir/returners" -g "[^_]*.py(\:r)"' '(-d --doc --documentation)'{-d,--doc,--documentation}'[Return the documentation for the specified module]' diff --git a/plugins/scala/_scala b/plugins/scala/_scala index f7511a647..ba7ac3874 100644 --- a/plugins/scala/_scala +++ b/plugins/scala/_scala @@ -190,7 +190,7 @@ Y_opts=( "-Yshow-symkinds[Print abbreviated symbol kinds next to symbol names]" "-Yshow-trees[Print detailed ASTs (requires -Xprint\:phase)]" "-Yshow-trees-compact[Print detailed ASTs in compact form (requires -Xprint\:)]" - "-Yshow-trees-stringified[Print stringifications along with detailed ASTs (requires -Xprint\:)]" + "-Yshow-trees-stringified[Print stringification along with detailed ASTs (requires -Xprint\:)]" "-Ystatistics[Print compiler statistics]" "-Ystruct-dispatch\:-[Structural method dispatch policy (default\: poly-cache)]:policy name:(no-cache mono-cache poly-cache invoke-dynamic)" diff --git a/plugins/sfdx/_sfdx b/plugins/sfdx/_sfdx index 42ee55970..3a441f257 100644 --- a/plugins/sfdx/_sfdx +++ b/plugins/sfdx/_sfdx @@ -900,7 +900,7 @@ case "$words[1]" in force:data:tree:export) _command_args=( '(-q|--query)'{-q,--query}'[soql query, or filepath of file containing a soql query, to retrieve records]' \ - '(-p|--plan)'{-p,--plan}'[generate mulitple sobject tree files and a plan definition file for aggregated import]' \ + '(-p|--plan)'{-p,--plan}'[generate multiple sobject tree files and a plan definition file for aggregated import]' \ '(-x|--prefix)'{-x,--prefix}'[prefix of generated files]' \ '(-d|--outputdir)'{-d,--outputdir}'[directory to store files]:file:_files' \ '(-u|--targetusername)'{-u,--targetusername}'[username or alias for the target org; overrides default target org]' \ diff --git a/plugins/sprunge/README.md b/plugins/sprunge/README.md index 28ed1834a..fb70d42eb 100644 --- a/plugins/sprunge/README.md +++ b/plugins/sprunge/README.md @@ -28,5 +28,5 @@ http://sprunge.us/XxjnKz - Sprunge accepts piped data, stdin redirection, text strings as input or filenames. Only one of these can be used at a time. - Argument precedence goes as follows: stdin > piped input > text strings. -- If a filename is mispelled or doesn't have the necessary path description, it will NOT +- If a filename is misspelled or doesn't have the necessary path description, it will NOT generate an error, but instead treat it as a text string. diff --git a/plugins/supervisor/_supervisorctl b/plugins/supervisor/_supervisorctl index 9f576c0c0..87cffab86 100644 --- a/plugins/supervisor/_supervisorctl +++ b/plugins/supervisor/_supervisorctl @@ -109,27 +109,27 @@ _supervisorctl_maintail() { _supervisorctl_start() { # TODO: add 'all' _arguments -s \ - '*::supvervisor process:_get_supervisor_procs' + '*::supervisor process:_get_supervisor_procs' } (( $+functions[_supervisorctl_restart] )) || _supervisorctl_restart() { # TODO: add 'all' _arguments -s \ - '*::supvervisor process:_get_supervisor_procs' + '*::supervisor process:_get_supervisor_procs' } (( $+functions[_supervisorctl_status] )) || _supervisorctl_status() { _arguments \ - '*::supvervisor process:_get_supervisor_procs' + '*::supervisor process:_get_supervisor_procs' } (( $+functions[_supervisorctl_stop] )) || _supervisorctl_stop() { # TODO: add 'all' _arguments -s \ - '*::supvervisor process:_get_supervisor_procs' + '*::supervisor process:_get_supervisor_procs' } (( $+functions[_supervisorctl_tail] )) || @@ -137,7 +137,7 @@ _supervisorctl_tail() { # TODO: add 'stderr' _arguments -s \ '-f[Continuous tail of named process stdout Ctrl-C to exit.]' \ - '*::supvervisor process:_get_supervisor_procs' + '*::supervisor process:_get_supervisor_procs' } _supervisorctl "$@" diff --git a/plugins/supervisor/supervisor.plugin.zsh b/plugins/supervisor/supervisor.plugin.zsh index f11f0ed3f..ad5430275 100644 --- a/plugins/supervisor/supervisor.plugin.zsh +++ b/plugins/supervisor/supervisor.plugin.zsh @@ -1,4 +1,4 @@ -# DECLARION: This plugin was created by hhatto. What I did is just making a portal from https://bitbucket.org/hhatto/zshcompfunc4supervisor. +# DECLARATION: This plugin was created by hhatto. What I did is just making a portal from https://bitbucket.org/hhatto/zshcompfunc4supervisor. alias sup='sudo supervisorctl' alias supad='sudo supervisorctl add' diff --git a/plugins/suse/README.md b/plugins/suse/README.md index 06c6d9ef5..f37ec1695 100644 --- a/plugins/suse/README.md +++ b/plugins/suse/README.md @@ -62,7 +62,7 @@ plugins=(... suse) NOTE: `--no-refresh` is passed to zypper for speeding up the calls and avoid errors due to lack of root privileges. If you need to refresh the repositories, call `sudo zypper ref` (`zref` alias) -before runing these aliases. +before running these aliases. Related: [#9798](https://github.com/ohmyzsh/ohmyzsh/pull/9798). diff --git a/plugins/symfony2/README.md b/plugins/symfony2/README.md index 2946d0937..76233472f 100644 --- a/plugins/symfony2/README.md +++ b/plugins/symfony2/README.md @@ -17,7 +17,7 @@ plugins=(... symfony2) | `sfsr` | sf server:run | Run the dev server | | `sfcw` | sf cache:warmup | Use the Bundles warmer | | `sfroute` | sf debug:router | Show the different routes | -| `sfcontainer` | sf debug:contaner | List the different services | +| `sfcontainer` | sf debug:container | List the different services | | `sfgb` | sf generate:bundle | Generate a bundle | | `sfgc` | sf generate:controller | Generate a controller | | `sfgcom` | sf generate:command | Generate a command | diff --git a/plugins/systemadmin/systemadmin.plugin.zsh b/plugins/systemadmin/systemadmin.plugin.zsh index 2f9d1ef35..9a2129060 100644 --- a/plugins/systemadmin/systemadmin.plugin.zsh +++ b/plugins/systemadmin/systemadmin.plugin.zsh @@ -27,7 +27,7 @@ alias mkdir='mkdir -pv' # get top process eating memory alias psmem='ps -e -orss=,args= | sort -b -k1 -nr' alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -n 10' -# get top process eating cpu if not work try excute : export LC_ALL='C' +# get top process eating cpu if not work try execute : export LC_ALL='C' alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr' alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head -n 10' # top10 of the history @@ -105,7 +105,7 @@ visitpage20() { # top100 of Page lists the most time-consuming (more than 60 seconds) as well as the corresponding page number of occurrences consume100() { awk '($NF > 60 && $7~/\.php/){print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100 - # if django website or other webiste make by no suffix language + # if django website or other website make by no suffix language # awk '{print $7}' "$(retlog)" |sort -n|uniq -c|sort -nr|head -n 100 } diff --git a/plugins/terminitor/_terminitor b/plugins/terminitor/_terminitor index 1ce87c3ad..3615350e2 100644 --- a/plugins/terminitor/_terminitor +++ b/plugins/terminitor/_terminitor @@ -11,7 +11,7 @@ local -a _1st_arguments _1st_arguments=( 'create:create a Termfile in directory' 'delete:delete terminitor script' - 'edit:open termitor script' + 'edit:open terminitor script' 'fetch:clone the designated repo and run setup' 'help:Describe available tasks or one specific task' 'init:create initial root terminitor folder' diff --git a/plugins/ubuntu/README.md b/plugins/ubuntu/README.md index f72182f5c..9efef0732 100644 --- a/plugins/ubuntu/README.md +++ b/plugins/ubuntu/README.md @@ -19,7 +19,7 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other | acp | `apt-cache policy` | Display the package source priorities | | afs | `apt-file search --regexp` | Perform a regular expression apt-file search | | afu | `sudo apt-file update` | Generates or updates the apt-file package database | -| aga | `sudo $APT autoclean` | Clears out the local reposityory of retrieved package files that can no longer be downloaded | +| aga | `sudo $APT autoclean` | Clears out the local repository of retrieved package files that can no longer be downloaded | | agb | `sudo $APT build-dep ` | Installs/Removes packages to satisfy the dependencies of a specified build pkg | | agc | `sudo $APT clean` | Clears out the local repository of retrieved package files leaving everything from the lock files | | agd | `sudo $APT dselect-upgrade` | Follows dselect choices for package installation | diff --git a/plugins/vault/_vault b/plugins/vault/_vault index c5338dffa..f6bd3517e 100644 --- a/plugins/vault/_vault +++ b/plugins/vault/_vault @@ -53,7 +53,7 @@ mount_tune_args=( typeset -a mount_args mount_args=( $mount_tune_args - '(-path)-path=-[Mount point for the logical backend. This defauls to the type of the mount.]:path:' + '(-path)-path=-[Mount point for the logical backend. This defaults to the type of the mount.]:path:' '(-description)-description=-[Human-friendly description of the purpose for the mount. This shows up in the mounts command.]:description:' ) @@ -189,7 +189,7 @@ _vault_mounts() { } _vault_mount() { - # to find out how many types of backens are there + # to find out how many types of backends are there _arguments : \ ${general_args[@]} \ ${mount_args[@]} \ diff --git a/plugins/yarn/_yarn b/plugins/yarn/_yarn index 70ed55929..9173eca20 100644 --- a/plugins/yarn/_yarn +++ b/plugins/yarn/_yarn @@ -157,7 +157,7 @@ _yarn() { '(--emoji)--no-emoji[disable emoji in output]' \ '(--disable-pnp)'{--enable-pnp,--pnp}"[enable the Plug'n'Play installation]" \ '--flat[only allow one version of a package]' \ - '--focus[Focus on a single workspace by installing remote copies of its sibiling workspaces]' \ + '--focus[Focus on a single workspace by installing remote copies of its sibling workspaces]' \ '--force[install and build packages even if they were built before, overwrite lockfile]' \ "--frozen-lockfile[don't generate a lockfile and fail if an update is needed]" \ '--global-folder=[modules folder]:folder:_files -/' \ diff --git a/plugins/yum/yum.plugin.zsh b/plugins/yum/yum.plugin.zsh index 69abfc4ce..d36571133 100644 --- a/plugins/yum/yum.plugin.zsh +++ b/plugins/yum/yum.plugin.zsh @@ -7,7 +7,7 @@ alias ygl="yum grouplist" # list package groups alias yli="yum list installed" # print all installed packages alias ymc="yum makecache" # rebuilds the yum package list -alias yu="sudo yum update" # upgrate packages +alias yu="sudo yum update" # upgrade packages alias yi="sudo yum install" # install package alias ygi="sudo yum groupinstall" # install package group alias yr="sudo yum remove" # remove package diff --git a/themes/dallas.zsh-theme b/themes/dallas.zsh-theme index d6c417fc3..4f8be20d3 100644 --- a/themes/dallas.zsh-theme +++ b/themes/dallas.zsh-theme @@ -9,7 +9,7 @@ DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}" DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}\$(parse_git_dirty)" # Grab the current username: dallas DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}" -# Use a % for normal users and a # for privelaged (root) users. +# Use a % for normal users and a # for privileged (root) users. DALLAS_PROMPT_CHAR_="%{$fg[white]%}%(!.#.%%)%{$reset_color%}" # For the git prompt, use a white @ and blue text for the branch name ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[white]%}@%{$fg[blue]%}" diff --git a/themes/essembeh.zsh-theme b/themes/essembeh.zsh-theme index f34f36f8a..43d4093b1 100644 --- a/themes/essembeh.zsh-theme +++ b/themes/essembeh.zsh-theme @@ -39,7 +39,7 @@ elif [[ -r /etc/debian_chroot ]]; then # prefix prompt in case of chroot ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[chroot:$(cat /etc/debian_chroot)]%{$reset_color%} " elif [[ -r /.dockerenv ]]; then - # also prefix prompt inside a docker contrainer + # also prefix prompt inside a docker container ZSH_ESSEMBEH_PREFIX="%{$fg[yellow]%}[docker]%{$reset_color%} " fi if [[ $UID = 0 ]]; then diff --git a/themes/nicoulaj.zsh-theme b/themes/nicoulaj.zsh-theme index 333aa5e70..685cd1ade 100644 --- a/themes/nicoulaj.zsh-theme +++ b/themes/nicoulaj.zsh-theme @@ -6,7 +6,7 @@ # * Only shows the path on the left prompt by default. # * Crops the path to a defined length and only shows the path relative to # the current VCS repository root. -# * Wears a different color wether the last command succeeded/failed. +# * Wears a different color whether the last command succeeded/failed. # * Shows user@hostname if connected through SSH. # * Shows if logged in as root or not. # ------------------------------------------------------------------------------ -- cgit v1.2.3-70-g09d2 From 137b45672dd182e798f7bd0c580aa9b634657990 Mon Sep 17 00:00:00 2001 From: Romain Failliot Date: Sun, 18 Feb 2018 19:27:50 -0500 Subject: feat(bira): improve theme and add support for mercurial (#6631) Added the red dot (instead of the default `*`) if the branch is dirty. The bira theme only supported git, now it supports mercurial as well. It needed ito call `hg_prompt_info` and the `ZSH_THEME_HG_PROMPT_` variables. Closes #6631 --- themes/bira.zsh-theme | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'themes') diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme index cdae68d6c..4a05bf3bb 100644 --- a/themes/bira.zsh-theme +++ b/themes/bira.zsh-theme @@ -1,32 +1,32 @@ -# ZSH Theme - Preview: https://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +local user_host="%B%(!.%F{red}.%F{green})%n@%m %{$reset_color%}" +local user_symbol='%(!.#.$)' +local current_dir="%B%{$fg[blue]%}%~ %{$reset_color%}" -if [[ $UID -eq 0 ]]; then - local user_host='%{$terminfo[bold]$fg[red]%}%n@%m %{$reset_color%}' - local user_symbol='#' -else - local user_host='%{$terminfo[bold]$fg[green]%}%n@%m %{$reset_color%}' - local user_symbol='$' -fi - -local current_dir='%{$terminfo[bold]$fg[blue]%}%~ %{$reset_color%}' -local git_branch='$(git_prompt_info)' +local vcs_branch='$(git_prompt_info)$(hg_prompt_info)' local rvm_ruby='$(ruby_prompt_info)' local venv_prompt='$(virtualenv_prompt_info)' ZSH_THEME_RVM_PROMPT_OPTIONS="i v g" -PROMPT="╭─${user_host}${current_dir}${rvm_ruby}${git_branch}${venv_prompt} +PROMPT="╭─${user_host}${current_dir}${rvm_ruby}${vcs_branch}${venv_prompt} ╰─%B${user_symbol}%b " RPROMPT="%B${return_code}%b" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$fg[yellow]%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[yellow]%}" + +ZSH_THEME_HG_PROMPT_PREFIX="$ZSH_THEME_GIT_PROMPT_PREFIX" +ZSH_THEME_HG_PROMPT_SUFFIX="$ZSH_THEME_GIT_PROMPT_SUFFIX" +ZSH_THEME_HG_PROMPT_DIRTY="$ZSH_THEME_GIT_PROMPT_DIRTY" +ZSH_THEME_HG_PROMPT_CLEAN="$ZSH_THEME_GIT_PROMPT_CLEAN" ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹" ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}" ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$fg[green]%}‹" ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="› %{$reset_color%}" -ZSH_THEME_VIRTUALENV_PREFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX -ZSH_THEME_VIRTUALENV_SUFFIX=$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX +ZSH_THEME_VIRTUALENV_PREFIX="$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX" +ZSH_THEME_VIRTUALENV_SUFFIX="$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX" -- cgit v1.2.3-70-g09d2 From 4119f53004de987215e4ae2ce49d0f818ad58c63 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Thu, 2 Dec 2021 11:12:18 +0100 Subject: perf(mercurial): optimize utility functions --- plugins/mercurial/mercurial.plugin.zsh | 101 ++++++++++++++++++++------------- themes/minimal.zsh-theme | 32 ++++++----- 2 files changed, 78 insertions(+), 55 deletions(-) (limited to 'themes') diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index 8b50da9d8..6e72f0b1e 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -21,65 +21,86 @@ alias hgo='hg outgoing' alias hglg='hg log --stat -v' alias hglgp='hg log --stat -p -v' +function hgic() { + hg incoming "$@" | grep "changeset" | wc -l +} + +function hgoc() { + hg outgoing "$@" | grep "changeset" | wc -l +} + +# functions +function hg_root() { + local dir="$PWD" + while [[ "$dir" != "/" ]]; do + if [[ -d "$dir/.hg" ]]; then + echo "$dir" + return 0 + fi + dir="${dir:h}" + done + return 1 +} + function in_hg() { - if $(hg branch > /dev/null 2>&1); then - echo 1 - fi + hg_root >/dev/null } function hg_get_branch_name() { - branch=`hg branch 2>/dev/null` - if [ $? -eq 0 ]; then - echo $branch + local dir + if ! dir=$(hg_root); then + return fi - unset branch -} -function hg_prompt_info { - local info rev branch dirty - - if ! info=$(hg id --id --branch 2>/dev/null); then + if [[ ! -f "$dir/.hg/branch" ]]; then + echo default return fi - rev="${info[(w)1]}" - branch="${${info[(w)2]}:gs/%/%%}" + echo "$(<"$dir/.hg/branch")" +} - if [[ "$rev" = *+ ]]; then - dirty="$ZSH_THEME_HG_PROMPT_DIRTY" - else - dirty="$ZSH_THEME_HG_PROMPT_CLEAN" +function hg_get_bookmark_name() { + local dir + if ! dir=$(hg_root); then + return fi - echo "${ZSH_THEME_HG_PROMPT_PREFIX}${branch}${dirty}${ZSH_THEME_HG_PROMPT_SUFFIX}" + if [[ ! -f "$dir/.hg/bookmarks.current" ]]; then + return + fi + + echo "$(<"$dir/.hg/bookmarks.current")" } -function hg_dirty_choose { - hg status -mar 2> /dev/null | command grep -Eq '^\s*[ACDIM!?L]' - if [ $? -eq 0 ]; then - if [ $pipestatus[-1] -eq 0 ]; then - # Grep exits with 0 when "One or more lines were selected", return "dirty". - echo $1 - return - fi +function hg_prompt_info { + local dir branch dirty + if ! dir=$(hg_root); then + return fi - echo $2 -} -function hg_dirty { - hg_dirty_choose $ZSH_THEME_HG_PROMPT_DIRTY $ZSH_THEME_HG_PROMPT_CLEAN -} + if [[ ! -f "$dir/.hg/branch" ]]; then + branch=default + else + branch="$(<"$dir/.hg/branch")" + fi -function hgic() { - hg incoming "$@" | grep "changeset" | wc -l -} + dirty="$(hg_dirty)" -function hgoc() { - hg outgoing "$@" | grep "changeset" | wc -l + echo "${ZSH_THEME_HG_PROMPT_PREFIX}${branch:gs/%/%%}${dirty}${ZSH_THEME_HG_PROMPT_SUFFIX}" } -function hg_get_bookmark_name() { - if [ $(in_hg) ]; then - echo $(hg id -B) +function hg_dirty { + local hg_status + if ! hg_status="$(hg status -mar 2>/dev/null)"; then + return fi + + # grep exits with 0 when dirty + if command grep -Eq '^\s*[ACDIM!?L]' <<< "$hg_status"; then + echo $ZSH_THEME_HG_PROMPT_DIRTY + return + fi + + echo $ZSH_THEME_HG_PROMPT_CLEAN } diff --git a/themes/minimal.zsh-theme b/themes/minimal.zsh-theme index e05df9c9b..588ab6982 100644 --- a/themes/minimal.zsh-theme +++ b/themes/minimal.zsh-theme @@ -2,23 +2,25 @@ ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[white]%}[" ZSH_THEME_GIT_PROMPT_SUFFIX="" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$fg[white]%}]%{$reset_color%} " ZSH_THEME_GIT_PROMPT_CLEAN="]%{$reset_color%} " -ZSH_THEME_SVN_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX -ZSH_THEME_SVN_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX -ZSH_THEME_SVN_PROMPT_DIRTY=$ZSH_THEME_GIT_PROMPT_DIRTY -ZSH_THEME_SVN_PROMPT_CLEAN=$ZSH_THEME_GIT_PROMPT_CLEAN -ZSH_THEME_HG_PROMPT_PREFIX=$ZSH_THEME_GIT_PROMPT_PREFIX -ZSH_THEME_HG_PROMPT_SUFFIX=$ZSH_THEME_GIT_PROMPT_SUFFIX -ZSH_THEME_HG_PROMPT_DIRTY=$ZSH_THEME_GIT_PROMPT_DIRTY -ZSH_THEME_HG_PROMPT_CLEAN=$ZSH_THEME_GIT_PROMPT_CLEAN + +ZSH_THEME_SVN_PROMPT_PREFIX="$ZSH_THEME_GIT_PROMPT_PREFIX" +ZSH_THEME_SVN_PROMPT_SUFFIX="$ZSH_THEME_GIT_PROMPT_SUFFIX" +ZSH_THEME_SVN_PROMPT_DIRTY="$ZSH_THEME_GIT_PROMPT_DIRTY" +ZSH_THEME_SVN_PROMPT_CLEAN="$ZSH_THEME_GIT_PROMPT_CLEAN" + +ZSH_THEME_HG_PROMPT_PREFIX="$ZSH_THEME_GIT_PROMPT_PREFIX" +ZSH_THEME_HG_PROMPT_SUFFIX="$ZSH_THEME_GIT_PROMPT_SUFFIX" +ZSH_THEME_HG_PROMPT_DIRTY="$ZSH_THEME_GIT_PROMPT_DIRTY" +ZSH_THEME_HG_PROMPT_CLEAN="$ZSH_THEME_GIT_PROMPT_CLEAN" vcs_status() { - if [[ $(whence in_svn) != "" ]] && in_svn; then - svn_prompt_info - elif [[ $(whence in_hg) != "" ]] && in_hg; then - hg_prompt_info - else - git_prompt_info - fi + if (( ${+functions[in_svn]} )) && in_svn; then + svn_prompt_info + elif (( ${+functions[in_hg]} )) && in_hg; then + hg_prompt_info + else + git_prompt_info + fi } PROMPT='%2~ $(vcs_status)»%b ' -- cgit v1.2.3-70-g09d2 From c172624398918577bcb212d07b0036f4058cb5c6 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 30 Nov 2021 18:07:42 +0100 Subject: style(af-magic): fix code style and remove unnecessary variables --- themes/af-magic.zsh-theme | 63 +++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 32 deletions(-) (limited to 'themes') diff --git a/themes/af-magic.zsh-theme b/themes/af-magic.zsh-theme index 1d2af3458..d939d546f 100644 --- a/themes/af-magic.zsh-theme +++ b/themes/af-magic.zsh-theme @@ -1,47 +1,46 @@ # af-magic.zsh-theme -# Repo: https://github.com/andyfleming/oh-my-zsh -# Direct Link: https://github.com/andyfleming/oh-my-zsh/blob/master/themes/af-magic.zsh-theme +# +# Author: Andy Fleming +# URL: http://andyfleming.com/ - -# settings -typeset +H return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -typeset +H my_gray="$FG[237]" -typeset +H my_orange="$FG[214]" - -# separator dashes size +# dashed separator size function afmagic_dashes { - local PYTHON_ENV="$VIRTUAL_ENV" - [[ -z "$PYTHON_ENV" ]] && PYTHON_ENV="$CONDA_DEFAULT_ENV" - - if [[ -n "$PYTHON_ENV" && "$PS1" = \(* ]]; then - echo $(( COLUMNS - ${#PYTHON_ENV} - 3 )) - else - echo $COLUMNS - fi + # check either virtualenv or condaenv variables + local python_env="${VIRTUAL_ENV:-$CONDA_DEFAULT_ENV}" + + # if there is a python virtual environment and it is displayed in + # the prompt, account for it when returning the number of dashes + if [[ -n "$python_env" && "$PS1" = \(* ]]; then + echo $(( COLUMNS - ${#python_env} - 3 )) + else + echo $COLUMNS + fi } -# primary prompt -PS1='$FG[237]${(l.$(afmagic_dashes)..-.)}%{$reset_color%} -$FG[032]%~$(git_prompt_info)$(hg_prompt_info) $FG[105]%(!.#.»)%{$reset_color%} ' -PS2='%{$fg[red]%}\ %{$reset_color%}' -RPS1='${return_code}' +# primary prompt: dashed separator, directory and vcs info +PS1="${FG[237]}\${(l.\$(afmagic_dashes)..-.)}%{$reset_color%} +${FG[032]}%~\$(git_prompt_info)\$(hg_prompt_info) ${FG[105]}%(!.#.»)%{$reset_color%} " +PS2="%{$fg[red]%}\ %{$reset_color%}" -# right prompt -(( $+functions[virtualenv_prompt_info] )) && RPS1+='$(virtualenv_prompt_info)' -RPS1+=' $my_gray%n@%m%{$reset_color%}%' +# right prompt: return code, virtualenv and context (user@host) +RPS1="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" +if (( $+functions[virtualenv_prompt_info] )); then + RPS1+='$(virtualenv_prompt_info)' +fi +RPS1+=" ${FG[237]}%n@%m%{$reset_color%}" # git settings -ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075]($FG[078]" +ZSH_THEME_GIT_PROMPT_PREFIX="${FG[075]}(${FG[078]}" ZSH_THEME_GIT_PROMPT_CLEAN="" -ZSH_THEME_GIT_PROMPT_DIRTY="$my_orange*%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="$FG[075])%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="${FG[214]}*%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="${FG[075]})%{$reset_color%}" # hg settings -ZSH_THEME_HG_PROMPT_PREFIX="$FG[075]($FG[078]" +ZSH_THEME_HG_PROMPT_PREFIX="${FG[075]}(${FG[078]}" ZSH_THEME_HG_PROMPT_CLEAN="" -ZSH_THEME_HG_PROMPT_DIRTY="$my_orange*%{$reset_color%}" -ZSH_THEME_HG_PROMPT_SUFFIX="$FG[075])%{$reset_color%}" +ZSH_THEME_HG_PROMPT_DIRTY="${FG[214]}*%{$reset_color%}" +ZSH_THEME_HG_PROMPT_SUFFIX="${FG[075]})%{$reset_color%}" # virtualenv settings -ZSH_THEME_VIRTUALENV_PREFIX=" $FG[075][" +ZSH_THEME_VIRTUALENV_PREFIX=" ${FG[075]}[" ZSH_THEME_VIRTUALENV_SUFFIX="]%{$reset_color%}" -- cgit v1.2.3-70-g09d2 From ee46d198ad94c3e4942f2557b6ecade5f9224b3e Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 13 Dec 2021 11:10:47 +0100 Subject: style(afowler): simplify code and remove unnecessary variables --- themes/afowler.zsh-theme | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'themes') diff --git a/themes/afowler.zsh-theme b/themes/afowler.zsh-theme index 3a4753fc1..783bdc269 100644 --- a/themes/afowler.zsh-theme +++ b/themes/afowler.zsh-theme @@ -1,10 +1,5 @@ -if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi - -local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" - -PROMPT='%m %{${fg_bold[blue]}%}:: %{$reset_color%}%{${fg[green]}%}%3~ $(git_prompt_info)%{${fg_bold[$CARETCOLOR]}%}»%{${reset_color}%} ' - -RPS1="${return_code}" +PROMPT='%m %B%F{blue}:: %b%F{green}%3~ $(git_prompt_info)%B%(!.%F{red}.%F{blue})»%f%b ' +RPS1='%(?..%F{red}%? ↵%f)' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" -- cgit v1.2.3-70-g09d2 From a1a63f4c7d3e765ffc4af93793d6d45287e80291 Mon Sep 17 00:00:00 2001 From: Frank Van Damme Date: Tue, 10 Jan 2017 09:23:49 +0100 Subject: feat(afowler): add mercurial support Closes #5992 --- themes/afowler.zsh-theme | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'themes') diff --git a/themes/afowler.zsh-theme b/themes/afowler.zsh-theme index 783bdc269..f6d3ef82a 100644 --- a/themes/afowler.zsh-theme +++ b/themes/afowler.zsh-theme @@ -1,5 +1,10 @@ -PROMPT='%m %B%F{blue}:: %b%F{green}%3~ $(git_prompt_info)%B%(!.%F{red}.%F{blue})»%f%b ' +PROMPT='%m %B%F{blue}:: %b%F{green}%3~ $(hg_prompt_info)$(git_prompt_info)%B%(!.%F{red}.%F{blue})»%f%b ' RPS1='%(?..%F{red}%? ↵%f)' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" + +ZSH_THEME_HG_PROMPT_PREFIX="%{$fg[magenta]%}hg:‹%{$fg[yellow]%}" +ZSH_THEME_HG_PROMPT_SUFFIX="%{$fg[magenta]%}› %{$reset_color%}" +ZSH_THEME_HG_PROMPT_DIRTY=" %{$fg[red]%}✗" +ZSH_THEME_HG_PROMPT_CLEAN="" -- cgit v1.2.3-70-g09d2 From a94e263426bdf6e05cdfa9fae5e80cec5ee8d9ae Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 30 Nov 2021 17:37:29 +0100 Subject: refactor(adben): simplify used variables and %-quote prompt functions Closes #10474 Co-authored-by: Tom Payne --- .github/actions/spelling/expect.txt | 1 - themes/adben.zsh-theme | 106 +++++++++++++++++------------------- 2 files changed, 49 insertions(+), 58 deletions(-) (limited to 'themes') diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 533ae49c0..65215c6c3 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -3688,7 +3688,6 @@ Subsubcommands Subsubsubcommands sudo sudoedit -SUFIX suitenames sunaku sunion diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme index ebdec7c82..ddb34236b 100644 --- a/themes/adben.zsh-theme +++ b/themes/adben.zsh-theme @@ -32,42 +32,44 @@ ########## COLOR ########### for COLOR in CYAN WHITE YELLOW MAGENTA BLACK BLUE RED DEFAULT GREEN GREY; do - eval PR_$COLOR='%{$fg[${(L)COLOR}]%}' - eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}' + print -v "PR_$COLOR" "%b%{$fg[${(L)COLOR}]%}" + print -v "PR_BRIGHT_$COLOR" "%B%{$fg[${(L)COLOR}]%}" done - PR_RESET="%{$reset_color%}" -RED_START="${PR_RESET}${PR_GREY}<${PR_RESET}${PR_RED}<${PR_BRIGHT_RED}<${PR_RESET} " -RED_END="${PR_RESET}${PR_BRIGHT_RED}>${PR_RESET}${PR_RED}>${PR_GREY}>${PR_RESET} " -GREEN_END="${PR_RESET}${PR_BRIGHT_GREEN}>${PR_RESET}${PR_GREEN}>${PR_GREY}>${PR_RESET} " -GREEN_BASE_START="${PR_RESET}${PR_GREY}>${PR_RESET}${PR_GREEN}>${PR_BRIGHT_GREEN}>${PR_RESET}" -GREEN_START_P1="${PR_RESET}${GREEN_BASE_START}${PR_RESET} " -DIVISION="${PR_RESET}${PR_RED} < ${PR_RESET}" -VCS_DIRTY_COLOR="${PR_RESET}${PR_YELLOW}" -VCS_CLEAN_COLOR="${PR_RESET}${PR_GREEN}" -VCS_SUFIX_COLOR="${PR_RESET}${PR_RED}› ${PR_RESET}" + +RED_START="${PR_GREY}<${PR_RED}<${PR_BRIGHT_RED}<${PR_RESET} " +RED_END="${PR_BRIGHT_RED}>${PR_RED}>${PR_GREY}>${PR_RESET} " +GREEN_START="${PR_GREY}>${PR_GREEN}>${PR_BRIGHT_GREEN}>${PR_RESET}" +GREEN_END="${PR_BRIGHT_GREEN}>${PR_GREEN}>${PR_GREY}>${PR_RESET} " + +########## VCS ########### +VCS_DIRTY_COLOR="${PR_YELLOW}" +VCS_CLEAN_COLOR="${PR_GREEN}" +VCS_SUFFIX_COLOR="${PR_RED}› ${PR_RESET}" ########## SVN ########### -ZSH_THEME_SVN_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹svn:" -ZSH_THEME_SVN_PROMPT_SUFFIX="" -ZSH_THEME_SVN_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}" -ZSH_THEME_SVN_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}" +ZSH_THEME_SVN_PROMPT_PREFIX="${PR_RED}‹svn:" +ZSH_THEME_SVN_PROMPT_SUFFIX="${VCS_SUFFIX_COLOR}" +ZSH_THEME_SVN_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘" +ZSH_THEME_SVN_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔" ########## GIT ########### -ZSH_THEME_GIT_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹git:" -ZSH_THEME_GIT_PROMPT_SUFFIX="" -ZSH_THEME_GIT_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}" -ZSH_THEME_GIT_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}" -ZSH_THEME_GIT_PROMPT_ADDED="${PR_RESET}${PR_YELLOW} ✚${PR_RESET}" -ZSH_THEME_GIT_PROMPT_MODIFIED="${PR_RESET}${PR_YELLOW} ✹${PR_RESET}" -ZSH_THEME_GIT_PROMPT_DELETED="${PR_RESET}${PR_YELLOW} ✖${PR_RESET}" -ZSH_THEME_GIT_PROMPT_RENAMED="${PR_RESET}${PR_YELLOW} ➜${PR_RESET}" -ZSH_THEME_GIT_PROMPT_UNMERGED="${PR_RESET}${PR_YELLOW} ═${PR_RESET}" -ZSH_THEME_GIT_PROMPT_UNTRACKED="${PR_RESET}${PR_YELLOW} ✭${PR_RESET}" +ZSH_THEME_GIT_PROMPT_PREFIX="${PR_RED}‹git:" +ZSH_THEME_GIT_PROMPT_SUFFIX="${VCS_SUFFIX_COLOR}" +ZSH_THEME_GIT_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘" +ZSH_THEME_GIT_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔" +ZSH_THEME_GIT_PROMPT_ADDED="${PR_YELLOW} ✚" +ZSH_THEME_GIT_PROMPT_MODIFIED="${PR_YELLOW} ✹" +ZSH_THEME_GIT_PROMPT_DELETED="${PR_YELLOW} ✖" +ZSH_THEME_GIT_PROMPT_RENAMED="${PR_YELLOW} ➜" +ZSH_THEME_GIT_PROMPT_UNMERGED="${PR_YELLOW} ═" +ZSH_THEME_GIT_PROMPT_UNTRACKED="${PR_YELLOW} ✭" # Get a fortune quote ps1_fortune() { - (( ${+commands[fortune]} )) && fortune + if (( ${+commands[fortune]} )); then + fortune + fi } # Obtain a command tip @@ -77,33 +79,27 @@ ps1_command_tip() { command wget -qO- https://www.commandlinefu.com/commands/random/plaintext elif (( ${+commands[curl]} )); then command curl -fsL https://www.commandlinefu.com/commands/random/plaintext - fi - } | sed 1d | sed '/^$/d' + fi + } | sed '1d;/^$/d' } -function precmd_adben { - prompt_header() { - if [[ "$ENABLE_COMMAND_TIP" = true ]]; then - ps1_command_tip - else - ps1_fortune - fi - } +# Show prompt header (fortune / command tip) +prompt_header() { + local header=$( + case "${ENABLE_COMMAND_TIP:-}" in + true) ps1_command_tip ;; + *) ps1_fortune ;; + esac + ) - PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}" - - # set a simple variable to show when in screen - if [[ -n "${WINDOW}" ]]; then - SCREEN="" - fi + # Make sure to quote % so that they're not expanded by the prompt + echo -n "${header:gs/%/%%}" } # Context: user@directory or just directory prompt_context() { if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then - echo -n "${PR_RESET}${PR_RED}$USERNAME@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" - else - echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" + echo -n "${PR_RESET}${PR_RED}%n@%m" fi } @@ -111,16 +107,12 @@ prompt_context() { # Required for the prompt setopt prompt_subst -autoload zsh/terminfo -# Prompt -PROMPT='${PROMPT_HEAD} -${RED_START}$(prompt_context) -${GREEN_START_P1}' -RPROMPT='${PR_RESET}$(git_prompt_info)$(svn_prompt_info)${PR_YELLOW}%D{%R.%S %a %b %d %Y} ${GREEN_END}${PR_RESET}' +# Prompt: header, context (user@host), directory +PROMPT="${RED_START}${PR_YELLOW}\$(prompt_header)${PR_RESET} +${RED_START}\$(prompt_context)${PR_BRIGHT_YELLOW}%~${PR_RESET} +${GREEN_START} " +# Right prompt: vcs status + time +RPROMPT="\$(git_prompt_info)\$(svn_prompt_info)${PR_YELLOW}%D{%R.%S %a %b %d %Y} ${GREEN_END}" # Matching continuation prompt -PROMPT2='${GREEN_BASE_START}${PR_RESET} %_ ${GREEN_BASE_START}${PR_RESET} ' - -# Prompt head -autoload -Uz add-zsh-hook -add-zsh-hook precmd precmd_adben +PROMPT2="${GREEN_START} %_ ${GREEN_START} " -- cgit v1.2.3-70-g09d2 From 1b01496c21e9ca7ef79d6a1dcb4728abd7a2803a Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 13 Dec 2021 14:42:57 +0100 Subject: fix(bira): fix color bleed in user_host prompt section (#10505) Fixes #10505 --- themes/bira.zsh-theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'themes') diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme index 4a05bf3bb..42a70a018 100644 --- a/themes/bira.zsh-theme +++ b/themes/bira.zsh-theme @@ -1,5 +1,5 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -local user_host="%B%(!.%F{red}.%F{green})%n@%m %{$reset_color%}" +local user_host="%B%(!.%{$fg[red]%}.%{$fg[green]%})%n@%m%{$reset_color%} " local user_symbol='%(!.#.$)' local current_dir="%B%{$fg[blue]%}%~ %{$reset_color%}" -- cgit v1.2.3-70-g09d2 From 065e8ebdd02ba2554d4509424f1cde0e84361357 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 13 Dec 2021 15:13:43 +0100 Subject: style(jonathan): fix code style in jonathan theme --- themes/jonathan.zsh-theme | 255 ++++++++++++++++++++-------------------------- themes/simonoff.zsh-theme | 136 ++++++++++++------------- 2 files changed, 179 insertions(+), 212 deletions(-) (limited to 'themes') diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme index 2f0e77431..2c5f30060 100644 --- a/themes/jonathan.zsh-theme +++ b/themes/jonathan.zsh-theme @@ -1,153 +1,124 @@ -functions rbenv_prompt_info >& /dev/null || rbenv_prompt_info(){} - function theme_precmd { - local TERMWIDTH - (( TERMWIDTH = ${COLUMNS} - 1 )) - - - ### - # Truncate the path if it's too long. + local -i TERMWIDTH=$COLUMNS - PR_FILLBAR="" - PR_PWDLEN="" + PR_FILLBAR="" + PR_PWDLEN="" - local promptsize=${#${(%):---(%n@%m:%l)---()--}} - local rubyprompt=`rvm_prompt_info || rbenv_prompt_info` - local rubypromptsize=${#${rubyprompt}} - local pwdsize=${#${(%):-%~}} - - if [[ "$promptsize + $rubypromptsize + $pwdsize" -gt $TERMWIDTH ]]; then - ((PR_PWDLEN=$TERMWIDTH - $promptsize)) - else - PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $rubypromptsize + $pwdsize)))..${PR_HBAR}.)}" - fi + local promptsize=${#${(%):---(%n@%m:%l)---()--}} + local rubypromptsize=${#${(%)$(ruby_prompt_info)}} + local pwdsize=${#${(%):-%~}} + # Truncate the path if it's too long. + if (( promptsize + rubypromptsize + pwdsize > TERMWIDTH )); then + (( PR_PWDLEN = TERMWIDTH - promptsize )) + else + PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $rubypromptsize + $pwdsize)))..${PR_HBAR}.)}" + fi } - -setopt extended_glob -theme_preexec () { - if [[ "$TERM" == "screen" ]]; then - local CMD=${1[(wr)^(*=*|sudo|-*)]} - echo -n "\ek$CMD\e\\" - fi +function theme_preexec { + setopt local_options extended_glob + if [[ "$TERM" = "screen" ]]; then + local CMD=${1[(wr)^(*=*|sudo|-*)]} + echo -n "\ek$CMD\e\\" + fi } - -setprompt () { - ### - # Need this so the prompt will work. - - setopt prompt_subst - - - ### - # See if we can use colors. - - autoload zsh/terminfo - for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do - eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' - eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' - (( count = $count + 1 )) - done - PR_NO_COLOUR="%{$terminfo[sgr0]%}" - - ### - # Modify Git prompt - ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}" - ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" - ZSH_THEME_GIT_PROMPT_DIRTY="" - ZSH_THEME_GIT_PROMPT_CLEAN="" - - ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" - ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" - ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" - ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" - ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" - ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" - - ### - # See if we can use extended characters to look nicer. - # UTF-8 Fixed - - if [[ $(locale charmap) == "UTF-8" ]]; then - PR_SET_CHARSET="" - PR_SHIFT_IN="" - PR_SHIFT_OUT="" - PR_HBAR="─" - PR_ULCORNER="┌" - PR_LLCORNER="└" - PR_LRCORNER="┘" - PR_URCORNER="┐" - else - typeset -A altchar - set -A altchar ${(s..)terminfo[acsc]} - # Some stuff to help us draw nice lines - PR_SET_CHARSET="%{$terminfo[enacs]%}" - PR_SHIFT_IN="%{$terminfo[smacs]%}" - PR_SHIFT_OUT="%{$terminfo[rmacs]%}" - PR_HBAR='$PR_SHIFT_IN${altchar[q]:--}$PR_SHIFT_OUT' - PR_ULCORNER='$PR_SHIFT_IN${altchar[l]:--}$PR_SHIFT_OUT' - PR_LLCORNER='$PR_SHIFT_IN${altchar[m]:--}$PR_SHIFT_OUT' - PR_LRCORNER='$PR_SHIFT_IN${altchar[j]:--}$PR_SHIFT_OUT' - PR_URCORNER='$PR_SHIFT_IN${altchar[k]:--}$PR_SHIFT_OUT' - fi - - - ### - # Decide if we need to set titlebar text. - - case $TERM in - xterm*) - PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}' - ;; - screen) - PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' - ;; - *) - PR_TITLEBAR='' - ;; - esac - - - ### - # Decide whether to set a screen title - if [[ "$TERM" == "screen" ]]; then - PR_STITLE=$'%{\ekzsh\e\\%}' - else - PR_STITLE='' - fi - - - ### - # Finally, the prompt. - - PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ -$PR_CYAN$PR_ULCORNER$PR_HBAR$PR_GREY(\ -$PR_GREEN%$PR_PWDLEN<...<%~%<<\ -$PR_GREY)`rvm_prompt_info || rbenv_prompt_info`$PR_CYAN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_GREY(\ -$PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\ -$PR_GREY)$PR_CYAN$PR_HBAR$PR_URCORNER\ - -$PR_CYAN$PR_LLCORNER$PR_BLUE$PR_HBAR(\ -$PR_YELLOW%D{%H:%M:%S}\ -$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_HBAR\ -$PR_HBAR\ ->$PR_NO_COLOUR ' - - # display exitcode on the right when >0 - return_code="%(?..%{$fg[red]%}%? ↵ %{$reset_color%})" - RPROMPT=' $return_code$PR_CYAN$PR_HBAR$PR_BLUE$PR_HBAR\ -($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_NO_COLOUR' - - PS2='$PR_CYAN$PR_HBAR\ -$PR_BLUE$PR_HBAR(\ -$PR_LIGHT_GREEN%_$PR_BLUE)$PR_HBAR\ -$PR_CYAN$PR_HBAR$PR_NO_COLOUR ' -} - -setprompt - autoload -U add-zsh-hook add-zsh-hook precmd theme_precmd add-zsh-hook preexec theme_preexec + + +# Set the prompt + +# Need this so the prompt will work. +setopt prompt_subst + +# See if we can use colors. +autoload zsh/terminfo +for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do + print -v "PR_$color" "%{$terminfo[bold]$fg[${(L)color}]%}" + print -v "PR_LIGHT_$color" "%{$fg[${(L)color}]%}" +done +PR_NO_COLOUR="%{$terminfo[sgr0]%}" + +# Modify Git prompt +ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="" +ZSH_THEME_GIT_PROMPT_CLEAN="" + +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" + +# Use extended characters to look nicer if supported. +if [[ "${langinfo[CODESET]}" = "UTF-8" ]]; then + PR_SET_CHARSET="" + PR_SHIFT_IN="" + PR_SHIFT_OUT="" + PR_HBAR="─" + PR_ULCORNER="┌" + PR_LLCORNER="└" + PR_LRCORNER="┘" + PR_URCORNER="┐" +else + typeset -A altchar + set -A altchar ${(s..)terminfo[acsc]} + # Some stuff to help us draw nice lines + PR_SET_CHARSET="%{$terminfo[enacs]%}" + PR_SHIFT_IN="%{$terminfo[smacs]%}" + PR_SHIFT_OUT="%{$terminfo[rmacs]%}" + PR_HBAR='$PR_SHIFT_IN${altchar[q]:--}$PR_SHIFT_OUT' + PR_ULCORNER='$PR_SHIFT_IN${altchar[l]:--}$PR_SHIFT_OUT' + PR_LLCORNER='$PR_SHIFT_IN${altchar[m]:--}$PR_SHIFT_OUT' + PR_LRCORNER='$PR_SHIFT_IN${altchar[j]:--}$PR_SHIFT_OUT' + PR_URCORNER='$PR_SHIFT_IN${altchar[k]:--}$PR_SHIFT_OUT' + fi + +# Decide if we need to set titlebar text. +case $TERM in + xterm*) + PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}' + ;; + screen) + PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' + ;; + *) + PR_TITLEBAR="" + ;; +esac + +# Decide whether to set a screen title +if [[ "$TERM" = "screen" ]]; then + PR_STITLE=$'%{\ekzsh\e\\%}' +else + PR_STITLE="" +fi + +# Finally, the prompt. +PROMPT='${PR_SET_CHARSET}${PR_STITLE}${(e)PR_TITLEBAR}\ +${PR_CYAN}${PR_ULCORNER}${PR_HBAR}${PR_GREY}(\ +${PR_GREEN}%${PR_PWDLEN}<...<%~%<<\ +${PR_GREY})$(ruby_prompt_info)${PR_CYAN}${PR_HBAR}${PR_HBAR}${(e)PR_FILLBAR}${PR_HBAR}${PR_GREY}(\ +${PR_CYAN}%(!.%SROOT%s.%n)${PR_GREY}@${PR_GREEN}%m:%l\ +${PR_GREY})${PR_CYAN}${PR_HBAR}${PR_URCORNER}\ + +${PR_CYAN}${PR_LLCORNER}${PR_BLUE}${PR_HBAR}(\ +${PR_YELLOW}%D{%H:%M:%S}\ +${PR_LIGHT_BLUE}%{$reset_color%}$(git_prompt_info)$(git_prompt_status)${PR_BLUE})${PR_CYAN}${PR_HBAR}\ +${PR_HBAR}\ +>${PR_NO_COLOUR} ' + +# display exitcode on the right when > 0 +return_code="%(?..%{$fg[red]%}%? ↵ %{$reset_color%})" +RPROMPT=' $return_code${PR_CYAN}${PR_HBAR}${PR_BLUE}${PR_HBAR}\ +(${PR_YELLOW}%D{%a,%b%d}${PR_BLUE})${PR_HBAR}${PR_CYAN}${PR_LRCORNER}${PR_NO_COLOUR}' + +PS2='${PR_CYAN}${PR_HBAR}\ +${PR_BLUE}${PR_HBAR}(\ +${PR_LIGHT_GREEN}%_${PR_BLUE})${PR_HBAR}\ +${PR_CYAN}${PR_HBAR}${PR_NO_COLOUR} ' diff --git a/themes/simonoff.zsh-theme b/themes/simonoff.zsh-theme index ef91c5ee3..fea2eff42 100644 --- a/themes/simonoff.zsh-theme +++ b/themes/simonoff.zsh-theme @@ -10,46 +10,46 @@ # 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white function precmd { - local TERMWIDTH - (( TERMWIDTH = ${COLUMNS} - 1 )) + local TERMWIDTH + (( TERMWIDTH = ${COLUMNS} - 1 )) - ### - # Truncate the path if it's too long. + ### + # Truncate the path if it's too long. - PR_FILLBAR="" - PR_PWDLEN="" + PR_FILLBAR="" + PR_PWDLEN="" - local promptsize=${#${(%):---(%n@%M:%l)---()}} - local pwdsize=${#${(%):-%~}} - local gitbranch="$(git_prompt_info)" - local rvmprompt="$(ruby_prompt_info)" - local gitbranchsize=${#${gitbranch:-''}} - local rvmpromptsize=${#${rvmprompt:-''}} + local promptsize=${#${(%):---(%n@%M:%l)---()}} + local pwdsize=${#${(%):-%~}} + local gitbranch="$(git_prompt_info)" + local rvmprompt="$(ruby_prompt_info)" + local gitbranchsize=${#${gitbranch:-''}} + local rvmpromptsize=${#${rvmprompt:-''}} - if [[ "$promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize" -gt $TERMWIDTH ]]; then - ((PR_PWDLEN=$TERMWIDTH - $promptsize)) - else - PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize)))..${PR_SPACE}.)}" - fi + if [[ "$promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize" -gt $TERMWIDTH ]]; then + ((PR_PWDLEN=$TERMWIDTH - $promptsize)) + else + PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize)))..${PR_SPACE}.)}" + fi } setopt extended_glob preexec () { - if [[ "$TERM" == "screen" ]]; then - local CMD=${1[(wr)^(*=*|sudo|-*)]} - echo -n "\ek$CMD\e\\" - fi + if [[ "$TERM" == "screen" ]]; then + local CMD=${1[(wr)^(*=*|sudo|-*)]} + echo -n "\ek$CMD\e\\" + fi - if [[ "$TERM" == "xterm" ]]; then - print -Pn "\e]0;$1\a" - fi + if [[ "$TERM" == "xterm" ]]; then + print -Pn "\e]0;$1\a" + fi - if [[ "$TERM" == "rxvt" ]]; then - print -Pn "\e]0;$1\a" - fi + if [[ "$TERM" == "rxvt" ]]; then + print -Pn "\e]0;$1\a" + fi } @@ -57,71 +57,67 @@ setprompt () { ### # Need this so the prompt will work. - setopt prompt_subst + setopt prompt_subst ### # See if we can use colors. - autoload zsh/terminfo - for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do - eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' - eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' - (( count = $count + 1 )) - done - PR_NO_COLOUR="%{$terminfo[sgr0]%}" + autoload zsh/terminfo + for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do + eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' + eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' + (( count = $count + 1 )) + done + PR_NO_COLOUR="%{$terminfo[sgr0]%}" ### # See if we can use extended characters to look nicer. - - typeset -A altchar -# set -A altchar "${(s..)terminfo[acsc]}" - PR_SET_CHARSET="%{$terminfo[enacs]%}" - PR_HBAR=${altchar[q]:--} - PR_ULCORNER=${altchar[l]:--} - PR_LLCORNER=${altchar[m]:--} - PR_LRCORNER=${altchar[j]:--} - PR_URCORNER=${altchar[k]:--} - - ### - # Modify Git prompt - ZSH_THEME_GIT_PROMPT_PREFIX=" [" - ZSH_THEME_GIT_PROMPT_SUFFIX="]" - ### - # Modify RVM prompt - ZSH_THEME_RUBY_PROMPT_PREFIX=" [" - ZSH_THEME_RUBY_PROMPT_SUFFIX="]" + PR_HBAR=${altchar[q]:--} + PR_ULCORNER=${altchar[l]:--} + PR_LLCORNER=${altchar[m]:--} + PR_LRCORNER=${altchar[j]:--} + PR_URCORNER=${altchar[k]:--} + + ### + # Modify Git prompt + ZSH_THEME_GIT_PROMPT_PREFIX=" [" + ZSH_THEME_GIT_PROMPT_SUFFIX="]" + ### + # Modify RVM prompt + ZSH_THEME_RUBY_PROMPT_PREFIX=" [" + ZSH_THEME_RUBY_PROMPT_SUFFIX="]" ### # Decide if we need to set titlebar text. - case $TERM in - xterm*|*rxvt*) - PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%M:%~ $(git_prompt_info) $(rvm_prompt_info) | ${COLUMNS}x${LINES} | %y\a%}' - ;; - screen) - PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' - ;; - *) - PR_TITLEBAR='' - ;; - esac + case $TERM in + xterm*|*rxvt*) + PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%M:%~ $(git_prompt_info) $(rvm_prompt_info) | ${COLUMNS}x${LINES} | %y\a%}' + ;; + screen) + PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' + ;; + *) + PR_TITLEBAR='' + ;; + esac ### # Decide whether to set a screen title - if [[ "$TERM" == "screen" ]]; then - PR_STITLE=$'%{\ekzsh\e\\%}' - else - PR_STITLE='' - fi + if [[ "$TERM" == "screen" ]]; then + PR_STITLE=$'%{\ekzsh\e\\%}' + else + PR_STITLE='' + fi ### # Finally, the prompt. # - PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ + PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ $PR_RED$PR_HBAR<\ $PR_BLUE%(!.$PR_RED%SROOT%s.%n)$PR_GREEN@$PR_BLUE%M:$PR_GREEN%$PR_PWDLEN<...<%~$PR_CYAN$(git_prompt_info)$(rvm_prompt_info)\ $PR_RED>$PR_HBAR$PR_SPACE${(e)PR_FILLBAR}\ -- cgit v1.2.3-70-g09d2 From 134c1ada285f5c65fa9d0f2f0cc784201428462a Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 13 Dec 2021 16:42:54 +0100 Subject: fix(jonathan): fix theme for non-UTF8 locales --- themes/jonathan.zsh-theme | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'themes') diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme index 2c5f30060..ca58b94a3 100644 --- a/themes/jonathan.zsh-theme +++ b/themes/jonathan.zsh-theme @@ -1,6 +1,4 @@ function theme_precmd { - local -i TERMWIDTH=$COLUMNS - PR_FILLBAR="" PR_PWDLEN="" @@ -9,10 +7,12 @@ function theme_precmd { local pwdsize=${#${(%):-%~}} # Truncate the path if it's too long. - if (( promptsize + rubypromptsize + pwdsize > TERMWIDTH )); then - (( PR_PWDLEN = TERMWIDTH - promptsize )) + if (( promptsize + rubypromptsize + pwdsize > COLUMNS )); then + (( PR_PWDLEN = COLUMNS - promptsize )) + elif [[ "${langinfo[CODESET]}" = UTF-8 ]]; then + PR_FILLBAR="\${(l:$(( COLUMNS - (promptsize + rubypromptsize + pwdsize) ))::${PR_HBAR}:)}" else - PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $rubypromptsize + $pwdsize)))..${PR_HBAR}.)}" + PR_FILLBAR="${PR_SHIFT_IN}\${(l:$(( COLUMNS - (promptsize + rubypromptsize + pwdsize) ))::${altchar[q]:--}:)}${PR_SHIFT_OUT}" fi } @@ -48,18 +48,16 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" ZSH_THEME_GIT_PROMPT_DIRTY="" ZSH_THEME_GIT_PROMPT_CLEAN="" -ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚" -ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹" -ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖" -ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜" -ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭" +ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} %{%G✚%}" +ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} %{%G✹%}" +ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} %{%G✖%}" +ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} %{%G➜%}" +ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} %{%G═%}" +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} %{%G✭%}" # Use extended characters to look nicer if supported. -if [[ "${langinfo[CODESET]}" = "UTF-8" ]]; then +if [[ "${langinfo[CODESET]}" = UTF-8 ]]; then PR_SET_CHARSET="" - PR_SHIFT_IN="" - PR_SHIFT_OUT="" PR_HBAR="─" PR_ULCORNER="┌" PR_LLCORNER="└" @@ -72,12 +70,12 @@ else PR_SET_CHARSET="%{$terminfo[enacs]%}" PR_SHIFT_IN="%{$terminfo[smacs]%}" PR_SHIFT_OUT="%{$terminfo[rmacs]%}" - PR_HBAR='$PR_SHIFT_IN${altchar[q]:--}$PR_SHIFT_OUT' - PR_ULCORNER='$PR_SHIFT_IN${altchar[l]:--}$PR_SHIFT_OUT' - PR_LLCORNER='$PR_SHIFT_IN${altchar[m]:--}$PR_SHIFT_OUT' - PR_LRCORNER='$PR_SHIFT_IN${altchar[j]:--}$PR_SHIFT_OUT' - PR_URCORNER='$PR_SHIFT_IN${altchar[k]:--}$PR_SHIFT_OUT' - fi + PR_HBAR="${PR_SHIFT_IN}${altchar[q]:--}${PR_SHIFT_OUT}" + PR_ULCORNER="${PR_SHIFT_IN}${altchar[l]:--}${PR_SHIFT_OUT}" + PR_LLCORNER="${PR_SHIFT_IN}${altchar[m]:--}${PR_SHIFT_OUT}" + PR_LRCORNER="${PR_SHIFT_IN}${altchar[j]:--}${PR_SHIFT_OUT}" + PR_URCORNER="${PR_SHIFT_IN}${altchar[k]:--}${PR_SHIFT_OUT}" +fi # Decide if we need to set titlebar text. case $TERM in -- cgit v1.2.3-70-g09d2 From aa99472c8ac5bdd111ea306e800bb152fb8580ac Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 13 Dec 2021 17:02:21 +0100 Subject: style(simonoff): fix code style and optimize use of variables --- themes/simonoff.zsh-theme | 131 +++++++++++++++++----------------------------- 1 file changed, 48 insertions(+), 83 deletions(-) (limited to 'themes') diff --git a/themes/simonoff.zsh-theme b/themes/simonoff.zsh-theme index fea2eff42..c906192a0 100644 --- a/themes/simonoff.zsh-theme +++ b/themes/simonoff.zsh-theme @@ -1,43 +1,22 @@ -# Prompt -# -# Below are the color init strings for the basic file types. A color init -# string consists of one or more of the following numeric codes: -# Attribute codes: -# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed -# Text color codes: -# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white -# Background color codes: -# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white -function precmd { - - local TERMWIDTH - (( TERMWIDTH = ${COLUMNS} - 1 )) - - - ### - # Truncate the path if it's too long. - +function theme_precmd { PR_FILLBAR="" PR_PWDLEN="" - local promptsize=${#${(%):---(%n@%M:%l)---()}} + local promptsize=${#${(%):--(%n@%M:)--(%l)-}} local pwdsize=${#${(%):-%~}} - local gitbranch="$(git_prompt_info)" - local rvmprompt="$(ruby_prompt_info)" - local gitbranchsize=${#${gitbranch:-''}} - local rvmpromptsize=${#${rvmprompt:-''}} + local gitbranchsize="${#${(%)$(git_prompt_info)}:-}" + local rvmpromptsize="${#${(%)$(ruby_prompt_info):-}}" - if [[ "$promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize" -gt $TERMWIDTH ]]; then - ((PR_PWDLEN=$TERMWIDTH - $promptsize)) + # Truncate the path if it's too long. + if (( promptsize + pwdsize + rvmpromptsize + gitbranchsize > COLUMNS )); then + (( PR_PWDLEN = COLUMNS - promptsize )) else - PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pwdsize + $rvmpromptsize + $gitbranchsize)))..${PR_SPACE}.)}" + PR_FILLBAR="\${(l.$(( COLUMNS - (promptsize + pwdsize + rvmpromptsize + gitbranchsize) ))..${PR_SPACE}.)}" fi } - -setopt extended_glob - -preexec () { +function theme_preexec { + setopt local_options extended_glob if [[ "$TERM" == "screen" ]]; then local CMD=${1[(wr)^(*=*|sudo|-*)]} echo -n "\ek$CMD\e\\" @@ -53,47 +32,41 @@ preexec () { } -setprompt () { -### -# Need this so the prompt will work. +autoload -U add-zsh-hook +add-zsh-hook precmd theme_precmd +add-zsh-hook preexec theme_preexec - setopt prompt_subst +# Set the prompt + +# Need this so the prompt will work. +setopt prompt_subst -### # See if we can use colors. +autoload zsh/terminfo +for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do + print -v "PR_$color" "%{$terminfo[bold]$fg[${(L)color}]%}" + print -v "PR_LIGHT_$color" "%{$fg[${(L)color}]%}" +done +PR_NO_COLOUR="%{$terminfo[sgr0]%}" + +# Use extended characters to look nicer +PR_HBAR="-" +PR_ULCORNER="-" +PR_LLCORNER="-" +PR_LRCORNER="-" +PR_URCORNER="-" + +# Modify Git prompt +ZSH_THEME_GIT_PROMPT_PREFIX=" [" +ZSH_THEME_GIT_PROMPT_SUFFIX="]" + +# Modify RVM prompt +ZSH_THEME_RUBY_PROMPT_PREFIX=" [" +ZSH_THEME_RUBY_PROMPT_SUFFIX="]" - autoload zsh/terminfo - for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do - eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' - eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' - (( count = $count + 1 )) - done - PR_NO_COLOUR="%{$terminfo[sgr0]%}" - - -### -# See if we can use extended characters to look nicer. - PR_HBAR=${altchar[q]:--} - PR_ULCORNER=${altchar[l]:--} - PR_LLCORNER=${altchar[m]:--} - PR_LRCORNER=${altchar[j]:--} - PR_URCORNER=${altchar[k]:--} - - ### - # Modify Git prompt - ZSH_THEME_GIT_PROMPT_PREFIX=" [" - ZSH_THEME_GIT_PROMPT_SUFFIX="]" - ### - # Modify RVM prompt - ZSH_THEME_RUBY_PROMPT_PREFIX=" [" - ZSH_THEME_RUBY_PROMPT_SUFFIX="]" - - -### # Decide if we need to set titlebar text. - - case $TERM in +case $TERM in xterm*|*rxvt*) PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%M:%~ $(git_prompt_info) $(rvm_prompt_info) | ${COLUMNS}x${LINES} | %y\a%}' ;; @@ -101,26 +74,22 @@ setprompt () { PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' ;; *) - PR_TITLEBAR='' + PR_TITLEBAR="" ;; - esac - +esac -### # Decide whether to set a screen title - if [[ "$TERM" == "screen" ]]; then - PR_STITLE=$'%{\ekzsh\e\\%}' - else - PR_STITLE='' - fi +if [[ "$TERM" == "screen" ]]; then + PR_STITLE=$'%{\ekzsh\e\\%}' +else + PR_STITLE="" +fi -### # Finally, the prompt. -# - PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ +PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ $PR_RED$PR_HBAR<\ $PR_BLUE%(!.$PR_RED%SROOT%s.%n)$PR_GREEN@$PR_BLUE%M:$PR_GREEN%$PR_PWDLEN<...<%~$PR_CYAN$(git_prompt_info)$(rvm_prompt_info)\ -$PR_RED>$PR_HBAR$PR_SPACE${(e)PR_FILLBAR}\ +$PR_RED>$PR_HBAR${(e)PR_FILLBAR}\ $PR_RED$PR_HBAR<\ $PR_GREEN%l$PR_RED>$PR_HBAR\ @@ -128,7 +97,3 @@ $PR_RED$PR_HBAR<\ %(?..$PR_LIGHT_RED%?$PR_BLUE:)\ $PR_LIGHT_BLUE%(!.$PR_RED.$PR_WHITE)%#$PR_RED>$PR_HBAR\ $PR_NO_COLOUR ' - -} - -setprompt -- cgit v1.2.3-70-g09d2 From e3bb6e685dc0325f472a4cfadb9847add12ec699 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Mon, 13 Dec 2021 17:12:31 +0100 Subject: refactor(themes): use `ruby_prompt_info` everywhere --- themes/aussiegeek.zsh-theme | 2 +- themes/josh.zsh-theme | 4 ++-- themes/murilasso.zsh-theme | 2 +- themes/simonoff.zsh-theme | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'themes') diff --git a/themes/aussiegeek.zsh-theme b/themes/aussiegeek.zsh-theme index c2c7f65b9..2ded5c157 100644 --- a/themes/aussiegeek.zsh-theme +++ b/themes/aussiegeek.zsh-theme @@ -1,5 +1,5 @@ -PROMPT='$fg_bold[blue][ $fg[red]%t $fg_bold[blue]] $fg_bold[blue] [ $fg[red]%n@%m:%~$(git_prompt_info)$fg[yellow]$(rvm_prompt_info)$fg_bold[blue] ]$reset_color +PROMPT='$fg_bold[blue][ $fg[red]%t $fg_bold[blue]] $fg_bold[blue] [ $fg[red]%n@%m:%~$(git_prompt_info)$fg[yellow]$(ruby_prompt_info)$fg_bold[blue] ]$reset_color $ ' # git theming ZSH_THEME_GIT_PROMPT_PREFIX="$fg_bold[green](" diff --git a/themes/josh.zsh-theme b/themes/josh.zsh-theme index c8f0f4dd7..ea051c58e 100644 --- a/themes/josh.zsh-theme +++ b/themes/josh.zsh-theme @@ -10,7 +10,7 @@ function josh_prompt { prompt=" " branch=$(git_current_branch) - ruby_version=$(rvm_prompt_info || rbenv_prompt_info) + ruby_version=$(ruby_prompt_info) path_size=${#PWD} branch_size=${#branch} ruby_size=${#ruby_version} @@ -31,7 +31,7 @@ function josh_prompt { prompt=" $prompt" done - prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%} $(git_current_branch)" + prompt="%{%F{green}%}$PWD$prompt%{%F{red}%}$(ruby_prompt_info)%{$reset_color%} $(git_current_branch)" echo $prompt } diff --git a/themes/murilasso.zsh-theme b/themes/murilasso.zsh-theme index bc2b9b224..d46874c54 100644 --- a/themes/murilasso.zsh-theme +++ b/themes/murilasso.zsh-theme @@ -1,7 +1,7 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}' -local rvm_ruby='%{$fg[red]%}$(rvm_prompt_info || rbenv_prompt_info)%{$reset_color%}' +local rvm_ruby='%{$fg[red]%}$(ruby_prompt_info)%{$reset_color%}' local git_branch='%{$fg[blue]%}$(git_prompt_info)%{$reset_color%}' PROMPT="${user_host}:${current_dir} ${rvm_ruby} diff --git a/themes/simonoff.zsh-theme b/themes/simonoff.zsh-theme index c906192a0..201d5d7e4 100644 --- a/themes/simonoff.zsh-theme +++ b/themes/simonoff.zsh-theme @@ -68,7 +68,7 @@ ZSH_THEME_RUBY_PROMPT_SUFFIX="]" # Decide if we need to set titlebar text. case $TERM in xterm*|*rxvt*) - PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%M:%~ $(git_prompt_info) $(rvm_prompt_info) | ${COLUMNS}x${LINES} | %y\a%}' + PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%M:%~ $(git_prompt_info) $(ruby_prompt_info) | ${COLUMNS}x${LINES} | %y\a%}' ;; screen) PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}' @@ -88,7 +88,7 @@ fi # Finally, the prompt. PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\ $PR_RED$PR_HBAR<\ -$PR_BLUE%(!.$PR_RED%SROOT%s.%n)$PR_GREEN@$PR_BLUE%M:$PR_GREEN%$PR_PWDLEN<...<%~$PR_CYAN$(git_prompt_info)$(rvm_prompt_info)\ +$PR_BLUE%(!.$PR_RED%SROOT%s.%n)$PR_GREEN@$PR_BLUE%M:$PR_GREEN%$PR_PWDLEN<...<%~$PR_CYAN$(git_prompt_info)$(ruby_prompt_info)\ $PR_RED>$PR_HBAR${(e)PR_FILLBAR}\ $PR_RED$PR_HBAR<\ $PR_GREEN%l$PR_RED>$PR_HBAR\ -- cgit v1.2.3-70-g09d2 From f42aa49cfdfc56b784744d3e421f297ab03efbdc Mon Sep 17 00:00:00 2001 From: deimosian Date: Mon, 13 Dec 2021 16:52:32 -0500 Subject: fix(ys): use default color instead of gray for improved readability (#10506) --- themes/ys.zsh-theme | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'themes') diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme index 251b48827..45bbae2d1 100644 --- a/themes/ys.zsh-theme +++ b/themes/ys.zsh-theme @@ -5,10 +5,8 @@ # # Mar 2013 Yad Smood -typeset +H my_gray="$FG[247]" - # VCS -YS_VCS_PROMPT_PREFIX1=" %{$my_gray%}on%{$reset_color%} " +YS_VCS_PROMPT_PREFIX1=" %{$reset_color%}on%{$fg[blue]%} " YS_VCS_PROMPT_PREFIX2=":%{$fg[cyan]%}" YS_VCS_PROMPT_SUFFIX="%{$reset_color%}" YS_VCS_PROMPT_DIRTY=" %{$fg[red]%}x" @@ -62,13 +60,13 @@ local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})" PROMPT=" %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ %(#,%{$bg[yellow]%}%{$fg[black]%}%n%{$reset_color%},%{$fg[cyan]%}%n) \ -%{$my_gray%}@ \ +%{$reset_color%}@ \ %{$fg[green]%}%m \ -%{$my_gray%}in \ +%{$reset_color%}in \ %{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\ ${hg_info}\ ${git_info}\ ${venv_info}\ \ -%{$my_gray%}[%*] $exit_code +[%*] $exit_code %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" -- cgit v1.2.3-70-g09d2 From fb86ec7749644bba4792f95bd06076049d9c74a6 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Tue, 14 Dec 2021 13:09:02 +0100 Subject: style: use `typeset` for dynamic variable names --- plugins/dirhistory/dirhistory.plugin.zsh | 4 ++-- themes/adben.zsh-theme | 4 ++-- themes/jonathan.zsh-theme | 4 ++-- themes/simonoff.zsh-theme | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'themes') diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh index 9f39264cf..2f5a79735 100644 --- a/plugins/dirhistory/dirhistory.plugin.zsh +++ b/plugins/dirhistory/dirhistory.plugin.zsh @@ -19,14 +19,14 @@ export DIRHISTORY_SIZE=30 # Returns the element if the array was not empty, # otherwise returns empty string. function pop_past() { - print -v $1 "${dirhistory_past[$#dirhistory_past]}" + typeset $1="${dirhistory_past[$#dirhistory_past]}" if [[ $#dirhistory_past -gt 0 ]]; then dirhistory_past[$#dirhistory_past]=() fi } function pop_future() { - print -v $1 "${dirhistory_future[$#dirhistory_future]}" + typeset $1="${dirhistory_future[$#dirhistory_future]}" if [[ $#dirhistory_future -gt 0 ]]; then dirhistory_future[$#dirhistory_future]=() fi diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme index ddb34236b..a11f7b0a9 100644 --- a/themes/adben.zsh-theme +++ b/themes/adben.zsh-theme @@ -32,8 +32,8 @@ ########## COLOR ########### for COLOR in CYAN WHITE YELLOW MAGENTA BLACK BLUE RED DEFAULT GREEN GREY; do - print -v "PR_$COLOR" "%b%{$fg[${(L)COLOR}]%}" - print -v "PR_BRIGHT_$COLOR" "%B%{$fg[${(L)COLOR}]%}" + typeset PR_$COLOR="%b%{$fg[${(L)COLOR}]%}" + typeset PR_BRIGHT_$COLOR="%B%{$fg[${(L)COLOR}]%}" done PR_RESET="%{$reset_color%}" diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme index ca58b94a3..fc3cb2caa 100644 --- a/themes/jonathan.zsh-theme +++ b/themes/jonathan.zsh-theme @@ -37,8 +37,8 @@ setopt prompt_subst # See if we can use colors. autoload zsh/terminfo for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do - print -v "PR_$color" "%{$terminfo[bold]$fg[${(L)color}]%}" - print -v "PR_LIGHT_$color" "%{$fg[${(L)color}]%}" + typeset PR_$color="%{$terminfo[bold]$fg[${(L)color}]%}" + typeset PR_LIGHT_$color="%{$fg[${(L)color}]%}" done PR_NO_COLOUR="%{$terminfo[sgr0]%}" diff --git a/themes/simonoff.zsh-theme b/themes/simonoff.zsh-theme index 201d5d7e4..c7e35e160 100644 --- a/themes/simonoff.zsh-theme +++ b/themes/simonoff.zsh-theme @@ -45,8 +45,8 @@ setopt prompt_subst # See if we can use colors. autoload zsh/terminfo for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do - print -v "PR_$color" "%{$terminfo[bold]$fg[${(L)color}]%}" - print -v "PR_LIGHT_$color" "%{$fg[${(L)color}]%}" + typeset PR_$color="%{$terminfo[bold]$fg[${(L)color}]%}" + typeset PR_LIGHT_$color="%{$fg[${(L)color}]%}" done PR_NO_COLOUR="%{$terminfo[sgr0]%}" -- cgit v1.2.3-70-g09d2 From 7d03ea18eda8d89316fdb035fb3840f48a065338 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Thu, 16 Dec 2021 10:15:55 +0100 Subject: fix: declare variables as global when using `typeset` Fixes fb86ec77 --- plugins/dirhistory/dirhistory.plugin.zsh | 4 ++-- themes/adben.zsh-theme | 4 ++-- themes/jonathan.zsh-theme | 4 ++-- themes/simonoff.zsh-theme | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'themes') diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh index 2f5a79735..8268147f6 100644 --- a/plugins/dirhistory/dirhistory.plugin.zsh +++ b/plugins/dirhistory/dirhistory.plugin.zsh @@ -19,14 +19,14 @@ export DIRHISTORY_SIZE=30 # Returns the element if the array was not empty, # otherwise returns empty string. function pop_past() { - typeset $1="${dirhistory_past[$#dirhistory_past]}" + typeset -g $1="${dirhistory_past[$#dirhistory_past]}" if [[ $#dirhistory_past -gt 0 ]]; then dirhistory_past[$#dirhistory_past]=() fi } function pop_future() { - typeset $1="${dirhistory_future[$#dirhistory_future]}" + typeset -g $1="${dirhistory_future[$#dirhistory_future]}" if [[ $#dirhistory_future -gt 0 ]]; then dirhistory_future[$#dirhistory_future]=() fi diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme index a11f7b0a9..c2fdbed23 100644 --- a/themes/adben.zsh-theme +++ b/themes/adben.zsh-theme @@ -32,8 +32,8 @@ ########## COLOR ########### for COLOR in CYAN WHITE YELLOW MAGENTA BLACK BLUE RED DEFAULT GREEN GREY; do - typeset PR_$COLOR="%b%{$fg[${(L)COLOR}]%}" - typeset PR_BRIGHT_$COLOR="%B%{$fg[${(L)COLOR}]%}" + typeset -g PR_$COLOR="%b%{$fg[${(L)COLOR}]%}" + typeset -g PR_BRIGHT_$COLOR="%B%{$fg[${(L)COLOR}]%}" done PR_RESET="%{$reset_color%}" diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme index fc3cb2caa..48927f1db 100644 --- a/themes/jonathan.zsh-theme +++ b/themes/jonathan.zsh-theme @@ -37,8 +37,8 @@ setopt prompt_subst # See if we can use colors. autoload zsh/terminfo for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do - typeset PR_$color="%{$terminfo[bold]$fg[${(L)color}]%}" - typeset PR_LIGHT_$color="%{$fg[${(L)color}]%}" + typeset -g PR_$color="%{$terminfo[bold]$fg[${(L)color}]%}" + typeset -g PR_LIGHT_$color="%{$fg[${(L)color}]%}" done PR_NO_COLOUR="%{$terminfo[sgr0]%}" diff --git a/themes/simonoff.zsh-theme b/themes/simonoff.zsh-theme index c7e35e160..287781d9e 100644 --- a/themes/simonoff.zsh-theme +++ b/themes/simonoff.zsh-theme @@ -45,8 +45,8 @@ setopt prompt_subst # See if we can use colors. autoload zsh/terminfo for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do - typeset PR_$color="%{$terminfo[bold]$fg[${(L)color}]%}" - typeset PR_LIGHT_$color="%{$fg[${(L)color}]%}" + typeset -g PR_$color="%{$terminfo[bold]$fg[${(L)color}]%}" + typeset -g PR_LIGHT_$color="%{$fg[${(L)color}]%}" done PR_NO_COLOUR="%{$terminfo[sgr0]%}" -- cgit v1.2.3-70-g09d2 From 41c15a21599f16a802046f741ac26f80c30c7c31 Mon Sep 17 00:00:00 2001 From: Marc Cornellà Date: Thu, 16 Dec 2021 10:51:25 +0100 Subject: fix(jonathan): fix top bar alignment with RPROMPT --- themes/jonathan.zsh-theme | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'themes') diff --git a/themes/jonathan.zsh-theme b/themes/jonathan.zsh-theme index 48927f1db..11d799a84 100644 --- a/themes/jonathan.zsh-theme +++ b/themes/jonathan.zsh-theme @@ -1,4 +1,6 @@ function theme_precmd { + local TERMWIDTH=$(( COLUMNS - ${ZLE_RPROMPT_INDENT:-1} )) + PR_FILLBAR="" PR_PWDLEN="" @@ -7,12 +9,12 @@ function theme_precmd { local pwdsize=${#${(%):-%~}} # Truncate the path if it's too long. - if (( promptsize + rubypromptsize + pwdsize > COLUMNS )); then - (( PR_PWDLEN = COLUMNS - promptsize )) + if (( promptsize + rubypromptsize + pwdsize > TERMWIDTH )); then + (( PR_PWDLEN = TERMWIDTH - promptsize )) elif [[ "${langinfo[CODESET]}" = UTF-8 ]]; then - PR_FILLBAR="\${(l:$(( COLUMNS - (promptsize + rubypromptsize + pwdsize) ))::${PR_HBAR}:)}" + PR_FILLBAR="\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize) ))::${PR_HBAR}:)}" else - PR_FILLBAR="${PR_SHIFT_IN}\${(l:$(( COLUMNS - (promptsize + rubypromptsize + pwdsize) ))::${altchar[q]:--}:)}${PR_SHIFT_OUT}" + PR_FILLBAR="${PR_SHIFT_IN}\${(l:$(( TERMWIDTH - (promptsize + rubypromptsize + pwdsize) ))::${altchar[q]:--}:)}${PR_SHIFT_OUT}" fi } -- cgit v1.2.3-70-g09d2