Browse Source

zshrc propmt possibilities moved to zshrc.d

master
Dirk Alders 1 year ago
parent
commit
0255b308ce

+ 0
- 147
zshrc View File

@@ -69,153 +69,6 @@ TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'
69 69
 # make less more friendly for non-text input files, see lesspipe(1)
70 70
 #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
71 71
 
72
-# set variable identifying the chroot you work in (used in the prompt below)
73
-if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
74
-    debian_chroot=$(cat /etc/debian_chroot)
75
-fi
76
-
77
-# set a fancy prompt (non-color, unless we know we "want" color)
78
-case "$TERM" in
79
-    xterm-color|*-256color) color_prompt=yes;;
80
-esac
81
-
82
-# uncomment for a colored prompt, if the terminal has the capability; turned
83
-# off by default to not distract the user: the focus in a terminal window
84
-# should be on the output of commands, not on the prompt
85
-force_color_prompt=yes
86
-
87
-if [ -n "$force_color_prompt" ]; then
88
-    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
89
-        # We have color support; assume it's compliant with Ecma-48
90
-        # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
91
-        # a case would tend to support setf rather than setaf.)
92
-        color_prompt=yes
93
-    else
94
-        color_prompt=
95
-    fi
96
-fi
97
-
98
-configure_prompt() {
99
-    prompt_symbol=㉿
100
-    # Skull emoji for root terminal
101
-    [ "$EUID" -eq 0 ] && prompt_symbol=💀
102
-    case "$PROMPT_ALTERNATIVE" in
103
-        twoline)
104
-            PROMPT=$'%F{%(#.blue.green)}╔══${debian_chroot:+($debian_chroot)─}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))─}(%B%F{%(#.red.blue)}%n'$prompt_symbol$'%m%b%F{%(#.blue.green)})-[%B%F{reset}%(6~.%-1~/…/%4~.%5~)%b%F{%(#.blue.green)}]\n`giti -n`%F{%(#.blue.green)}╚═%B%(#.%F{red}#.%F{blue}$)%b%F{reset} '
105
-            # Right-side prompt with exit codes and background processes
106
-            RPROMPT=$'%(?.. %? %F{red}%B⨯%b%F{reset})%(1j. %j %F{yellow}%B⚙%b%F{reset}.)'
107
-            ;;
108
-        oneline)
109
-            PROMPT=$'${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%B%F{%(#.red.blue)}%n@%m%b%F{reset}:%B%F{%(#.blue.green)}%~%b%F{reset}%(#.#.$) '
110
-            RPROMPT=
111
-            ;;
112
-        backtrack)
113
-            PROMPT=$'${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%B%F{red}%n@%m%b%F{reset}:%B%F{blue}%~%b%F{reset}%(#.#.$) '
114
-            RPROMPT=
115
-            ;;
116
-    esac
117
-    unset prompt_symbol
118
-}
119
-
120
-# The following block is surrounded by two delimiters.
121
-# These delimiters must not be modified. Thanks.
122
-# START KALI CONFIG VARIABLES
123
-PROMPT_ALTERNATIVE=twoline
124
-NEWLINE_BEFORE_PROMPT=yes
125
-# STOP KALI CONFIG VARIABLES
126
-
127
-if [ "$color_prompt" = yes ]; then
128
-    # override default virtualenv indicator in prompt
129
-    VIRTUAL_ENV_DISABLE_PROMPT=1
130
-
131
-    configure_prompt
132
-
133
-    # enable syntax-highlighting
134
-    if [ -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then
135
-        . /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
136
-        ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
137
-        ZSH_HIGHLIGHT_STYLES[default]=none
138
-        ZSH_HIGHLIGHT_STYLES[unknown-token]=fg=white,underline
139
-        ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold
140
-        ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline
141
-        ZSH_HIGHLIGHT_STYLES[global-alias]=fg=green,bold
142
-        ZSH_HIGHLIGHT_STYLES[precommand]=fg=green,underline
143
-        ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold
144
-        ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=green,underline
145
-        ZSH_HIGHLIGHT_STYLES[path]=bold
146
-        ZSH_HIGHLIGHT_STYLES[path_pathseparator]=
147
-        ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]=
148
-        ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold
149
-        ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold
150
-        ZSH_HIGHLIGHT_STYLES[command-substitution]=none
151
-        ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta,bold
152
-        ZSH_HIGHLIGHT_STYLES[process-substitution]=none
153
-        ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta,bold
154
-        ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=green
155
-        ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=green
156
-        ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none
157
-        ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold
158
-        ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow
159
-        ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow
160
-        ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow
161
-        ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta
162
-        ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta,bold
163
-        ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta,bold
164
-        ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta,bold
165
-        ZSH_HIGHLIGHT_STYLES[assign]=none
166
-        ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold
167
-        ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold
168
-        ZSH_HIGHLIGHT_STYLES[named-fd]=none
169
-        ZSH_HIGHLIGHT_STYLES[numeric-fd]=none
170
-        ZSH_HIGHLIGHT_STYLES[arg0]=fg=cyan
171
-        ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold
172
-        ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold
173
-        ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold
174
-        ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold
175
-        ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold
176
-        ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold
177
-        ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout
178
-    fi
179
-else
180
-    PROMPT='${debian_chroot:+($debian_chroot)}%n@%m:%~%(#.#.$) '
181
-fi
182
-unset color_prompt force_color_prompt
183
-
184
-toggle_oneline_prompt(){
185
-    if [ "$PROMPT_ALTERNATIVE" = oneline ]; then
186
-        PROMPT_ALTERNATIVE=twoline
187
-    else
188
-        PROMPT_ALTERNATIVE=oneline
189
-    fi
190
-    configure_prompt
191
-    zle reset-prompt
192
-}
193
-zle -N toggle_oneline_prompt
194
-bindkey ^P toggle_oneline_prompt
195
-
196
-# If this is an xterm set the title to user@host:dir
197
-case "$TERM" in
198
-xterm*|rxvt*|Eterm|aterm|kterm|gnome*|alacritty)
199
-    TERM_TITLE=$'\e]0;${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%n@%m: %~\a'
200
-    ;;
201
-*)
202
-    ;;
203
-esac
204
-
205
-precmd() {
206
-    # Print the previously configured title
207
-    print -Pnr -- "$TERM_TITLE"
208
-
209
-    # Print a new line before the prompt, but only if it is not the first line
210
-    if [ "$NEWLINE_BEFORE_PROMPT" = yes ]; then
211
-        if [ -z "$_NEW_LINE_BEFORE_PROMPT" ]; then
212
-            _NEW_LINE_BEFORE_PROMPT=1
213
-        else
214
-            print ""
215
-        fi
216
-    fi
217
-}
218
-
219 72
 # enable color support of ls, less and man, and also add handy aliases
220 73
 if [ -x /usr/bin/dircolors ]; then
221 74
     test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"

+ 4
- 0
zshrc.d/__available__/prompt_adam1.zsh View File

@@ -0,0 +1,4 @@
1
+# set up the prompt
2
+autoload -Uz promptinit
3
+promptinit
4
+prompt adam1

+ 147
- 0
zshrc.d/__available__/prompt_kali.zsh View File

@@ -0,0 +1,147 @@
1
+# set variable identifying the chroot you work in (used in the prompt below)
2
+if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
3
+    debian_chroot=$(cat /etc/debian_chroot)
4
+fi
5
+
6
+# set a fancy prompt (non-color, unless we know we "want" color)
7
+case "$TERM" in
8
+    xterm-color|*-256color) color_prompt=yes;;
9
+esac
10
+
11
+# uncomment for a colored prompt, if the terminal has the capability; turned
12
+# off by default to not distract the user: the focus in a terminal window
13
+# should be on the output of commands, not on the prompt
14
+force_color_prompt=yes
15
+
16
+if [ -n "$force_color_prompt" ]; then
17
+    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
18
+        # We have color support; assume it's compliant with Ecma-48
19
+        # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
20
+        # a case would tend to support setf rather than setaf.)
21
+        color_prompt=yes
22
+    else
23
+        color_prompt=
24
+    fi
25
+fi
26
+
27
+configure_prompt() {
28
+    #prompt_symbol=㉿
29
+    prompt_symbol=@
30
+    # Skull emoji for root terminal
31
+    [ "$EUID" -eq 0 ] && prompt_symbol=💀
32
+    case "$PROMPT_ALTERNATIVE" in
33
+        twoline)
34
+            PROMPT=$'%F{%(#.blue.green)}╔══${debian_chroot:+($debian_chroot)─}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))─}(%B%F{%(#.red.blue)}%n'$prompt_symbol$'%m%b%F{%(#.blue.green)})-[%B%F{reset}%(6~.%-1~/…/%4~.%5~)%b%F{%(#.blue.green)}]\n`giti -n`%F{%(#.blue.green)}╚═%B%(#.%F{red}#.%F{blue}$)%b%F{reset} '
35
+            # Right-side prompt with exit codes and background processes
36
+            RPROMPT=$'%(?.. %? %F{red}%B⨯%b%F{reset})%(1j. %j %F{yellow}%B⚙%b%F{reset}.)'
37
+            ;;
38
+        oneline)
39
+            PROMPT=$'${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%B%F{%(#.red.blue)}%n@%m%b%F{reset}:%B%F{%(#.blue.green)}%~%b%F{reset}%(#.#.$) '
40
+            RPROMPT=
41
+            ;;
42
+        backtrack)
43
+            PROMPT=$'${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%B%F{red}%n@%m%b%F{reset}:%B%F{blue}%~%b%F{reset}%(#.#.$) '
44
+            RPROMPT=
45
+            ;;
46
+    esac
47
+    unset prompt_symbol
48
+}
49
+
50
+# The following block is surrounded by two delimiters.
51
+# These delimiters must not be modified. Thanks.
52
+# START KALI CONFIG VARIABLES
53
+PROMPT_ALTERNATIVE=twoline
54
+NEWLINE_BEFORE_PROMPT=yes
55
+# STOP KALI CONFIG VARIABLES
56
+
57
+if [ "$color_prompt" = yes ]; then
58
+    # override default virtualenv indicator in prompt
59
+    VIRTUAL_ENV_DISABLE_PROMPT=1
60
+
61
+    configure_prompt
62
+
63
+    # enable syntax-highlighting
64
+    if [ -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then
65
+        . /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
66
+        ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
67
+        ZSH_HIGHLIGHT_STYLES[default]=none
68
+        ZSH_HIGHLIGHT_STYLES[unknown-token]=fg=white,underline
69
+        ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold
70
+        ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline
71
+        ZSH_HIGHLIGHT_STYLES[global-alias]=fg=green,bold
72
+        ZSH_HIGHLIGHT_STYLES[precommand]=fg=green,underline
73
+        ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold
74
+        ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=green,underline
75
+        ZSH_HIGHLIGHT_STYLES[path]=bold
76
+        ZSH_HIGHLIGHT_STYLES[path_pathseparator]=
77
+        ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]=
78
+        ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold
79
+        ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold
80
+        ZSH_HIGHLIGHT_STYLES[command-substitution]=none
81
+        ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta,bold
82
+        ZSH_HIGHLIGHT_STYLES[process-substitution]=none
83
+        ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta,bold
84
+        ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=green
85
+        ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=green
86
+        ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none
87
+        ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold
88
+        ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow
89
+        ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow
90
+        ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow
91
+        ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta
92
+        ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta,bold
93
+        ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta,bold
94
+        ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta,bold
95
+        ZSH_HIGHLIGHT_STYLES[assign]=none
96
+        ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold
97
+        ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold
98
+        ZSH_HIGHLIGHT_STYLES[named-fd]=none
99
+        ZSH_HIGHLIGHT_STYLES[numeric-fd]=none
100
+        ZSH_HIGHLIGHT_STYLES[arg0]=fg=cyan
101
+        ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold
102
+        ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold
103
+        ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold
104
+        ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold
105
+        ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold
106
+        ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold
107
+        ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout
108
+    fi
109
+else
110
+    PROMPT='${debian_chroot:+($debian_chroot)}%n@%m:%~%(#.#.$) '
111
+fi
112
+unset color_prompt force_color_prompt
113
+
114
+toggle_oneline_prompt(){
115
+    if [ "$PROMPT_ALTERNATIVE" = oneline ]; then
116
+        PROMPT_ALTERNATIVE=twoline
117
+    else
118
+        PROMPT_ALTERNATIVE=oneline
119
+    fi
120
+    configure_prompt
121
+    zle reset-prompt
122
+}
123
+zle -N toggle_oneline_prompt
124
+bindkey ^P toggle_oneline_prompt
125
+
126
+# If this is an xterm set the title to user@host:dir
127
+case "$TERM" in
128
+xterm*|rxvt*|Eterm|aterm|kterm|gnome*|alacritty)
129
+    TERM_TITLE=$'\e]0;${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%n@%m: %~\a'
130
+    ;;
131
+*)
132
+    ;;
133
+esac
134
+
135
+precmd() {
136
+    # Print the previously configured title
137
+    print -Pnr -- "$TERM_TITLE"
138
+
139
+    # Print a new line before the prompt, but only if it is not the first line
140
+    if [ "$NEWLINE_BEFORE_PROMPT" = yes ]; then
141
+        if [ -z "$_NEW_LINE_BEFORE_PROMPT" ]; then
142
+            _NEW_LINE_BEFORE_PROMPT=1
143
+        else
144
+            print ""
145
+        fi
146
+    fi
147
+}

zshrc.d/__available__/powerline.zsh → zshrc.d/__available__/prompt_powerline.zsh View File


Loading…
Cancel
Save