diff options
author | David Morgan <djm_uk@protonmail.com> | 2024-09-03 15:50:14 +0100 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2024-09-03 15:50:14 +0100 |
commit | e8eba7eb1233fafd4655c15a308b7f98be8c29a9 (patch) | |
tree | 2f08a65db529896045557c95a99fe1dda0f13168 /nix-conf/home/includes/zsh.nix | |
parent | 610452181bd551dd9f3a50610dac4996429bfb9d (diff) | |
download | dotfiles-e8eba7eb1233fafd4655c15a308b7f98be8c29a9.tar.gz |
Format zsh.nix with nixfmt
Diffstat (limited to 'nix-conf/home/includes/zsh.nix')
-rw-r--r-- | nix-conf/home/includes/zsh.nix | 214 |
1 files changed, 112 insertions, 102 deletions
diff --git a/nix-conf/home/includes/zsh.nix b/nix-conf/home/includes/zsh.nix index 381ee88..e6075a9 100644 --- a/nix-conf/home/includes/zsh.nix +++ b/nix-conf/home/includes/zsh.nix @@ -1,13 +1,7 @@ { config, pkgs, lib, ... }: -let - inherit (lib) - optionalAttrs - optionals; -in -{ - home.packages = with pkgs; [ - zsh-completions - ]; +let inherit (lib) optionalAttrs optionals; +in { + home.packages = with pkgs; [ zsh-completions ]; programs.fzf = { enable = true; @@ -23,9 +17,9 @@ in }; programs.keychain = { enable = lib.mkIf pkgs.stdenv.isLinux true; - agents = [ "ssh" "gpg"]; + agents = [ "ssh" "gpg" ]; keys = [ "id_rsa" "id_ed25519" "C171251002C200F2" ]; - # extraFlags = [ "--quiet" "--ignore-missing" ]; + # extraFlags = [ "--quiet" "--ignore-missing" ]; }; programs.command-not-found.enable = true; programs.zsh = { @@ -56,18 +50,26 @@ in tree = "eza --tree"; cat = "bat -p"; - pp = "pushbullet push \"Pixel\" link \"\${1}\" \"\${1}\""; + pp = ''pushbullet push "Pixel" link "''${1}" "''${1}"''; - upgrade_emacs = "cp ~/.emacs.d/straight/versions/default.el ~/straight-versions-default-`date \"+%Y-%m-%d-%H%M%S\"`.el && emacs --batch -l \"~/.emacs.d/init.el\" -f \"my/upgrade-packages\""; - diff_emacs = "difft --color always --context 0 $(ls -d1v ~/straight-versions-default-*.el | tail -1) ~/.emacs.d/straight/versions/default.el | grep '\\[9[12]' | egrep -v '(gnu-elpa-mirror|nongnu-elpa|melpa|emacsmirror-mirror)'"; + upgrade_emacs = '' + cp ~/.emacs.d/straight/versions/default.el ~/straight-versions-default-`date "+%Y-%m-%d-%H%M%S"`.el && emacs --batch -l "~/.emacs.d/init.el" -f "my/upgrade-packages"''; + diff_emacs = + "difft --color always --context 0 $(ls -d1v ~/straight-versions-default-*.el | tail -1) ~/.emacs.d/straight/versions/default.el | grep '\\[9[12]' | egrep -v '(gnu-elpa-mirror|nongnu-elpa|melpa|emacsmirror-mirror)'"; - nix-up = "git -C ~/dotfiles pull && doas nix-channel --update && doas nixos-rebuild switch && nix-channel --update && home-manager switch && system-changes-report && hm-changes-report && df -h && date"; - _nix-up = "doas nix-channel --update && doas nixos-rebuild switch && nix-channel --update && home-manager switch && system-changes-report && hm-changes-report && df -h && date"; - home-up = "git -C ~/dotfiles pull && nix-channel --update && home-manager switch && hm-changes-report"; - _home-up = "nix-channel --update && home-manager switch && hm-changes-report"; - nix-hammer = "nix shell -f https://github.com/jtojnar/nixpkgs-hammering/archive/master.tar.gz -c nixpkgs-hammer"; + nix-up = + "git -C ~/dotfiles pull && doas nix-channel --update && doas nixos-rebuild switch && nix-channel --update && home-manager switch && system-changes-report && hm-changes-report && df -h && date"; + _nix-up = + "doas nix-channel --update && doas nixos-rebuild switch && nix-channel --update && home-manager switch && system-changes-report && hm-changes-report && df -h && date"; + home-up = + "git -C ~/dotfiles pull && nix-channel --update && home-manager switch && hm-changes-report"; + _home-up = + "nix-channel --update && home-manager switch && hm-changes-report"; + nix-hammer = + "nix shell -f https://github.com/jtojnar/nixpkgs-hammering/archive/master.tar.gz -c nixpkgs-hammer"; - fb = "fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'"; + fb = + "fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'"; zz = "z $PWD"; @@ -75,7 +77,8 @@ in erg = "ea run grouped rg --"; fd = "ea run linear fd --"; - git-reset-branch = "git fetch && git reset --hard origin/\$(git branch --show-current)"; + git-reset-branch = + "git fetch && git reset --hard origin/$(git branch --show-current)"; # Git log aliases from the omz git plugin gl = "git pull"; @@ -85,15 +88,19 @@ in glgga = "git log --graph --decorate --all"; glgm = "git log --graph --max-count=10"; glo_ = "git log --oneline --decorate"; - glol = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\""; - glols = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\" --stat"; - glod = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\""; - glods = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\" --date=short"; - glola = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\" --all"; + glol = '' + git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset"''; + glols = '' + git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --stat''; + glod = '' + git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset"''; + glods = '' + git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset" --date=short''; + glola = '' + git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --all''; glog = "git log --oneline --decorate --graph"; gloga = "git log --oneline --decorate --graph --all"; - } - // optionalAttrs pkgs.stdenv.isDarwin { + } // optionalAttrs pkgs.stdenv.isDarwin { oemacs = "open -a /Applications/Emacs.app"; }; @@ -101,7 +108,7 @@ in PER_DIRECTORY_HISTORY_TOGGLE = "^\\\\"; # ^\\ is ^# HISTORY_START_WITH_GLOBAL = true; - ZSH_AUTOSUGGEST_STRATEGY = ["history" "completion"]; + ZSH_AUTOSUGGEST_STRATEGY = [ "history" "completion" ]; NVM_AUTO_USE = true; NVM_LAZY_LOAD = true; @@ -109,12 +116,16 @@ in LSP_USE_PLISTS = true; LESS = "-iRXF"; - FZF_DEFAULT_COMMAND=''rg --files --no-ignore --hidden --follow -g \"!{.git,node_modules}/*\" 2> /dev/null''; - FZF_CTRL_T_COMMAND="${config.programs.zsh.localVariables.FZF_DEFAULT_COMMAND}"; - FZF_ALT_C_COMMAND=''rg --hidden --files --sort-files --null -g \"!{.git,node_modules}/*\" | xargs -0 dirname | sort -u''; - FZF_ALT_C_OPTS="--preview 'eza --tree {} | head -200'"; - FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind 'ctrl-t:toggle-preview'"; - FZF_DEFAULT_OPTS="--bind=ctrl-t:toggle-all --bind=ctrl-j:jump"; + FZF_DEFAULT_COMMAND = '' + rg --files --no-ignore --hidden --follow -g \"!{.git,node_modules}/*\" 2> /dev/null''; + FZF_CTRL_T_COMMAND = + "${config.programs.zsh.localVariables.FZF_DEFAULT_COMMAND}"; + FZF_ALT_C_COMMAND = '' + rg --hidden --files --sort-files --null -g \"!{.git,node_modules}/*\" | xargs -0 dirname | sort -u''; + FZF_ALT_C_OPTS = "--preview 'eza --tree {} | head -200'"; + FZF_CTRL_R_OPTS = + "--preview 'echo {}' --preview-window down:3:hidden:wrap --bind 'ctrl-t:toggle-preview'"; + FZF_DEFAULT_OPTS = "--bind=ctrl-t:toggle-all --bind=ctrl-j:jump"; }; initExtraFirst = '' [[ $TERM == "tramp" ]] && unsetopt zle && PS1='$ ' && return @@ -143,17 +154,17 @@ in [[ -z "$terminfo[kend]" ]] || bindkey -M emacs "$terminfo[kend]" end-of-line # disable sort when completing `git checkout` - zstyle ''\':completion:*:git-checkout:*''\' sort false + zstyle ':completion:*:git-checkout:*' sort false # set descriptions format to enable group support - zstyle ''\':completion:*:descriptions''\' format ''\'[%d]''\' + zstyle ':completion:*:descriptions' format '[%d]' # Allow tab to expand aliases zstyle ':completion:*' completer _expand_alias _complete _ignored # set list-colors to enable filename colorizing - #zstyle ''\':completion:*''\' list-colors ''${(s.:.)LS_COLORS} - # preview directory''\'s content with eza when completing cd - zstyle ''\':fzf-tab:complete:cd:*''\' fzf-preview ''\'eza -1 --color=always ''$realpath''\' + #zstyle ':completion:*' list-colors ''${(s.:.)LS_COLORS} + # preview directory's content with eza when completing cd + zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath' # switch group using `,` and `.` - zstyle ''\':fzf-tab:*''\' switch-group ''\',''\' ''\'.''\' + zstyle ':fzf-tab:*' switch-group ',' '.' set -o noclobber @@ -273,65 +284,65 @@ in [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh ''; - plugins = with pkgs; [ - { - name = "zsh-autopair"; - src = zsh-autopair; - file = "share/zsh/zsh-autopair/autopair.zsh"; - } - { - name = "zsh-bd"; - src = zsh-bd; - file = "share/zsh-bd/bd.zsh"; - } - { - name = "zsh-fzf-tab"; - src = zsh-fzf-tab; - file = "share/fzf-tab/fzf-tab.zsh"; - } - { - name = "zsh-fast-syntax-highlighting"; - src = zsh-fast-syntax-highlighting; - file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh"; - } - { - name = "zsh-powerlevel10k"; - src = zsh-powerlevel10k; - file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; - } - { - name = "zsh-history-substring-search"; - src = zsh-history-substring-search; - file = "share/zsh-history-substring-search/zsh-history-substring-search.zsh"; - } - { - name = "zsh-forgit"; - src = zsh-forgit; - file = "share/zsh/zsh-forgit/forgit.plugin.zsh"; - } - { - name = "zsh-edit"; - src = zsh-edit; - file = "share/zsh/zsh-edit/zsh-edit.plugin.zsh"; - } - { - name = "fzf-git.sh"; - src = fzf-git-sh; - file = "share/fzf-git-sh/fzf-git.sh"; - } - { - name = "per-directory-history"; - src = fetchFromGitHub { - owner = "jimhester"; - repo = "per-directory-history"; - rev = "0687bbfd736da566472a6d67c2b45c501b73d405"; - sha256 = "7Z0qaDhgopKt9BDKSqdziw9jsVgiLLafs30wPPbz+oo="; - }; - file = "per-directory-history.zsh"; - } - ] - ++ optionals stdenv.isDarwin [ - { + plugins = with pkgs; + [ + { + name = "zsh-autopair"; + src = zsh-autopair; + file = "share/zsh/zsh-autopair/autopair.zsh"; + } + { + name = "zsh-bd"; + src = zsh-bd; + file = "share/zsh-bd/bd.zsh"; + } + { + name = "zsh-fzf-tab"; + src = zsh-fzf-tab; + file = "share/fzf-tab/fzf-tab.zsh"; + } + { + name = "zsh-fast-syntax-highlighting"; + src = zsh-fast-syntax-highlighting; + file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh"; + } + { + name = "zsh-powerlevel10k"; + src = zsh-powerlevel10k; + file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; + } + { + name = "zsh-history-substring-search"; + src = zsh-history-substring-search; + file = + "share/zsh-history-substring-search/zsh-history-substring-search.zsh"; + } + { + name = "zsh-forgit"; + src = zsh-forgit; + file = "share/zsh/zsh-forgit/forgit.plugin.zsh"; + } + { + name = "zsh-edit"; + src = zsh-edit; + file = "share/zsh/zsh-edit/zsh-edit.plugin.zsh"; + } + { + name = "fzf-git.sh"; + src = fzf-git-sh; + file = "share/fzf-git-sh/fzf-git.sh"; + } + { + name = "per-directory-history"; + src = fetchFromGitHub { + owner = "jimhester"; + repo = "per-directory-history"; + rev = "0687bbfd736da566472a6d67c2b45c501b73d405"; + sha256 = "7Z0qaDhgopKt9BDKSqdziw9jsVgiLLafs30wPPbz+oo="; + }; + file = "per-directory-history.zsh"; + } + ] ++ optionals stdenv.isDarwin [{ name = "zsh-nvm"; src = fetchFromGitHub { owner = "lukechilds"; @@ -340,8 +351,7 @@ in sha256 = "Zwdi7bezMFKaIKYwsSftu3mJSFvadEWmY2hYnU1Kpu4="; }; file = "zsh-nvm.plugin.zsh"; - } - ]; + }]; }; } |