Commit graph

351 commits

Author SHA1 Message Date
romkatv
0cb680edd1 fix bugs in startup speedup and make it yet faster 2019-10-03 14:21:58 +02:00
romkatv
b8d648b339 Revert "Revert "speed up startup by about 3x""
This reverts commit e5e6249ffd.
2019-10-03 09:42:02 +02:00
romkatv
e5e6249ffd Revert "speed up startup by about 3x"
This reverts commit da72685c8b.

Something broke. See #242. Will debug this and roll forward later.
2019-10-02 19:40:50 +02:00
romkatv
da72685c8b speed up startup by about 3x 2019-10-02 15:29:23 +02:00
romkatv
add0875137 bug fix: set _p9k_keymap whenever vi_mode is in use
fixes #232
2019-09-25 09:22:34 +02:00
romkatv
cf00c04d1b aws: consult AWS_VAULT; hide if "default" 2019-09-24 14:29:21 +02:00
romkatv
4a4f7e1eef new prompt segment: dotnet_version
To enable this segment:

  1. Run `p10k configure`.
  2. Open `~/.p10k.zsh` and search for `dotnet_version`.
  3. Uncomment the first occurrence.

Fixes #233.
2019-09-24 10:19:11 +02:00
romkatv
15ff12279c be more lenient towards awful hacks that zplugin users employ 2019-09-20 12:09:47 +02:00
romkatv
8c695f9ad7 survive faulty fifos 2019-09-20 11:44:07 +02:00
romkatv
0067e0d4a1 survive emulate sh; fixes #226 2019-09-20 11:22:14 +02:00
romkatv
6b234b789d add OVERWRITE vi mode
When using vi_mode segment, the new mode can be enabled by
defining POWERLEVEL9K_VI_OVERWRITE_MODE_STRING.

    POWERLEVEL9K_VI_OVERWRITE_MODE_STRING=OVERWRITE

When using prompt_char, the new mode can be enabled by defining
POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true. The prompt symbol
in OVERWRITE state defaults to '▶'. It can be customized by
defining POWERLEVEL9K_PROMPT_CHAR_{OK,ERROR}_VIOWR_CONTENT_EXPANSION.

    POWERLEVEL9K_PROMPT_CHAR_OVERWRITE_STATE=true
    POWERLEVEL9K_PROMPT_CHAR_OK_VIOWR_CONTENT_EXPANSION=R
    POWERLEVEL9K_PROMPT_CHAR_ERROR_VIOWR_CONTENT_EXPANSION=R

Fixes #219.
2019-09-18 13:38:31 +02:00
romkatv
79e0190ba1 s/CONFLICTING/CONFLICTED/ for consistency; see #221 2019-09-18 13:20:33 +02:00
romkatv
80d9df7117 add CONFLICTING state to vcs
The new state is used whenever there is at least one conflicting
change. It is disabled by default. It can be enabled by
defining POWERLEVEL9K_VCS_CONFLICTING_STATE=true.

    POWERLEVEL9K_VCS_CONFLICTING_STATE=true
    POWERLEVEL9K_VCS_CONFLICTING_BACKGROUND=magenta

Fixes #221.
2019-09-18 10:45:30 +02:00
romkatv
ebe6a5198d survive SH_WORD_SPLIT; fixes #220 2019-09-17 21:41:07 +02:00
romkatv
f79ad65243 more robust KEYMAP handling 2019-09-17 09:59:39 +02:00
romkatv
2218060b2d don't assume that KEYMAP is valid everywhere within zle 2019-09-16 13:45:06 +02:00
Frankie Wittevrongel
71329b12f2
Fix typo in declare POWERLEVEL9K_DIR_ANCHOR_BOLD 2019-09-15 19:50:08 +01:00
romkatv
8554c755bd print new line(s) in precmd instead of embedding them in PROMPT 2019-09-12 11:45:17 +02:00
romkatv
9c9039253c put most of precmd code under !zle 2019-09-12 11:35:24 +02:00
romkatv
3674e69b43 stop setting prompt_cr and prompt_sp 2019-09-12 10:58:37 +02:00
romkatv
040be70d92 change the default value of POWERLEVEL9K_VPN_IP_INTERFACE to recognize wireguard 2019-09-12 10:55:56 +02:00
romkatv
fd96e92df6 show battery as CHARGED on macos if it is at 100% and connected to power supply 2019-09-09 14:48:32 +02:00
romkatv
9a8a6ca836 allow prompt segments to be disabled through configuration options
Prompt segment `foo` doesn't get evaluated or shown on the left
if `${POWERLEVEL9K_FOO_LEFT_DISABLED-$POWERLEVEL9K_FOO_DISABLED}`
is equal to `true`.

Example:

    POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
    POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(dir)

  - By default `dir` is shown on the left and on the right.
  - `POWERLEVEL9K_DIR_LEFT_DISABLED=true` disables `dir` on the left.
  - `POWERLEVEL9K_DIR_RIGHT_DISABLED=true` disables `dir` on the right.
  - `POWERLEVEL9K_DIR_DISABLED=true` disables `dir` everywhere.

Note that it's possible to hide segments without disabling their
evaluation through expansions. For example:

  POWERLEVEL9K_DIR_CONTENT_EXPANSION='${HIDE_DIR-$P9K_CONTENT}'
  POWERLEVEL9K_DIR_VISUAL_IDENTIFIER_EXPANSION='${HIDE_DIR-$P9K_VISUAL_IDENTIFIER}'

With these settings, `HIDE_DIR=''` hides `dir` while `unset HIDE_DIR`
restores it.

fixes #205
2019-09-07 10:05:56 +02:00
romkatv
b394a601a0 if auto_name_dirs is set, show directory without named directory support 2019-09-04 08:40:24 +02:00
romkatv
1547336bb6 don't set prompt_cr
Some users prefer to have broken prompt if the last line of command
output doesn't end in \n. Powerlevel10k should respect their choice.

See #197.
2019-09-02 13:52:17 +02:00
romkatv
8ace14beb0 don't set prompt_sp
Some users prefer to hide the last line of command output if it
doesn't end in \n. Powerlevel10k should respect their choice.

See #197.
2019-09-02 13:19:38 +02:00
romkatv
4bed2dc8c0 wizard: add an option to enable time segment 2019-09-01 14:43:16 +02:00
romkatv
fff03ea888 change the default value of POWERLEVEL9K_VPN_IP_INTERFACE 2019-08-30 12:01:35 +02:00
romkatv
eb58f05621 fix load fg color 2019-08-29 18:28:04 +02:00
romkatv
6582c7b25e include auto_name_dirs in the config signature 2019-08-29 11:42:14 +02:00
romkatv
84a562eca6 typo 2019-08-28 21:49:08 +02:00
romkatv
ce532fea3e try POWERLEVEL9K_DIR_PACKAGE_FILES patterns in order and skip files without "name" in them; fixes #190 2019-08-28 19:32:10 +02:00
romkatv
9e505d3dc1 allow network interface to contain colon 2019-08-28 19:00:55 +02:00
romkatv
5f610a0af9 fix network interface and ip parsing 2019-08-28 18:55:33 +02:00
romkatv
3a1ebea014 add more patterns to POWERLEVEL9K_SHORTEN_FOLDER_MARKER 2019-08-28 15:41:59 +02:00
romkatv
0c627eb31d add proxy prompt segment 2019-08-27 10:57:54 +02:00
romkatv
e4d78d2a72 fix custom prompt when the command is just one word; fixes #189 2019-08-27 08:53:28 +02:00
romkatv
613b1a646e don't unset P9K_SSH 2019-08-26 17:40:12 +02:00
romkatv
b3abfc089a fix detection of awesome-mapped-fontconfig in the wizard 2019-08-26 12:05:42 +02:00
romkatv
cb1f6c4815 make custom prompts more compatible with p9k 2019-08-24 12:58:55 +02:00
romkatv
e537a0ee62 better utf-8 handling 2019-08-20 14:56:43 +02:00
romkatv
a5e9af847d simplify nordvpn 2019-08-20 14:22:27 +02:00
romkatv
727d42ff48 expose P9K_SSH and make it available as soon as p10k is sourced 2019-08-20 11:19:11 +02:00
romkatv
3090ae6633 trip terraform whitespace 2019-08-19 16:35:26 +02:00
romkatv
4c12eb7224 add terraform prompt segment 2019-08-19 16:07:59 +02:00
romkatv
925ade3d29 make ZLE_RPROMPT_INDENT emulation condition less strict 2019-08-19 12:18:11 +02:00
romkatv
49063ee757 add ranger prompt; see #171 2019-08-17 10:01:06 +02:00
romkatv
33e1dd7790 Try harder when running on a system with incorrectly configured locale.
ZSH will still be broken when locale is misconfigured but at least p10k
will work so users will look for help elsewhere.

Fixes #173.
2019-08-17 09:22:31 +02:00
romkatv
96ba1b6f7d bug fix: don't hide command execution status on reset-prompt
fixes #171
2019-08-16 20:26:28 +02:00
romkatv
620a20fc9f support branch shortening when using gitstatusd 2019-08-14 07:28:50 +02:00
romkatv
7c57ca92e7 enable nvm prompt if function nvm is defined
Same thing with a few other env prompts. Fixes #166.
2019-08-13 08:17:27 +02:00
romkatv
bafade8963 add POWERLEVEL9K_RUST_VERSION_PROJECT_ONLY and POWERLEVEL9K_GO_VERSION_PROJECT_ONLY 2019-08-12 08:56:47 +02:00
romkatv
0d7ba09c4f short rust_version only when in a subdirectory of a cargo package
fixes #164
2019-08-12 08:29:59 +02:00
romkatv
626056865d add POWERLEVEL9K_RVM_SHOW_GEMSET and POWERLEVEL9K_RVM_SHOW_PREFIX
Some users want them. See https://github.com/Powerlevel9k/powerlevel9k/pull/1353.
2019-08-10 10:47:22 +02:00
romkatv
cf8b0594a3 Revert "add P9K_PROMPT_CHAR_STATE; it's experimental, don't use unless you are a trusted tester"
This reverts commit 429b07d4f8.

Fixes #154.
2019-08-09 09:18:00 +02:00
romkatv
429b07d4f8 add P9K_PROMPT_CHAR_STATE; it's experimental, don't use unless you are a trusted tester 2019-08-07 19:10:17 +02:00
romkatv
24a5261a39 wizard: enable os_icon for users who like many icons 2019-08-07 11:04:35 +02:00
romkatv
58fa653b90 don't trust $PWD as it can be changed; use ${(%):-%/} instead
It's possible that #156 is caused by some code changing PWD.
2019-08-07 08:38:26 +02:00
romkatv
36d2c588f1 ignore zshexit hook calls done from forks 2019-08-06 09:57:04 +02:00
romkatv
9d6dfeae73 add POWERLEVEL9K_VCS_CONFLICTED_MAX_NUM 2019-08-05 22:26:23 +02:00
romkatv
59e96984a1 be more tolerant towards misconfigured locales; users with non-utf-8 locales will still have broken shells but at least p10k will work 2019-08-05 20:23:30 +02:00
romkatv
d8c509f5c9 require zsh 5.3 for nordvpn segment; fixes #148 2019-08-05 11:17:34 +02:00
romkatv
d0fadfff97 add another option for i686 users 2019-08-05 10:43:40 +02:00
romkatv
f62d1d5ae3 speciazled diagnostics for i686; more escapes; more opts 2019-08-05 10:37:04 +02:00
romkatv
0f00e5e9e2 defend against global IFS leaks from other code; for #146 2019-08-02 07:07:23 +02:00
romkatv
b6a365dd40 add P9K_NORDVPN_TECHNOLOGY 2019-08-01 23:18:13 +02:00
romkatv
37ab63fe69 bug fix: support color names in vcs style; fixes #144 2019-08-01 15:09:39 +02:00
romkatv
3fe113f91d better errors in p10k segment 2019-07-31 19:54:49 +02:00
romkatv
8d2ffb43db add "help" and "segment" commands to p10k 2019-07-31 19:41:14 +02:00
romkatv
a6b572da45 add p10k configure 2019-07-31 18:21:37 +02:00
romkatv
0c0641d579 add a teardown hook for zplugin 2019-07-31 13:03:17 +02:00
romkatv
40df756e2d run configuration wizard if POWERLEVEL9K_MODE is the only set parameter 2019-07-31 10:00:27 +02:00
romkatv
d6dedc53bc support hot reloading of gitstatus parameters 2019-07-31 09:53:00 +02:00
romkatv
38a3ca7dc3 support gke kubecontext clusters that are mapped to regions instead of zones
fixes #139
2019-07-30 20:00:00 +02:00
Roman Perepelitsa
cd8d8e4594
Remove erroneous plus
Fixes #142
2019-07-30 17:24:46 +02:00
romkatv
2e5a085dbe run configuration wizard automatically if no POWERLEVEL9K options are defined 2019-07-30 15:11:58 +02:00
romkatv
5e4628d485 fix fg color of RIGHT_PROMPT_LAST_SEGMENT_END_SYMBOL 2019-07-30 12:49:36 +02:00
romkatv
7cf4f7e57d ensure kubecontext namespace is not empty 2019-07-30 09:38:27 +02:00
romkatv
32421d296c expose more P9K_KUBECONTEXT variables for gke and eks contexts 2019-07-30 09:02:46 +02:00
romkatv
f337616738 use consisent patterns when parsing yaml 2019-07-30 07:55:18 +02:00
romkatv
05deaa802f kubecontext: handle strings with spaces and ignore multi-line strings 2019-07-30 07:52:26 +02:00
romkatv
2318bda2c3 bug fixes: don't replace '_' with ' ' in gke clusters and clear the default of POWERLEVEL9K_KUBECONTEXT_SHORTEN 2019-07-30 07:14:51 +02:00
romkatv
224b62fbe4 silly typo: '\n' => $'\n'
fixes #140
2019-07-30 06:13:45 +02:00
romkatv
5bcbee96e4 add optional kubecontext shortening for gke and eks contexts
This is done via an optional array parameter that lists
shortening stragies to be applied. Currently there are
only two supported strategies: 'gke' and 'eks'.

  # Shorten gke and eks cluster names:
  #
  #   - gke_projectname_availability-zone_cluster-01         => cluster-01
  #   - arn:aws:eks:us-east-1:XXXXXXXXXXXX:cluster/eks-infra => eks-infra
  #
  # This transformation is applied before class matching and content
  # expansion.
  POWERLEVEL9K_KUBECONTEXT_SHORTEN=(gke eks)

For https://github.com/romkatv/powerlevel10k/issues/139.
2019-07-29 21:56:15 +02:00
romkatv
bdc211b64f add nodeenv parameters similar to other envs 2019-07-29 16:10:28 +02:00
romkatv
ba39eb3421 support POWERLEVEL9K_CONTEXT_${state}_TEMPLATE 2019-07-29 14:36:21 +02:00
romkatv
bab487aa6e quote process subs 2019-07-29 14:18:57 +02:00
romkatv
f4cdf0e0eb fix POWERLEVEL9K_DIR_CLASSES 2019-07-29 12:38:47 +02:00
romkatv
7f6e74f012 Don't show ram prompt if /proc/meminfo lists not-a-number for MemAvailable.
I've never encountered the case where this commit makes a difference
but it's possible that #136 will get fixed.
2019-07-29 10:07:42 +02:00
romkatv
3466b385ff expose p9k_configure 2019-07-28 18:54:02 +02:00
romkatv
0378a0a54c cleanup 2019-07-28 12:19:51 +02:00
romkatv
57b1f1aa74 default background to black in p9k_prompt_segment; comments 2019-07-27 13:20:27 +02:00
romkatv
b27ff42ac3 do nothing in p9k_prompt_segment if not called by p10k 2019-07-27 13:18:09 +02:00
romkatv
80770d6a79 fix status on zsh 5.1 2019-07-27 12:27:56 +02:00
romkatv
b66d6a7105 typo 2019-07-27 12:14:16 +02:00
romkatv
436740db8e fix many bugs in status related to pipelines 2019-07-27 12:09:09 +02:00
romkatv
93857552cf recognize vivis and vivli keymaps as visual vi mode
These keymaps are created by https://github.com/b4b4r07/zsh-vimode-visual.
I don't know why anyone would use this instead of the standard `v` and `V` keybindings.

Requested in https://github.com/romkatv/powerlevel10k/issues/134.
2019-07-27 00:19:04 +02:00
romkatv
01e66aab67 add a few extra states and parameters to make it possible to configure decent status 2019-07-26 15:35:46 +02:00
romkatv
cef049e0de nordvpn: add CONNECTING and DISCONECTING states, remove OTHER
See https://github.com/romkatv/powerlevel10k/issues/133.
2019-07-26 10:20:40 +02:00
romkatv
0e31c204f7 cleanup in nordvpn 2019-07-25 17:54:12 +02:00
romkatv
fb50402fc9 remove junk 2019-07-25 14:18:11 +02:00
romkatv
b07d0b7083 add nordvpn prompt segment
This segment has four states.

MISSING: nordvpn is not installed. By default the segment is not shown
in this state. Override POWERLEVEL9K_NORDVPN_MISSING_CONTENT_EXPANSION
and/or POWERLEVEL9K_NORDVPN_MISSING_VISUAL_IDENTIFIER_EXPANSION to make
the segment visible.

CONNECTED: nordvpn is connected. By default shows LOCK_ICON as icon and
country code as content. In addition, the following variables are set
for the use by POWERLEVEL9K_NORDVPN_CONNECTED_CONTENT_EXPANSION
and POWERLEVEL9K_NORDVPN_CONNECTED_VISUAL_IDENTIFIER_EXPANSION:
P9K_NORDVPN_PROTOCOL, P9K_NORDVPN_IP_ADDRESS,
P9K_NORDVPN_SERVER, P9K_NORDVPN_COUNTRY, P9K_NORDVPN_CITY and
P9K_NORDVPN_STATUS (always "Connected"). These correspond to the output
lines of `nordvpn status`.

DISCONNECTED: nordvpn is disconnected. By default shows LOCK_ICON as
icon and FAIL_ICON as content. P9K_NORDVPN_STATUS is set to "Disconnected".

OTHER: nordvpn is in status other than "Connected" or "Disconnected".
I'm not sure this is possible. By default shows LOCK_ICON as
icon and FAIL_ICON as content. P9K_NORDVPN_STATUS is set to the
actual status (neither empty, "Connected" nor "Disconnected").

Fixes #133. Needs more testing.
2019-07-25 14:12:11 +02:00
romkatv
07eae5942d optimize style escaping 2019-07-24 23:05:41 +02:00
romkatv
80fc1fd56a comments 2019-07-24 22:23:54 +02:00
romkatv
694084dd6a document p9k_prompt_segment 2019-07-24 22:18:10 +02:00
romkatv
043ae21090 stop passing arguments to prompt_* functions; rename some internal functions 2019-07-24 21:07:28 +02:00
romkatv
82698c179b delete prompt_icons_test 2019-07-24 19:58:07 +02:00
romkatv
6eaa39e370 daemonize async pump 2019-07-24 19:42:47 +02:00
romkatv
1402ca55b1 correctly handle ZLE_RPROMPT_INDENT changes 2019-07-24 19:11:43 +02:00
romkatv
5a9c774d79 reinit on param changes 2019-07-24 18:34:29 +02:00
romkatv
d9f0922945 make prompt_powerlevel9k_teardown and prompt_powerlevel9k_setup reentrant 2019-07-24 15:52:54 +02:00
romkatv
40fa321cc2 move icons.zsh to internal 2019-07-24 15:06:36 +02:00
romkatv
be1a97bf47 inline colors.zsh, utilities.zsh and vcs.zsh 2019-07-24 15:01:26 +02:00
romkatv
4a9f441c7b rename all internal vars 2019-07-24 14:34:26 +02:00
romkatv
49768006de bug fixes 2019-07-24 12:47:56 +02:00
romkatv
202f781e59 s/P9K_NODE_VERSION_PROJECT_ONLY/POWERLEVEL9K_NODE_VERSION_PROJECT_ONLY 2019-07-23 23:17:01 +02:00
romkatv
12a99c087d continue param refactoring 2019-07-23 16:20:59 +02:00
romkatv
d63fd9a873 start massive refactoring of config params 2019-07-23 15:47:25 +02:00
romkatv
94efac6aab less escaping 2019-07-23 10:00:18 +02:00
romkatv
608684757a more intelligent quoting of expansions 2019-07-23 09:16:47 +02:00
romkatv
37f0a4d548 cleanup 2019-07-22 23:19:04 +02:00
romkatv
6b9a2e0cec got overexcited with backslashes 2019-07-22 23:14:53 +02:00
romkatv
ee44359256 wrap unescaped multiline prefixes; fixes #125 2019-07-22 22:43:35 +02:00
romkatv
66d09d6f31 add POWERLEVEL9K_ICON_BEFORE_CONTENT 2019-07-21 19:43:14 +02:00
romkatv
8300a1e363 add POWERLEVEL9K_MULTILINE_FIRST_PROMPT_GAP_EXPANSION 2019-07-21 18:54:08 +02:00
romkatv
5dd3ecab5f make gap between left and right prompt customizable 2019-07-21 10:48:57 +02:00
romkatv
fa0c447817 don't use state CHARGED when the battery is at 100% and discharging; use DISCONNECTED instead 2019-07-20 15:40:15 +02:00
romkatv
dc601559fa propagate _P9K_SSH similar to Pure 2019-07-20 14:14:42 +02:00
romkatv
c4d3ec2cc5 add POWERLEVEL9K_COMMAND_EXECUTION_TIME_FORMAT 2019-07-20 12:41:52 +02:00
romkatv
ef06651f68 bug fix: default {RIGHT,LEFT}_MIDDLE_WHITESPACE to space 2019-07-19 23:28:06 +02:00
romkatv
259a2954cd typo 2019-07-19 22:50:26 +02:00
romkatv
d65e7eb926 bug fix: don't update _P9K_BG and _P9K_I when a segment has empty content and icon 2019-07-19 14:59:44 +02:00
romkatv
fa457a3282 fix purge when dir contains weird shit 2019-07-19 14:27:16 +02:00
romkatv
d81b4dbf68 speed up truncate_to_unique 2019-07-19 14:19:24 +02:00
romkatv
b7a8139e97 fix POWERLEVEL9K_DIR_MAX_LENGTH 2019-07-19 13:29:54 +02:00
romkatv
233b5c7c88 add POWERLEVEL9K_DIR_MAX_LENGTH 2019-07-18 17:50:37 +02:00
romkatv
ebb08c881f add POWERLEVEL9K_DIR_SHORTENED_FOREGROUND 2019-07-18 16:29:45 +02:00
romkatv
ff24a9f42b add POWERLEVEL9K_DIR_ANCHOR_BOLD and POWERLEVEL9K_DIR_ANCHOR_FOREGROUND 2019-07-18 14:20:04 +02:00
romkatv
3dac653c52 fix styling bugs in dir 2019-07-18 13:30:34 +02:00
romkatv
cd4d1358b3 fix quoting in dir 2019-07-18 13:09:56 +02:00
romkatv
86d6412988 grammar 2019-07-18 12:50:04 +02:00
romkatv
c5f32d1ea5 add POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS and POWERLEVEL9K_DIR_MIN_COMMAND_COLUMNS_PCT 2019-07-18 12:49:32 +02:00
romkatv
d41e18416f finish auto-shrinking dir; still not tested yet 2019-07-18 12:21:54 +02:00
romkatv
394dffa77b Merge branch 'master' into dev 2019-07-17 23:25:08 +02:00
romkatv
f37d7e6742 don't update time unnecessarily 2019-07-17 23:24:53 +02:00
romkatv
7478f07100 ensure there is at least one space between left and right prompts 2019-07-17 23:24:18 +02:00
romkatv
389b2ce5c2 prototype for auto-shrinking dir 2019-07-17 19:34:01 +02:00
romkatv
0660d8c97d bug fix: %-expand POWERLEVEL9K_TIME_FORMAT on every prompt
reported in #77
2019-07-17 16:26:14 +02:00
romkatv
568dc8beb4 add MULTILINE_{FIRST,NEWLINE,LAST}_PROMPT_SUFFIX 2019-07-17 10:31:59 +02:00
romkatv
c5f27b1cc5 optimize codegen for icons 2019-07-17 09:52:37 +02:00