From 7d3a2c3ca2f8a7c2d407ef55a417041665c3543e Mon Sep 17 00:00:00 2001 From: kat witch Date: Mon, 23 Aug 2021 04:09:04 +0100 Subject: [PATCH] zsh+vim+fzf+nixpkgs-fmt + katexprs update --- config/users/kat/base/vim/default.nix | 2 + config/users/kat/base/zsh.nix | 43 ++++------ config/users/kat/base/zshrc-vimode | 114 -------------------------- config/users/kat/dev/default.nix | 1 - config/users/kat/dev/emacs.nix | 21 +---- config/users/kat/dev/packages.nix | 2 +- nix/sources.json | 12 +-- 7 files changed, 30 insertions(+), 165 deletions(-) delete mode 100644 config/users/kat/base/zshrc-vimode diff --git a/config/users/kat/base/vim/default.nix b/config/users/kat/base/vim/default.nix index 85c362f4..06424a06 100644 --- a/config/users/kat/base/vim/default.nix +++ b/config/users/kat/base/vim/default.nix @@ -17,6 +17,8 @@ coc-yank coc-python coc-json + coc-fzf + fzf-vim coc-yaml coc-git coc-css diff --git a/config/users/kat/base/zsh.nix b/config/users/kat/base/zsh.nix index a39f1712..95bf4b1a 100644 --- a/config/users/kat/base/zsh.nix +++ b/config/users/kat/base/zsh.nix @@ -29,6 +29,7 @@ in home.packages = with pkgs; [ fzf fd zsh-completions akiflags ]; programs.zsh = { enable = true; + enableSyntaxHighlighting = true; enableAutosuggestions = true; initExtra = let @@ -85,35 +86,27 @@ in ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=3,bold"; ZSH_AUTOSUGGEST_USE_ASYNC = 1; }; - plugins = with pkgs.zsh-plugins; [ - (with pkgs.zsh-syntax-highlighting; { - name = "zsh-syntax-highlighting"; + plugins = with pkgs.zsh-plugins; (map (plugin: plugin.zshPlugin) [ + tab-title + vim-mode + evil-registers + ]) ++ (map + (plugin: (with pkgs.${plugin}; { + name = pname; + inherit src; + })) [ + "zsh-z" + ]) ++ [ + (with pkgs.zsh-fzf-tab; { + name = "fzf-tab"; inherit src; }) - tab-title.zshPlugin - vim-mode.zshPlugin - evil-registers.zshPlugin - { - name = "z"; - file = "z.sh"; - src = pkgs.fetchFromGitHub { - owner = "rupa"; - repo = "z"; - rev = "9d5a3fe0407101e2443499e4b95bca33f7a9a9ca"; - sha256 = "0aghw6zmd3851xpzgy0jkh25wzs9a255gxlbdr3zw81948qd9wb1"; - }; - } - { - name = "fzf-z"; - src = pkgs.fetchFromGitHub { - owner = "andrewferrier"; - repo = "fzf-z"; - rev = "089ba6cacd3876c349cfb6b65dc2c3e68b478fd0"; - sha256 = "1lvvkz0v4xibq6z3y8lgfkl9ibcx0spr4qzni0n925ar38s20q81"; - }; - } ]; }; + programs.fzf = { + enable = true; + enableZshIntegration = true; + }; programs.starship = { enable = true; enableZshIntegration = true; diff --git a/config/users/kat/base/zshrc-vimode b/config/users/kat/base/zshrc-vimode deleted file mode 100644 index 7814c214..00000000 --- a/config/users/kat/base/zshrc-vimode +++ /dev/null @@ -1,114 +0,0 @@ -zle-keymap-select() { - zle reset-prompt - zle -R -} - -TRAPWINCH() { - zle && { zle reset-prompt; zle -R } -} - -zle -N zle-keymap-select -zle -N edit-command-line - -bindkey -v - -autoload -Uz edit-command-line - -bindkey "^?" backward-delete-char -bindkey -M vicmd 'V' edit-command-line - -# tab completion menu -bindkey -M menuselect "k" up-line-or-history -bindkey -M menuselect "j" down-line-or-history -bindkey -M menuselect "l" forward-char -bindkey -M menuselect "h" backward-char -bindkey -M menuselect "^[" undo - -# silence bell when pressing escape too much -bindkey -M vicmd -s "\e" '' - -# make W/B/E/dW/dB/dE move over entire shell arguments, customize w/b/e with wordchars -autoload -U forward-word-match # TODO: acts weirdly when moving between words, like "a/b", 'w' command should move cursor to the "/", not the "b" -autoload -U backward-word-match -autoload -U match-words-by-style - -forward-blank-word-end-match() { - local curcontext=":zle:$WIDGET" start=$CURSOR offset=1 - local -A matched_words - - integer count=${NUMERIC:-1} - - if (( count < 0 )); then - (( NUMERIC = -count )) - zle ${WIDGET/forward/backward} - return - fi - - - if zstyle -t "$curcontext" virangeflag; then - offset=0 - fi - - while (( count-- )); do - # weird behaviour if not called from the beginning of a word, so go backwards first - match-words-by-style - if (( ${#matched_words[word-before-cursor]} > 0 && ${#matched_words[ws-before-cursor]} == 0 )); then - (( CURSOR -= ${#matched_words[word-before-cursor]} )) - fi - - match-words-by-style - if (( ${#matched_words[ws-after-cursor]} > 0 )); then - (( CURSOR += ${#matched_words[ws-after-cursor]} )) - fi - if (( ${#matched_words[word-after-cursor]} > 0 )); then - (( CURSOR += ${#matched_words[word-after-cursor]} - offset )) - fi - if (( CURSOR <= start )); then - if (( ${#matched_words[ws-after-word]} > 0 )); then - (( CURSOR += ${#matched_words[ws-after-word]} + 1 )) - fi - - match-words-by-style - if (( ${#matched_words[word-after-cursor]} > 0 )); then - (( CURSOR += ${#matched_words[word-after-cursor]} - offset )) - else - return 1 - fi - fi - done - - return 0 -} - -zle -N forward-end-word-parameter forward-blank-word-end-match -zle -N forward-end-word-normal forward-blank-word-end-match -zle -N forward-end-viopp-word-parameter forward-blank-word-end-match -zle -N forward-end-viopp-word-normal forward-blank-word-end-match - -zle -N forward-word-parameter forward-word-match -zle -N forward-word-normal forward-word-match - -zle -N backward-word-parameter backward-word-match -zle -N backward-word-normal backward-word-match - -zle -N forward-word-normal forward-word-match -zle -N backward-word-normal backward-word-match - -bindkey -M vicmd "W" forward-word-parameter -bindkey -M vicmd "B" backward-word-parameter -bindkey -M vicmd "E" forward-end-word-parameter - -bindkey -M vicmd "e" forward-end-word-normal -bindkey -M vicmd "w" forward-word-normal -bindkey -M vicmd "b" backward-word-normal - -bindkey -M viopp "e" forward-end-viopp-word-normal -bindkey -M viopp "E" forward-end-viopp-word-parameter - -zstyle ':zle:*-viopp-*' virangeflag 1 -zstyle ':zle:*-word-parameter' word-style shell - -zstyle ':zle:*-word-normal' word-style normal -zstyle ':zle:*-word-normal' word-chars "$WORDCHARS" -# zstyle ':zle:*' skip-whitespace-first false - diff --git a/config/users/kat/dev/default.nix b/config/users/kat/dev/default.nix index 36bea00b..20904c01 100644 --- a/config/users/kat/dev/default.nix +++ b/config/users/kat/dev/default.nix @@ -5,6 +5,5 @@ ./rustfmt.nix ./packages.nix ./cookiecutter.nix - #./emacs.nix ]; } diff --git a/config/users/kat/dev/emacs.nix b/config/users/kat/dev/emacs.nix index 7c434747..da02cf65 100644 --- a/config/users/kat/dev/emacs.nix +++ b/config/users/kat/dev/emacs.nix @@ -14,27 +14,12 @@ let }; }; }; -in { +in +{ home.packages = [ doom-emacs pkgs.sqlite ]; - home.file.".emacs.d/init.el".text = '' + home.file.".emacs.d/init.el".text = '' (load "default.el") (load-theme 'base16-${lib.elemAt (lib.splitString "." config.base16.alias.default) 1} t) ''; } - -/*{ -programs.doom-emacs = { -enable = true; -doomPrivateDir = ./doom.d; -extraConfig = '' -(load-theme 'base16-${lib.elemAt (lib.splitString "." config.base16.alias.default) 1} t) -''; -emacsPackage = pkgs.emacsPgtkGcc; -emacsPackagesOverlay = self: super: { -magit-delta = super.magit-delta.overrideAttrs (esuper: { -buildInputs = esuper.buildInputs ++ [ pkgs.git ]; -}); -}; -}; -}*/ diff --git a/config/users/kat/dev/packages.nix b/config/users/kat/dev/packages.nix index 014ce167..cda4d451 100644 --- a/config/users/kat/dev/packages.nix +++ b/config/users/kat/dev/packages.nix @@ -1,5 +1,5 @@ { config, pkgs, ... }: { - home.packages = with pkgs; [ hyperfine hexyl tokei ]; + home.packages = with pkgs; [ hyperfine hexyl tokei nixpkgs-fmt ]; } diff --git a/nix/sources.json b/nix/sources.json index 720d103b..d95e5cc1 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -5,10 +5,10 @@ "homepage": null, "owner": "arcnmx", "repo": "nixexprs", - "rev": "484f3b3270fec0bd6b67154400bdd5213f7c681c", - "sha256": "1r16kpy6rzl5ixly3g07lxrs92wskbrl1viys0bj25xmmfq5p6yi", + "rev": "281df8466c07ffb0cb6e4e8582f0b84ccd501ec6", + "sha256": "0pnwas0zx1rar0gxjvk5f7d3skws74maib01mzlygzhgfi6njgpv", "type": "tarball", - "url": "https://github.com/arcnmx/nixexprs/archive/484f3b3270fec0bd6b67154400bdd5213f7c681c.tar.gz", + "url": "https://github.com/arcnmx/nixexprs/archive/281df8466c07ffb0cb6e4e8582f0b84ccd501ec6.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "ci": { @@ -65,10 +65,10 @@ "homepage": null, "owner": "kittywitch", "repo": "nixexprs", - "rev": "5e736e81c17cc84a0a2da599940377e197b56c79", - "sha256": "0hgkxblhra9hv4wm9060dlwlbj2bf34v8inv8fk3kcmcl4w2305h", + "rev": "e5a141c691a46d3867682ebe31e7feebcd8a8926", + "sha256": "1zw2fjad46q9pb5lg74nncijhbxjxrgyhxi8p7rp29bmm1ig5z1q", "type": "tarball", - "url": "https://github.com/kittywitch/nixexprs/archive/5e736e81c17cc84a0a2da599940377e197b56c79.tar.gz", + "url": "https://github.com/kittywitch/nixexprs/archive/e5a141c691a46d3867682ebe31e7feebcd8a8926.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "niv": {