aboutsummaryrefslogtreecommitdiff
path: root/macos.local/.flake/home/programs/zsh
diff options
context:
space:
mode:
authorjjanzen <jjanzen@jjanzen.ca>2025-01-08 17:24:21 -0600
committerjjanzen <jjanzen@jjanzen.ca>2025-01-08 17:24:21 -0600
commita75b69b88f967e6271d75a1bc122da0b2e4eeece (patch)
tree20b7fb1bec30f68e61846c45a481bee174f4af9f /macos.local/.flake/home/programs/zsh
parenta1cbc273fb92c69ea1b8534f6ef6064b5da40e31 (diff)
system changes
Diffstat (limited to 'macos.local/.flake/home/programs/zsh')
-rw-r--r--macos.local/.flake/home/programs/zsh/core.nix.org36
-rw-r--r--macos.local/.flake/home/programs/zsh/init-extra.sh.org28
-rw-r--r--macos.local/.flake/home/programs/zsh/profile-extra.sh.org10
3 files changed, 74 insertions, 0 deletions
diff --git a/macos.local/.flake/home/programs/zsh/core.nix.org b/macos.local/.flake/home/programs/zsh/core.nix.org
new file mode 100644
index 0000000..84e9aff
--- /dev/null
+++ b/macos.local/.flake/home/programs/zsh/core.nix.org
@@ -0,0 +1,36 @@
+#+title: ZSH Configuration
+
+Open =zsh= configuration.
+#+begin_src nix
+ { config, pkgs, ... }:
+
+ {
+ programs.zsh = {
+ enable = true;
+
+ autocd = true;
+
+ autosuggestion.enable = true;
+
+ defaultKeymap = "emacs";
+
+ history = {
+ append = true;
+ ignoreAllDups = true;
+ };
+
+ shellAliases = {
+ "ll" = "ls -alF";
+ "la" = "ls -a";
+ "l" = "ls -F";
+ "sl" = "ls";
+ };
+
+ syntaxHighlighting.enable = true;
+
+ initExtra = builtins.readFile ./init-extra.sh;
+
+ profileExtra = builtins.readFile ./profile-extra.sh;
+ };
+ }
+#+end_src
diff --git a/macos.local/.flake/home/programs/zsh/init-extra.sh.org b/macos.local/.flake/home/programs/zsh/init-extra.sh.org
new file mode 100644
index 0000000..8255ce1
--- /dev/null
+++ b/macos.local/.flake/home/programs/zsh/init-extra.sh.org
@@ -0,0 +1,28 @@
+#+title: ZSH Extra Initialization Code
+
+Define optional aliases.
+#+begin_src sh
+ which lesspipe.sh &> /dev/null && export LESSOPEN="|lesspipe.sh %s"
+ which eza &> /dev/null && alias ls=eza
+#+end_src
+
+Enable =fzf= extensions for =zsh=.
+#+begin_src sh
+ which zsh &> /dev/null && source <(fzf --zsh)
+#+end_src
+
+Enable git status in =zsh= prompt.
+#+begin_src sh
+ parse_git_dirty() {
+ git_status="$(git status 2> /dev/null)"
+ [[ "$git_status" =~ "use \"git push\" to publish your local commits" ]] && echo -n " %F{green}%f"
+ [[ "$git_status" =~ "Changes to be committed:" ]] && echo -n " %F{magenta}%f"
+ [[ "$git_status" =~ "Changes not staged for commit:" ]] && echo -n " %F{yellow}%f"
+ [[ "$git_status" =~ "Untracked files:" ]] && echo -n " %F{red}%f"
+ }
+ setopt prompt_subst
+ autoload -Uz vcs_info
+ precmd () { vcs_info }
+ zstyle ':vcs_info:*' formats ' %F{blue}%b%f' # git(main)
+ PS1='%(?..%B%F{red}[%?%\]%f%b )%F{green}%20<...<%~%<<%f$vcs_info_msg_0_$(parse_git_dirty) $ '
+#+end_src
diff --git a/macos.local/.flake/home/programs/zsh/profile-extra.sh.org b/macos.local/.flake/home/programs/zsh/profile-extra.sh.org
new file mode 100644
index 0000000..64457ed
--- /dev/null
+++ b/macos.local/.flake/home/programs/zsh/profile-extra.sh.org
@@ -0,0 +1,10 @@
+#+title: Profile Extra Code
+
+Enable =ssh-agent= at login.
+#+begin_src sh
+ if [ ! -S ~/.ssh/ssh_auth_sock ]; then
+ eval `ssh-agent` > /dev/null
+ ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock
+ fi
+ export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
+#+end_src