From 09513b5c4e4babfaefdd06c592ef34c0908dc572 Mon Sep 17 00:00:00 2001 From: sadbeast Date: Thu, 30 May 2024 00:47:47 +0000 Subject: oh god what have i done --- home/sadbeast/features/zsh.nix | 67 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 home/sadbeast/features/zsh.nix (limited to 'home/sadbeast/features/zsh.nix') diff --git a/home/sadbeast/features/zsh.nix b/home/sadbeast/features/zsh.nix new file mode 100644 index 0000000..db568e6 --- /dev/null +++ b/home/sadbeast/features/zsh.nix @@ -0,0 +1,67 @@ +{ + pkgs, + config, + ... +}: { + programs.zsh = { + enable = true; + autocd = true; + enableCompletion = true; + enableVteIntegration = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + + loginExtra = '' + if [ "$(tty)" = "/dev/tty1" ]; then + exec sway + fi + ''; + + initExtra = '' + precmd() { + print -Pn "\e]133;A\e\\" + } + + function osc7-pwd() { + emulate -L zsh # also sets localoptions for us + setopt extendedglob + local LC_ALL=C + printf '\e]7;file://%s%s\e\' $HOST ''${PWD//(#m)([^@-Za-z&-;_~])/%''${(l:2::0:)$(([##16]#MATCH))}} + } + + function chpwd-osc7-pwd() { + (( ZSH_SUBSHELL )) || osc7-pwd + } + add-zsh-hook -Uz chpwd chpwd-osc7-pwd + ''; + + defaultKeymap = "emacs"; + + history = { + size = 10000; + path = "${config.xdg.dataHome}/zsh/zsh_history"; + }; + + shellAliases = { + ll = "ls -l"; + }; + + sessionVariables = { + EDITOR = "vim"; + }; + + # TODO: this causes a 2 second delay + # plugins = [ + # { + # name = "zsh-nix-shell"; + # file = "nix-shell.plugin.zsh"; + # src = pkgs.fetchFromGitHub { + # owner = "chisui"; + # repo = "zsh-nix-shell"; + # rev = "v0.8.0"; + # sha256 = "1lzrn0n4fxfcgg65v0qhnj7wnybybqzs4adz7xsrkgmcsr0ii8b7"; + # }; + # } + # ]; + }; +} -- cgit v1.2.3