-
Notifications
You must be signed in to change notification settings - Fork 1
/
programs.nix
105 lines (97 loc) · 2.92 KB
/
programs.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
{ lib, pkgs, ... }:
let shell = import ./shell.nix { inherit lib; };
in {
programs = {
# let home-manager install and manage itself
home-manager.enable = true;
# command-line interpreter
bash = {
enable = true;
enableCompletion = true;
enableVteIntegration = true;
initExtra = ''
eval "$(starship init bash)"
export PATH=$HOME/bin:$PATH
'';
sessionVariables = shell.home.sessionVariables;
};
# replacement for bash
zsh = {
enable = true;
autocd = false;
autosuggestion.enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
enableVteIntegration = true;
defaultKeymap = "emacs";
oh-my-zsh.enable = true;
plugins = [{
name = "fzf-tab";
src = pkgs.fetchFromGitHub {
owner = "Aloxaf";
repo = "fzf-tab";
rev = "5a81e13792a1eed4a03d2083771ee6e5b616b9ab";
sha256 = "sha256-dPe5CLCAuuuLGRdRCt/nNruxMrP9f/oddRxERkgm1FE=";
};
}];
shellGlobalAliases = {
"..." = "../..";
"...." = "../../..";
"....." = "../../../..";
DN = "2>/dev/null";
};
initExtra = ''
# fuzzy tab completion: https://superuser.com/a/815317
zstyle ':completion:*' matcher-list "" \
'm:{a-z\-}={A-Z\_}' \
'r:[^[:alpha:]]||[[:alpha:]]=** r:|=* m:{a-z\-}={A-Z\_}' \
'r:|?=** m:{a-z\-}={A-Z\_}'
eval "$(starship init zsh)"
export PATH=$HOME/bin:$PATH
# This speeds up pasting w/ autosuggest
# https://github.com/zsh-users/zsh-autosuggestions/issues/238
pasteinit() {
OLD_SELF_INSERT=''${''${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
}
pastefinish() {
zle -N self-insert $OLD_SELF_INSERT
}
zstyle :bracketed-paste-magic paste-init pasteinit
zstyle :bracketed-paste-magic paste-finish pastefinish
'';
sessionVariables = shell.home.sessionVariables;
};
# version control!
git = {
enable = true;
userName = "Michael A. Perlin";
userEmail = "mika.perlin@gmail.com";
extraConfig = {
core.editor = "hx";
init.defaultBranch = "main";
fetch.prune = "true";
pull.ff = "only";
push.autoSetupRemote = "true";
core.pager = "less -XF";
core.askpass = "";
credential = { helper = "store"; };
};
aliases = {
st = "status";
br = "branch";
co = "checkout";
};
};
# replacement for 'ls'
eza.enable = true;
eza.enableBashIntegration = true;
eza.enableZshIntegration = true;
# replacement for 'cd'
zoxide.enable = true;
zoxide.enableZshIntegration = true;
# better shell history
atuin.enable = true;
atuin.flags = [ "--disable-up-arrow" ];
};
}