From 030d1651123b270380a6e7eb92ad17a57f9cacb0 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 9 Oct 2019 21:20:40 +0200 Subject: Replace zplugin with home-manager zsh.plugins --- user/settings/zsh.nix | 120 ++++++++++++++++++++++++++++++++++++++++---- user/zsh/.config/zsh/.zshrc | 39 -------------- 2 files changed, 110 insertions(+), 49 deletions(-) diff --git a/user/settings/zsh.nix b/user/settings/zsh.nix index df0b28ad..03e2f96c 100644 --- a/user/settings/zsh.nix +++ b/user/settings/zsh.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: let inherit (pkgs) stdenv; @@ -12,6 +12,7 @@ in home.packages = with pkgs; [ fzf ghq + zsh-completions ] ++ (if stdenv.isDarwin then [] else [ @@ -22,15 +23,6 @@ in source = ../zsh/.config/zsh; }; - home.file.".zplugin/bin" = { - source = pkgs.fetchFromGitHub { - owner = "zdharma"; - repo = "zplugin"; - rev = "028b1e1d6d3eae204b499c7f815f4eeeb5051517"; - sha256 = "1ynh323905iia3gwi9qghbywp94x306nna1yqk37frj5g7kg90fa"; - }; - }; - programs.zsh = { enable = true; @@ -52,6 +44,110 @@ in ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=8"; }; + plugins = [ + { + name = "kubectl-aliases"; + src = pkgs.fetchFromGitHub { + owner = "alanpearce"; + repo = "kubectl-aliases"; + rev = "f43cd444c77fd547d038453272f3c294ce722e9f"; + # date = 2019-06-25T15:47:42+02:00; + sha256 = "0rw3f81fygar8rb6w1s5sgr0x3qgjmvdgv858j5csqqk3d724qq4"; + }; + } + { + name = "cd-gitroot"; + src = pkgs.fetchFromGitHub { + owner = "mollifier"; + repo = "cd-gitroot"; + rev = "a1d59511eba2b99935635b2efef00f8d2363aecd"; + # date = 2016-03-23T18:29:15+09:00; + sha256 = "1l0fb24vcgd7vgya1r47h2bfczkxrb3mxn791l305f5d350wvqfz"; + }; + } + { + name = "careful_rm"; + src = pkgs.fetchFromGitHub { + owner = "MikeDacre"; + repo = "careful_rm"; + rev = "f62506b2b6a9ec312dfd7fc8148eb3920a1e790f"; + # date = 2019-04-14T10:35:56-07:00; + sha256 = "1pjlrdwv2509cgcdsfxff8cycfhj6z0y4jbjr98209bwi3ds7665"; + }; + } + { + name = "calc"; + src = pkgs.fetchFromGitHub { + owner = "arzzen"; + repo = "calc.plugin.zsh"; + rev = "3e0b67fa0fecb8f06d5cf3f80075b53c832c1813"; + # date = 2019-09-17T09:15:39+02:00; + sha256 = "1i0c5szvfc1f3rnf8dp57v7c15a4lf6lkn1l0qdbbq06wkcg2zpq"; + }; + } + { + name = "better-npm-completion"; + src = pkgs.fetchFromGitHub { + owner = "lukechilds"; + repo = "zsh-better-npm-completion"; + rev = "b61f6bb4e640728c42ae84ca55a575ee88c60fe8"; + # date = 2017-07-02T09:59:33+01:00; + sha256 = "00c1gdsam0z6v09fvz7hyl0zgmgnwbf59i1yrbkrz08frjlr16ax"; + }; + } + { + name = "zsh-nix-shell"; + src = pkgs.fetchFromGitHub { + owner = "chisui"; + repo = "zsh-nix-shell"; + rev = "b2609ca787803f523a18bb9f53277d0121e30389"; + # date = 2019-04-22T22:00:26+02:00; + sha256 = "01w59zzdj12p4ag9yla9ycxx58pg3rah2hnnf3sw4yk95w3hlzi6"; + }; + } + { + name = "you-should-use"; + src = pkgs.fetchFromGitHub { + owner = "MichaelAquilina"; + repo = "zsh-you-should-use"; + rev = "06de2be797cc1c987d196c93d91ce165fa9bf5f1"; + # date = 2019-08-24T17:12:44+01:00; + sha256 = "1qrm7f4my1z7d3h3zgizw1wajk20mkriq0zhxqh36p8q24py319g"; + }; + } + { + name = "agkozak-zsh-prompt"; + src = pkgs.fetchFromGitHub { + owner = "agkozak"; + repo = "agkozak-zsh-prompt"; + rev = "bb4ae9eb1f30443933320d30a59a86eed7638da5"; + # date = 2019-07-23T18:45:52-07:00; + sha256 = "1dshpgm2sfilzinmjink6mh56pjfv1379qkqmsksrqd7fgx1n4hb"; + }; + } + { + name = "anyframe"; + src = pkgs.fetchFromGitHub { + owner = "mollifier"; + repo = "anyframe"; + rev = "598675303044df8e9d04722f3adff4f63a238922"; + # date = 2017-07-19T21:59:49+09:00; + sha256 = "08bjm1dd2mpv8rk8x6yvm6gj490rgimmiq7ln4jr5hik2k3mm82r"; + }; + } + ] ++ lib.optionals stdenv.isDarwin [ + { + name = "tumult"; + src = pkgs.fetchFromGitHub { + owner = "unixorn"; + repo = "tumult.plugin.zsh"; + rev = "e74db60be21dfebaa89b84fb9a45939814573c8c"; + # date = 2019-03-07T08:53:24-07:00; + sha256 = "1328g3h51478ai25niv9qgf8bjgg3cw98zdqfznrbgw0k3qj66zk"; + }; + } + ]; + shellAliases = { l = "ls ${lsOptions} -Bp"; l1="ls -1"; @@ -62,6 +158,8 @@ in lla="lal"; llr="ll -t"; + cdg = "cd-gitroot"; + https = "http --default-scheme https"; kns = "kubens"; kx = "kubectx"; @@ -196,6 +294,8 @@ in fc -l -m "$1*" -10000 | cut -d' ' -f4- | sort | uniq -c | sort -g | tail -n100 | less } + source ${pkgs.fzf}/share/fzf/key-bindings.zsh + '' + builtins.readFile ../zsh/.config/zsh/.zshrc; }; } diff --git a/user/zsh/.config/zsh/.zshrc b/user/zsh/.config/zsh/.zshrc index 959365cd..d7f29c1e 100644 --- a/user/zsh/.config/zsh/.zshrc +++ b/user/zsh/.config/zsh/.zshrc @@ -1,6 +1,4 @@ # -*- mode: sh; -*- -source $HOME/.zplugin/bin/zplugin.zsh - setopt inc_append_history_time setopt transient_rprompt @@ -70,39 +68,6 @@ zstyle ':completion:*' completer _expand _complete _match # Plugins -zplugin ice blockf wait'!' lucid -zplugin load "zsh-users/zsh-completions" -zplugin ice wait'[[ -n ${ZLAST_COMMANDS[(r)k*]} || "$PWD" =~ "kubernetes" ]]' lucid -zplugin load alanpearce/kubectl-aliases -zplugin ice wait'1' lucid atinit'alias cdg=cd-gitroot' -zplugin load "mollifier/cd-gitroot" -zplugin ice wait'[[ -n ${ZLAST_COMMANDS[(r)rm*]} ]]' lucid -zplugin load "MikeDacre/careful_rm" - -zplugin ice wait'1' lucid -zplugin load "arzzen/calc.plugin.zsh" - -# provides the title function and macOS title-folder sync -zplugin ice if'[[ $os -eq darwin ]]' -zplugin snippet "OMZ::lib/functions.zsh" -zplugin ice if'[[ $os -eq darwin ]]' -zplugin snippet "OMZ::lib/termsupport.zsh" - -zplugin ice if'[[ $os -eq darwin ]]' wait'5' lucid -zplugin load "unixorn/tumult.plugin.zsh" - -zplugin ice wait'[[ -n ${ZLAST_COMMANDS[(r)npm*]} ]]' lucid -zplugin load "lukechilds/zsh-better-npm-completion" - -zplugin ice if'[[ (-n $commands[nix-env] && -z $commands[nixos-rebuild]) ]]' wait'[[ -n ${ZLAST_COMMANDS[(r)nix-shell*]} ]]' lucid -zplugin load "chisui/zsh-nix-shell" - -zplugin ice if'[[ -n $commands[ghq] ]]' -zplugin load "${GOPATH:=$HOME/go}/src/github.com/motemen/ghq/zsh" - -zplugin ice wait'!2' lucid -zplugin load "MichaelAquilina/zsh-you-should-use" - if [[ -n $commands[gcloud] ]] then autoload bashcompinit @@ -168,13 +133,9 @@ else precmd_functions+=(check_kubectl_context) AGKOZAK_CUSTOM_RPROMPT='${prompt_context}%(3V.%F{${AGKOZAK_COLORS_BRANCH_STATUS}%3v%f.)' fi -zplugin load agkozak/agkozak-zsh-prompt -zplugin ice wait'!' lucid -zplugin light "mollifier/anyframe" if [[ -n $commands[fzf] ]] then - zplugin snippet "https://github.com/junegunn/fzf/raw/master/shell/key-bindings.zsh" export FZF_CTRL_T_COMMAND=' (git ls-tree -r --name-only HEAD || fd --hidden --follow --exclude ".git" . | -- cgit 1.4.1