Merge remote-tracking branch 'origin/github/pr/133'
authorMichael Prokop <mika@grml.org>
Fri, 3 Dec 2021 12:24:37 +0000 (13:24 +0100)
committerMichael Prokop <mika@grml.org>
Fri, 3 Dec 2021 12:24:37 +0000 (13:24 +0100)
doc/grmlzshrc.t2t
etc/zsh/zshrc

index c44f2e0..9016cea 100644 (file)
@@ -100,6 +100,10 @@ A value of zero turns off checking.
 : **NOCOR**
 Non zero values deactivate automatic correction of commands.
 
+: **NOETCHOSTS**
+Non zero values deactivate parsing of "/etc/hosts" disabling host completion
+using file's contents.
+
 : **NOMENU**
 If set to zero (default), allows selection from a menu, if there are at least
 five possible options of completion.
index ef2d716..89684e4 100644 (file)
@@ -481,6 +481,7 @@ setopt unset
 
 # setting some default values
 NOCOR=${NOCOR:-0}
+NOETCHOSTS=${NOETCHOSTS:-0}
 NOMENU=${NOMENU:-0}
 NOPRECMD=${NOPRECMD:-0}
 COMMAND_NOT_FOUND=${COMMAND_NOT_FOUND:-0}
@@ -893,7 +894,7 @@ function grmlcomp () {
     if is42 ; then
         [[ -r ~/.ssh/config ]] && _ssh_config_hosts=(${${(s: :)${(ps:\t:)${${(@M)${(f)"$(<$HOME/.ssh/config)"}:#Host *}#Host }}}:#*[*?]*}) || _ssh_config_hosts=()
         [[ -r ~/.ssh/known_hosts ]] && _ssh_hosts=(${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[\|]*}%%\ *}%%,*}) || _ssh_hosts=()
-        [[ -r /etc/hosts ]] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
+        [[ -r /etc/hosts ]] && [[ "$NOETCHOSTS" -eq 0 ]] && : ${(A)_etc_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}} || _etc_hosts=()
     else
         _ssh_config_hosts=()
         _ssh_hosts=()
@@ -3312,7 +3313,14 @@ zrcautoload lookupinit && lookupinit
 # variables
 
 # set terminal property (used e.g. by msgid-chooser)
-export COLORTERM="yes"
+case "${COLORTERM}" in
+  truecolor)
+    # do not overwrite
+    ;;
+  *)
+    export COLORTERM="yes"
+    ;;
+esac
 
 # aliases