about summary refs log tree commit diff
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2014-11-19 21:04:00 +0100
committeraszlig <aszlig@redmoonstudios.org>2014-11-19 21:04:00 +0100
commit47a13e1b9297fab8c82edb8349e0c87acd3fcfa1 (patch)
tree45c21d5a98258e47c01b950a69555b081bdc49bd
parentc8a0a4832d0ca0f81c81736eafac4b82058cac71 (diff)
zsh: Move into its own module.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
-rw-r--r--common-workstation.nix2
-rw-r--r--modules/module-list.nix1
-rw-r--r--modules/zsh/default.nix94
-rw-r--r--zsh.nix86
4 files changed, 96 insertions, 87 deletions
diff --git a/common-workstation.nix b/common-workstation.nix
index 123c7c5f..91fdd4fd 100644
--- a/common-workstation.nix
+++ b/common-workstation.nix
@@ -6,7 +6,6 @@ in {
   imports = [
     ./common.nix
     ./packages.nix
-    ./zsh.nix
     <nixpkgs/nixos/modules/programs/virtualbox.nix>
   ];
 
@@ -49,6 +48,7 @@ in {
   vuizvui.i3.enable = true;
   vuizvui.slim.enable = true;
   vuizvui.vlock.enable = true;
+  vuizvui.zsh.enable = true;
 
   services = {
     openssh = {
diff --git a/modules/module-list.nix b/modules/module-list.nix
index ced9f900..16387fdf 100644
--- a/modules/module-list.nix
+++ b/modules/module-list.nix
@@ -2,4 +2,5 @@
   ./i3
   ./slim
   ./vlock
+  ./zsh
 ]
diff --git a/modules/zsh/default.nix b/modules/zsh/default.nix
new file mode 100644
index 00000000..fa6769f0
--- /dev/null
+++ b/modules/zsh/default.nix
@@ -0,0 +1,94 @@
+{ lib, ... }:
+
+with lib;
+
+{
+  options.vuizvui.zsh = {
+    enable = mkEnableOption "zsh";
+  };
+
+  config = {
+    environment.shellInit = ''
+      export EDITOR="vim"
+      export EMAIL="aszlig@redmoonstudios.org"
+      export AUDIOSERVER="tcp/linx:8000"
+      export SCUMMVM_PORT="128:0"
+    '';
+
+    programs.zsh.enable = true;
+
+    programs.zsh.shellAliases.t = "task";
+
+    programs.zsh.interactiveShellInit = mkAfter ''
+      export HISTFILE=~/.histfile
+      export HISTSIZE=100000
+      export SAVEHIST=100000
+
+      unsetopt SHARE_HISTORY
+
+      setopt extendedglob
+      setopt extendedhistory
+      setopt globcomplete
+      setopt histnostore
+      setopt histreduceblanks
+      setopt correct
+      setopt dvorak
+      setopt interactivecomments
+      setopt autopushd
+      setopt autocd
+      setopt beep
+
+      bindkey -v
+      if [[ "$TERM" = xterm ]]; then
+        bindkey -v '\e[H' vi-beginning-of-line
+        bindkey -v '\e[F' vi-end-of-line
+      else
+        bindkey -v '\e[1~' vi-beginning-of-line
+        bindkey -v '\e[4~' vi-end-of-line
+      fi
+
+      bindkey -a '/' history-incremental-pattern-search-backward
+      bindkey -a '?' history-incremental-pattern-search-forward
+      bindkey '\e[A' up-line-or-history
+      bindkey '\e[B' down-line-or-history
+
+      zstyle ':completion:*' completer _expand _complete _ignored _approximate
+      zstyle ':completion:*' expand prefix suffix
+      zstyle ':completion:*' group-name '''
+      zstyle ':completion:*' insert-unambiguous true
+      zstyle ':completion:*' list-colors '''
+      zstyle ':completion:*' list-prompt \
+        %SAt %p: Hit TAB for more, or the character to insert%s
+      zstyle ':completion:*' list-suffixes true
+      zstyle ':completion:*' matcher-list ''' \
+        'm:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]}' \
+        'l:|=* r:|=*' 'r:|[._-]=** r:|=**'
+      zstyle ':completion:*' max-errors 2 numeric
+      zstyle ':completion:*' menu select=long
+      zstyle ':completion:*' original true
+      zstyle ':completion:*' preserve-prefix '//[^/]##/'
+      zstyle ':completion:*' prompt \
+        'Hm, did you mistype something? There are %e errors in the completion.'
+      zstyle ':completion:*' select-prompt \
+        %SScrolling active: current selection at %p%s
+      zstyle ':completion:*' use-compctl false
+      zstyle ':completion:*' verbose true
+
+      autoload -Uz compinit
+      compinit
+
+      autoload -Uz zmv
+    '';
+
+    programs.zsh.promptInit = ''
+      autoload -Uz prompt_special_chars
+
+      () {
+          local p_machine='%(!..%B%F{red}%n%b%F{blue}@)%b%F{red}%m'
+          local p_path='%B%F{blue}[%F{cyan}%~%B%F{blue}]'
+          local p_exitcode='%F{green}%?%(!.%F{cyan}>.%b%F{green}>)%b%f '
+          PROMPT="$p_machine$p_path$p_exitcode"
+      }
+    '';
+  };
+}
diff --git a/zsh.nix b/zsh.nix
deleted file mode 100644
index 5dfdcac5..00000000
--- a/zsh.nix
+++ /dev/null
@@ -1,86 +0,0 @@
-{ lib, ... }:
-
-{
-  environment.shellInit = ''
-    export EDITOR="vim"
-    export EMAIL="aszlig@redmoonstudios.org"
-    export AUDIOSERVER="tcp/linx:8000"
-    export SCUMMVM_PORT="128:0"
-  '';
-
-  programs.zsh.enable = true;
-
-  programs.zsh.shellAliases.t = "task";
-
-  programs.zsh.interactiveShellInit = lib.mkAfter ''
-    export HISTFILE=~/.histfile
-    export HISTSIZE=100000
-    export SAVEHIST=100000
-
-    unsetopt SHARE_HISTORY
-
-    setopt extendedglob
-    setopt extendedhistory
-    setopt globcomplete
-    setopt histnostore
-    setopt histreduceblanks
-    setopt correct
-    setopt dvorak
-    setopt interactivecomments
-    setopt autopushd
-    setopt autocd
-    setopt beep
-
-    bindkey -v
-    if [[ "$TERM" = xterm ]]; then
-      bindkey -v '\e[H' vi-beginning-of-line
-      bindkey -v '\e[F' vi-end-of-line
-    else
-      bindkey -v '\e[1~' vi-beginning-of-line
-      bindkey -v '\e[4~' vi-end-of-line
-    fi
-
-    bindkey -a '/' history-incremental-pattern-search-backward
-    bindkey -a '?' history-incremental-pattern-search-forward
-    bindkey '\e[A' up-line-or-history
-    bindkey '\e[B' down-line-or-history
-
-    zstyle ':completion:*' completer _expand _complete _ignored _approximate
-    zstyle ':completion:*' expand prefix suffix
-    zstyle ':completion:*' group-name '''
-    zstyle ':completion:*' insert-unambiguous true
-    zstyle ':completion:*' list-colors '''
-    zstyle ':completion:*' list-prompt \
-      %SAt %p: Hit TAB for more, or the character to insert%s
-    zstyle ':completion:*' list-suffixes true
-    zstyle ':completion:*' matcher-list ''' \
-      'm:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]}' \
-      'l:|=* r:|=*' 'r:|[._-]=** r:|=**'
-    zstyle ':completion:*' max-errors 2 numeric
-    zstyle ':completion:*' menu select=long
-    zstyle ':completion:*' original true
-    zstyle ':completion:*' preserve-prefix '//[^/]##/'
-    zstyle ':completion:*' prompt \
-      'Hm, did you mistype something? There are %e errors in the completion.'
-    zstyle ':completion:*' select-prompt \
-      %SScrolling active: current selection at %p%s
-    zstyle ':completion:*' use-compctl false
-    zstyle ':completion:*' verbose true
-
-    autoload -Uz compinit
-    compinit
-
-    autoload -Uz zmv
-  '';
-
-  programs.zsh.promptInit = ''
-    autoload -Uz prompt_special_chars
-
-    () {
-        local p_machine='%(!..%B%F{red}%n%b%F{blue}@)%b%F{red}%m'
-        local p_path='%B%F{blue}[%F{cyan}%~%B%F{blue}]'
-        local p_exitcode='%F{green}%?%(!.%F{cyan}>.%b%F{green}>)%b%f '
-        PROMPT="$p_machine$p_path$p_exitcode"
-    }
-  '';
-}