Skip to content

Commit

Permalink
Modularize zsh and nb properly
Browse files Browse the repository at this point in the history
  • Loading branch information
rake5k committed Sep 21, 2023
1 parent 15f290c commit e878567
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 56 deletions.
3 changes: 2 additions & 1 deletion home/users/christian/shell/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ in
programs.tmux.enable = true;
users.christian.shell = {
direnv.enable = true;
nb.enable = true;
ranger.enable = true;
zsh.enable = true;
};
};

Expand Down Expand Up @@ -51,7 +53,6 @@ in
gron
htop
killall
nb
neofetch
pandoc
texlive.combined.scheme-small
Expand Down
31 changes: 31 additions & 0 deletions home/users/christian/shell/nb/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{ config, lib, pkgs, ... }:

with lib;

let

cfg = config.custom.users.christian.shell.nb;

in

{
options = {
custom.users.christian.shell.nb = {
enable = mkEnableOption "nb";
};
};

config = mkIf cfg.enable {
home.packages = with pkgs; [
nb

# Optional dependencies:
bat
nmap
pandoc
ripgrep
tig
w3m
];
};
}
124 changes: 69 additions & 55 deletions home/users/christian/shell/zsh/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,81 @@

with lib;

let

cfg = config.custom.users.christian.shell.zsh;

in

{
home = {
file = {
"${config.programs.zsh.dotDir}/completions".source = ./completions;
options = {
custom.users.christian.shell.zsh = {
enable = mkEnableOption "Z shell";
};
};

programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
enableSyntaxHighlighting = true;
autocd = true;
dotDir = ".config/zsh";
dirHashes = {
bb = "/mnt/bluecare/bluecare";
bh = "/mnt/bluecare/home";
bt = "/mnt/bluecare/transfer";
d = "$HOME/Documents";
dl = "$HOME/Downloads";
hh = "/mnt/home/home";
hm = "/mnt/home/music";
hp = "/mnt/home/photo";
ht = "/mnt/home/public";
hv = "/mnt/home/video";
p = "$HOME/Pictures";
usb = "/run/media/chr";
v = "$HOME/Videos";
config = mkIf cfg.enable {
home = {
file = {
"${config.programs.zsh.dotDir}/completions".source = ./completions;
};
};
history =
let
historySize = 1000000;
in
{
expireDuplicatesFirst = true;
extended = true;
ignoreDups = true;
ignoreSpace = true;
path = "$ZDOTDIR/.zsh_history";
save = historySize;
share = true;
size = historySize;

programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
enableSyntaxHighlighting = true;
autocd = true;
dotDir = ".config/zsh";
dirHashes = {
bb = "/mnt/bluecare/bluecare";
bh = "/mnt/bluecare/home";
bt = "/mnt/bluecare/transfer";
d = "$HOME/Documents";
dl = "$HOME/Downloads";
hh = "/mnt/home/home";
hm = "/mnt/home/music";
hp = "/mnt/home/photo";
ht = "/mnt/home/public";
hv = "/mnt/home/video";
p = "$HOME/Pictures";
usb = "/run/media/chr";
v = "$HOME/Videos";
};
history =
let
historySize = 1000000;
in
{
expireDuplicatesFirst = true;
extended = true;
ignoreDups = true;
ignoreSpace = true;
path = "$ZDOTDIR/.zsh_history";
save = historySize;
share = true;
size = historySize;
};
initExtra = ''
# Fix for https://superuser.com/questions/997593/why-does-zsh-insert-a-when-i-press-the-delete-key
bindkey "^[[3~" delete-char
# Fix for https://stackoverflow.com/questions/43249043/bind-delete-key-in-vi-mode
bindkey -a '^[[3~' vi-delete-char
'';
initExtraBeforeCompInit = ''
fpath=(~/.zsh/completion $fpath)
'';
shellGlobalAliases = {
"..." = "../..";
"...." = "../../..";
"....." = "../../../..";
"......" = "../../../../..";
"......." = "../../../../../..";
"........" = "../../../../../../..";
G = "| grep";
UUID = "$(uuidgen | tr -d \\n)";
};
initExtra = ''
# Fix for https://superuser.com/questions/997593/why-does-zsh-insert-a-when-i-press-the-delete-key
bindkey "^[[3~" delete-char
# Fix for https://stackoverflow.com/questions/43249043/bind-delete-key-in-vi-mode
bindkey -a '^[[3~' vi-delete-char
'';
initExtraBeforeCompInit = ''
fpath=(~/.zsh/completion $fpath)
'';
shellGlobalAliases = {
"..." = "../..";
"...." = "../../..";
"....." = "../../../..";
"......" = "../../../../..";
"......." = "../../../../../..";
"........" = "../../../../../../..";
G = "| grep";
UUID = "$(uuidgen | tr -d \\n)";
};
};
}

0 comments on commit e878567

Please sign in to comment.