aboutsummaryrefslogtreecommitdiffstats
path: root/home/sadbeast/features/zsh.nix
diff options
context:
space:
mode:
authorsadbeast <sadbeast@sadbeast.com>2024-05-30 00:47:47 +0000
committersadbeast <sadbeast@sadbeast.com>2024-10-05 16:44:14 -0700
commit09513b5c4e4babfaefdd06c592ef34c0908dc572 (patch)
tree5a9af6ef0407346c223334e295adc8012654f112 /home/sadbeast/features/zsh.nix
downloadnix-config-09513b5c4e4babfaefdd06c592ef34c0908dc572.tar.gz
nix-config-09513b5c4e4babfaefdd06c592ef34c0908dc572.tar.bz2
oh god what have i doneHEADmain
Diffstat (limited to 'home/sadbeast/features/zsh.nix')
-rw-r--r--home/sadbeast/features/zsh.nix67
1 files changed, 67 insertions, 0 deletions
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";
+ # };
+ # }
+ # ];
+ };
+}