From 3ab29c094aa79ad65b14ed0de0e4d51277db8df6 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Tue, 8 Aug 2023 02:03:45 +0900 Subject: [PATCH] Enable dprint completions in each main shells eval style makes 8~10ms slower --- home-manager/bash.nix | 2 ++ home-manager/fish.nix | 4 +++- home-manager/zsh.nix | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/home-manager/bash.nix b/home-manager/bash.nix index a3b7c062..745b3fc9 100644 --- a/home-manager/bash.nix +++ b/home-manager/bash.nix @@ -72,6 +72,8 @@ } # shellcheck disable=SC2034 starship_precmd_user_func="set_win_title" + + eval "$(${lib.getBin pkgs.dprint}/bin/dprint completions bash)" '' + builtins.readFile ./initExtra.bash; logoutExtra = '' diff --git a/home-manager/fish.nix b/home-manager/fish.nix index 23358037..ed9cbf49 100644 --- a/home-manager/fish.nix +++ b/home-manager/fish.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: { programs.starship.enableFishIntegration = true; @@ -41,6 +41,8 @@ # I define another la as a homemade scripts # See https://stackoverflow.com/a/36700734/1212807 for using `--erase` functions --erase la + + ${lib.getBin pkgs.dprint}/bin/dprint completions fish | source ''; plugins = [{ diff --git a/home-manager/zsh.nix b/home-manager/zsh.nix index 87d9aa98..9cb9edde 100644 --- a/home-manager/zsh.nix +++ b/home-manager/zsh.nix @@ -118,6 +118,8 @@ } precmd_functions+=(set_win_title) + eval "$(${lib.getBin pkgs.dprint}/bin/dprint completions zsh)" + zshaddhistory() { whence ''${''${(z)1}[1]} >| /dev/null || return 1 } '';