Skip to content

Commit 0c5e0c6

Browse files
authored
Merge pull request #222 from ocf/skip_ocf_zshrc
zsh: emacs keybinds and $SKIP_OCF_ZSHRC - add $SKIP_OCF_ZSHRC to skip our zshrc. this does not skip things enabled with nixos modules. those can be disabled with `zsh --no-rc` but we should figure out how we can let people do that in a config file (not a regression) - enable emacs keybinds by default
2 parents 3438b31 + ab0f6ee commit 0c5e0c6

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

modules/shell/default.nix

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ in
1111
config = lib.mkIf cfg.enable {
1212
environment = {
1313
enableAllTerminfo = true;
14-
etc."p10k.zsh".source = ./p10k.zsh;
1514

1615
systemPackages = with pkgs; [
1716
bash
@@ -29,9 +28,26 @@ in
2928
zsh-newuser-install() { :; }
3029
'';
3130
interactiveShellInit = ''
31+
# add default ocf config only if not disabled by user in ~/.zshenv by
32+
# setting $SKIP_OCF_ZSHRC
33+
if [[ -n "$SKIP_OCF_ZSHRC" ]]; then
34+
return
35+
fi
36+
37+
# emacs keybinds: ^u, ^k, ^a, ^e, etc
38+
# this is a good nonintrusive default that adds useful keybinds while
39+
# not interfering with people's muscle memory
40+
bindkey -e
41+
3242
source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme
33-
source /etc/p10k.zsh
43+
44+
# p10k.zsh start
45+
${builtins.readFile ./p10k.zsh}
46+
# p10k.zsh end
47+
48+
# command_not_found_handler.zsh start
3449
${builtins.readFile ./command_not_found_handler.zsh}
50+
# command_not_found_handler.zsh end
3551
'';
3652
};
3753

0 commit comments

Comments
 (0)