diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2021-01-03 22:37:27 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2021-01-03 22:37:27 +0100 |
commit | 5f21ebc0d3539276ccee967dd510e7aba8b31c0c (patch) | |
tree | bd29c23d4031f1161e704d1d7fc5aa901c38be12 | |
parent | d48742861083f37c670447ca98fb43490531be80 (diff) | |
download | nixos-5f21ebc0d3539276ccee967dd510e7aba8b31c0c.tar nixos-5f21ebc0d3539276ccee967dd510e7aba8b31c0c.tar.gz nixos-5f21ebc0d3539276ccee967dd510e7aba8b31c0c.tar.bz2 nixos-5f21ebc0d3539276ccee967dd510e7aba8b31c0c.tar.xz nixos-5f21ebc0d3539276ccee967dd510e7aba8b31c0c.zip |
zsh customization
-rw-r--r-- | accounts/gkleen@sif/zshrc | 12 | ||||
-rw-r--r-- | user-profiles/zsh/default.nix | 1 | ||||
-rw-r--r-- | user-profiles/zsh/p10k.zsh | 11 | ||||
-rw-r--r-- | user-profiles/zsh/zshrc | 26 |
4 files changed, 36 insertions, 14 deletions
diff --git a/accounts/gkleen@sif/zshrc b/accounts/gkleen@sif/zshrc index f095ee21..993fb94a 100644 --- a/accounts/gkleen@sif/zshrc +++ b/accounts/gkleen@sif/zshrc | |||
@@ -383,18 +383,6 @@ alias -g G='| grep' | |||
383 | alias -g B='&> /dev/null &' | 383 | alias -g B='&> /dev/null &' |
384 | alias -g BB='&> /dev/null &!' | 384 | alias -g BB='&> /dev/null &!' |
385 | 385 | ||
386 | fancy-ctrl-z () { | ||
387 | emulate -LR zsh | ||
388 | if [[ $#BUFFER -eq 0 ]]; then | ||
389 | [[ -n $(jobs -s) ]] && bg | ||
390 | zle redisplay | ||
391 | else | ||
392 | zle push-input | ||
393 | fi | ||
394 | } | ||
395 | zle -N fancy-ctrl-z | ||
396 | bindkey '^Z' fancy-ctrl-z | ||
397 | |||
398 | export DEFAULT_USER=gkleen | 386 | export DEFAULT_USER=gkleen |
399 | export EDITOR=emacsclient | 387 | export EDITOR=emacsclient |
400 | 388 | ||
diff --git a/user-profiles/zsh/default.nix b/user-profiles/zsh/default.nix index 58fa0376..88873c1a 100644 --- a/user-profiles/zsh/default.nix +++ b/user-profiles/zsh/default.nix | |||
@@ -21,6 +21,7 @@ in { | |||
21 | source "${cfg.home.homeDirectory}/${p10kZsh}" | 21 | source "${cfg.home.homeDirectory}/${p10kZsh}" |
22 | ''; | 22 | ''; |
23 | initExtra = lib.mkAfter '' | 23 | initExtra = lib.mkAfter '' |
24 | source ${./zshrc} | ||
24 | source "${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" | 25 | source "${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" |
25 | ''; | 26 | ''; |
26 | }; | 27 | }; |
diff --git a/user-profiles/zsh/p10k.zsh b/user-profiles/zsh/p10k.zsh index fb9af12c..ff66f0df 100644 --- a/user-profiles/zsh/p10k.zsh +++ b/user-profiles/zsh/p10k.zsh | |||
@@ -37,6 +37,7 @@ | |||
37 | vcs # git status | 37 | vcs # git status |
38 | # =========================[ Line #2 ]========================= | 38 | # =========================[ Line #2 ]========================= |
39 | newline # \n | 39 | newline # \n |
40 | dir | ||
40 | prompt_char # prompt symbol | 41 | prompt_char # prompt symbol |
41 | ) | 42 | ) |
42 | 43 | ||
@@ -100,6 +101,9 @@ | |||
100 | time # current time | 101 | time # current time |
101 | # =========================[ Line #2 ]========================= | 102 | # =========================[ Line #2 ]========================= |
102 | newline | 103 | newline |
104 | status | ||
105 | command_execution_time | ||
106 | time | ||
103 | # ip # ip address and bandwidth usage for a specified network interface | 107 | # ip # ip address and bandwidth usage for a specified network interface |
104 | # public_ip # public IP address | 108 | # public_ip # public IP address |
105 | # proxy # system-wide http/https/ftp proxy | 109 | # proxy # system-wide http/https/ftp proxy |
@@ -500,7 +504,7 @@ | |||
500 | 504 | ||
501 | # Status when it's just an error code (e.g., '1'). No need to show it if prompt_char is enabled as | 505 | # Status when it's just an error code (e.g., '1'). No need to show it if prompt_char is enabled as |
502 | # it will signify error by turning red. | 506 | # it will signify error by turning red. |
503 | typeset -g POWERLEVEL9K_STATUS_ERROR=false | 507 | typeset -g POWERLEVEL9K_STATUS_ERROR=true |
504 | typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=160 | 508 | typeset -g POWERLEVEL9K_STATUS_ERROR_FOREGROUND=160 |
505 | typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION='✘' | 509 | typeset -g POWERLEVEL9K_STATUS_ERROR_VISUAL_IDENTIFIER_EXPANSION='✘' |
506 | 510 | ||
@@ -1540,7 +1544,10 @@ | |||
1540 | # - always: Trim down prompt when accepting a command line. | 1544 | # - always: Trim down prompt when accepting a command line. |
1541 | # - same-dir: Trim down prompt when accepting a command line unless this is the first command | 1545 | # - same-dir: Trim down prompt when accepting a command line unless this is the first command |
1542 | # typed after changing current working directory. | 1546 | # typed after changing current working directory. |
1543 | typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=always | 1547 | typeset -g POWERLEVEL9K_TRANSIENT_PROMPT=off |
1548 | |||
1549 | function p10k-on-pre-prompt() { p10k display '1'=show '2/left/dir'=hide '2/right/(status|command_execution_time|time)'=hide } | ||
1550 | function p10k-on-post-prompt() { p10k display '2/left/(dir|prompt_char)'=show 'empty_line|1'=hide '2/right/(status|command_execution_time|time)'=show } | ||
1544 | 1551 | ||
1545 | # Instant prompt mode. | 1552 | # Instant prompt mode. |
1546 | # | 1553 | # |
diff --git a/user-profiles/zsh/zshrc b/user-profiles/zsh/zshrc new file mode 100644 index 00000000..3660ef27 --- /dev/null +++ b/user-profiles/zsh/zshrc | |||
@@ -0,0 +1,26 @@ | |||
1 | fancy-ctrl-z () { | ||
2 | emulate -LR zsh | ||
3 | if [[ $#BUFFER -eq 0 ]]; then | ||
4 | [[ -n $(jobs -s) ]] && bg | ||
5 | zle redisplay | ||
6 | else | ||
7 | zle push-input | ||
8 | fi | ||
9 | } | ||
10 | zle -N fancy-ctrl-z | ||
11 | bindkey '^Z' fancy-ctrl-z | ||
12 | |||
13 | function fancy-ctrl-d() { | ||
14 | zle || exit 0 | ||
15 | [[ -n $BUFFER ]] && return | ||
16 | typeset -g precmd_functions=(fancy-ctrl-d) | ||
17 | zle accept-line | ||
18 | } | ||
19 | zle -N fancy-ctrl-d | ||
20 | bindkey '^D' fancy-ctrl-d | ||
21 | setopt ignore_eof | ||
22 | |||
23 | # word navigation for urxvt | ||
24 | bindkey -e | ||
25 | bindkey ';5C' emacs-forward-word | ||
26 | bindkey ';5D' emacs-backward-word \ No newline at end of file | ||