diff options
author | Jacob Janzen <jacob.a.s.janzen@gmail.com> | 2024-09-28 00:01:09 -0500 |
---|---|---|
committer | Jacob Janzen <jacob.a.s.janzen@gmail.com> | 2024-09-28 00:01:09 -0500 |
commit | b7e84fa6048007cda7e6c8226e28bc2db90f792a (patch) | |
tree | 170bcaff17d7aec0c6aac5807c7a5857dbd71def /nixos/.flake/home/programs/zsh.nix.org | |
parent | 7b2986845fde19db57703dad1105359913486abd (diff) |
add file extensions to files
Diffstat (limited to 'nixos/.flake/home/programs/zsh.nix.org')
-rw-r--r-- | nixos/.flake/home/programs/zsh.nix.org | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/nixos/.flake/home/programs/zsh.nix.org b/nixos/.flake/home/programs/zsh.nix.org new file mode 100644 index 0000000..79795d0 --- /dev/null +++ b/nixos/.flake/home/programs/zsh.nix.org @@ -0,0 +1,87 @@ +#+title: ZSH Configuration + +Open =zsh= configuration. +#+begin_src nix :tangle ~/.flake/home/programs/zsh.nix :mkdirp yes + { config, pkgs, ... }: + + { + programs.zsh = { + enable = true; +#+end_src + +Automatically =cd= if only the path is used. +#+begin_src nix :tangle ~/.flake/home/programs/zsh.nix :mkdirp yes + autocd = true; +#+end_src + +Enable auto-suggestions. +#+begin_src nix :tangle ~/.flake/home/programs/zsh.nix :mkdirp yes + autosuggestion = { + enable = true; + }; +#+end_src + +Use =vi= keybindings. +#+begin_src nix :tangle ~/.flake/home/programs/zsh.nix :mkdirp yes + defaultKeymap = "viins"; +#+end_src + +Append to the history and ignore duplicates. +#+begin_src nix :tangle ~/.flake/home/programs/zsh.nix :mkdirp yes + history = { + append = true; + ignoreAllDups = true; + }; +#+end_src + +Specify =ls= aliases. +#+begin_src nix :tangle ~/.flake/home/programs/zsh.nix :mkdirp yes + shellAliases = { + "ll" = "ls -alF"; + "la" = "ls -a"; + "l" = "ls -F"; + "sl" = "ls"; + }; +#+end_src + +Enable syntax highlighting. +#+begin_src nix :tangle ~/.flake/home/programs/zsh.nix :mkdirp yes + syntaxHighlighting.enable = true; +#+end_src + +Create potential aliases and create the prompt. +#+begin_src nix :tangle ~/.flake/home/programs/zsh.nix :mkdirp yes + initExtra = '' + which lesspipe.sh &> /dev/null && export LESSOPEN="|lesspipe.sh %s" + which eza &> /dev/null && alias ls=eza + 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 + +Launch =ssh-agent= at login. +#+begin_src nix :tangle ~/.flake/home/programs/zsh.nix :mkdirp yes + profileExtra = '' + 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 + +Close =zsh= configuration. +#+begin_src nix :tangle ~/.flake/home/programs/zsh.nix :mkdirp yes + }; + } +#+end_src |