summaryrefslogtreecommitdiffstats
path: root/lass/2configs/zsh.nix
diff options
context:
space:
mode:
authorjeschli <jeschli@gmail.com>2018-02-28 20:10:42 +0000
committerjeschli <jeschli@gmail.com>2018-02-28 20:10:42 +0000
commita7e49dd5fc590ba2ccb26d559d672767c87a7692 (patch)
tree3d0fb66d17085f1288037da1b4d9987fa402e40e /lass/2configs/zsh.nix
parent4a2af184e6846f80b139357c6230558cd8785b10 (diff)
parent4c0d0f64ed21d3d7292bb5e8900d973e649375c1 (diff)
Merge branch 'staging/jeschli' of prism.i:stockholm into staging/jeschli
Diffstat (limited to 'lass/2configs/zsh.nix')
-rw-r--r--lass/2configs/zsh.nix72
1 files changed, 42 insertions, 30 deletions
diff --git a/lass/2configs/zsh.nix b/lass/2configs/zsh.nix
index 7b0ef79f3..aa3e6731d 100644
--- a/lass/2configs/zsh.nix
+++ b/lass/2configs/zsh.nix
@@ -50,16 +50,15 @@
#enable automatic rehashing of $PATH
zstyle ':completion:*' rehash true
+ #beautiful colors
eval $(dircolors -b ${pkgs.fetchFromGitHub {
owner = "trapd00r";
repo = "LS_COLORS";
rev = "master";
sha256="05lh5w3bgj9h8d8lrbbwbzw8788709cnzzkl8yh7m1dawkpf6nlp";
}}/LS_COLORS)
-
- #beautiful colors
alias ls='ls --color'
- # zstyle ':completion:*:default' list-colors ''${(s.:.)LS_COLORS}
+ zstyle ':completion:*:default' list-colors ''${(s.:.)LS_COLORS}
#emacs bindings
bindkey "[7~" beginning-of-line
@@ -72,25 +71,6 @@
alias la='ls -la'
#fancy window title magic
- case $TERM in
- (*xterm* | *rxvt*)
- function precmd {
- if test -n "$SSH_CLIENT"; then
- echo -ne "\033]0;$$ $USER@$HOST $PWD\007"
- else
- echo -ne "\033]0;$$ $USER@$PWD\007"
- fi
- }
- # This is seen while the shell waits for a command to complete.
- function preexec {
- if test -n "$SSH_CLIENT"; then
- echo -ne "\033]0;$$ $USER@$HOST $PWD $1\007"
- else
- echo -ne "\033]0;$$ $USER@$PWD $1\007"
- fi
- }
- ;;
- esac
'';
promptInit = ''
# TODO: figure out why we need to set this here
@@ -101,27 +81,59 @@
autoload -U promptinit
promptinit
- error='%(?..%F{red}%?%f )'
+ p_error='%(?..%F{red}%?%f )'
+ t_error='%(?..%? )'
case $UID in
0)
- username='%F{red}root%f '
+ p_username='%F{red}root%f'
+ t_username='root'
;;
1337)
- username=""
+ p_username=""
+ t_username=""
;;
*)
- username='%F{blue}%n%f '
+ p_username='%F{blue}%n%f'
+ t_username='%n'
;;
esac
if test -n "$SSH_CLIENT"; then
- PROMPT="$error$username@%F{magenta}%M%f %~ "
+ p_hostname='@%F{magenta}%M%f '
+ t_hostname='@%M '
+ else
+ p_hostname=""
+ t_hostname=""
+ fi
+
+ #check if in nix shell
+ if test -n "$IN_NIX_SHELL"; then
+ p_nixshell='%F{green}[s]%f '
+ t_nixshell='[s] '
else
- PROMPT="$error$username%~ "
+ p_nixshell=""
+ t_nixshell=""
fi
+
+ PROMPT="$p_error$p_username$p_hostname$p_nixshell%~ "
+ TITLE="$t_error$t_username$t_hostname$t_nixshell%~"
+ case $TERM in
+ (*xterm* | *rxvt*)
+ function precmd {
+ PROMPT_EVALED="$(print -P $TITLE)"
+ echo -ne "\033]0;$$ $PROMPT_EVALED\007"
+ }
+ # This is seen while the shell waits for a command to complete.
+ function preexec {
+ PROMPT_EVALED="$(print -P $TITLE)"
+ echo -ne "\033]0;$$ $PROMPT_EVALED $1\007"
+ }
+ ;;
+ esac
'';
};
- users.users.mainUser.shell = "/run/current-system/sw/bin/zsh";
- users.users.root.shell = "/run/current-system/sw/bin/zsh";
+ environment.shellAliases.ns = "nix-shell --command zsh";
+
+ users.defaultUserShell = "/run/current-system/sw/bin/zsh";
}