From b1a236e34d68a3f76c20d9035679a3ec8bfa325d Mon Sep 17 00:00:00 2001 From: Wu Zhenyu Date: Sun, 23 Jul 2023 08:44:41 +0800 Subject: [PATCH] :bug: Fix NixOS path Add pacman-key, udisksctl, acpi, ethtool, rmmod, modinfo, alacritty --- .pre-commit-config.yaml | 12 ++++++------ sources/acpi.zsh | 15 +++++++++++++++ sources/alacritty-msg.zsh | 6 ++++++ sources/alacritty.zsh | 6 ++++++ sources/ethtool.zsh | 6 ++++++ sources/gtk-launch.zsh | 2 +- sources/modinfo.zsh | 9 +++++++++ sources/pacman-key.zsh | 5 +++++ sources/pkg-config.zsh | 2 +- sources/rmmod.zsh | 3 +++ sources/udisksctl-info.zsh | 12 ++++++++++++ sources/xdg-settings.zsh | 2 +- 12 files changed, 71 insertions(+), 9 deletions(-) create mode 100644 sources/acpi.zsh create mode 100644 sources/alacritty-msg.zsh create mode 100644 sources/alacritty.zsh create mode 100644 sources/ethtool.zsh create mode 100644 sources/modinfo.zsh create mode 100644 sources/pacman-key.zsh create mode 100644 sources/rmmod.zsh create mode 100644 sources/udisksctl-info.zsh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9d12cb7..1b16b0f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,11 +21,11 @@ repos: - id: check-toml - id: check-json - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.5.1 + rev: v1.5.4 hooks: - id: remove-crlf - repo: https://github.com/codespell-project/codespell - rev: v2.2.4 + rev: v2.2.6 hooks: - id: codespell additional_dependencies: @@ -37,7 +37,7 @@ repos: args: - --msg-filename - repo: https://github.com/editorconfig-checker/editorconfig-checker.python - rev: 2.7.1 + rev: 2.7.2 hooks: - id: editorconfig-checker - repo: https://github.com/jumanjihouse/pre-commit-hooks @@ -49,7 +49,7 @@ repos: hooks: - id: yamllint - repo: https://github.com/executablebooks/mdformat - rev: 0.7.16 + rev: 0.7.17 hooks: - id: mdformat additional_dependencies: @@ -62,8 +62,8 @@ repos: - mdformat-black - mdformat-config - repo: https://github.com/DavidAnson/markdownlint-cli2 - rev: v0.7.1 + rev: v0.10.0 hooks: - id: markdownlint-cli2 additional_dependencies: - - markdown-it-texmath@0.9.1 + - markdown-it-texmath diff --git a/sources/acpi.zsh b/sources/acpi.zsh new file mode 100644 index 0000000..102d3b7 --- /dev/null +++ b/sources/acpi.zsh @@ -0,0 +1,15 @@ +# :fzf-tab:complete:(\\|*/|)acpi:options +case $group in +directory) + acpi -d $wod + ;; +option) + case $word in + -(k|f|-(kelvin|fahrenheit))) + acpi -t $word + ;; + *) + acpi $word + ;; + esac +esac diff --git a/sources/alacritty-msg.zsh b/sources/alacritty-msg.zsh new file mode 100644 index 0000000..51b3c86 --- /dev/null +++ b/sources/alacritty-msg.zsh @@ -0,0 +1,6 @@ +# :fzf-tab:complete:(\\|*/|)alacritty-command-msg:argument-1 +case $group in +'alacritty msg commands') + alacritty msg help $word | bat --color=always -plhelp + ;; +esac diff --git a/sources/alacritty.zsh b/sources/alacritty.zsh new file mode 100644 index 0000000..022ab5b --- /dev/null +++ b/sources/alacritty.zsh @@ -0,0 +1,6 @@ +# :fzf-tab:complete:(\\|*/|)alacritty:argument-1 +case $group in +'alacritty commands') + alacritty help $word | bat --color=always -plhelp + ;; +esac diff --git a/sources/ethtool.zsh b/sources/ethtool.zsh new file mode 100644 index 0000000..c98dcde --- /dev/null +++ b/sources/ethtool.zsh @@ -0,0 +1,6 @@ +# :fzf-tab:complete:(\\|*/|)ethtool:argument-1 +case $group in +interface) + ethtool $word + ;; +esac diff --git a/sources/gtk-launch.zsh b/sources/gtk-launch.zsh index 43e8b3c..fb60a72 100644 --- a/sources/gtk-launch.zsh +++ b/sources/gtk-launch.zsh @@ -1,2 +1,2 @@ # :fzf-tab:complete:(\\|*/|)gtk-launch:values -less {/usr,~/.local}/share/applications/$word.desktop(N) +less {/usr,~/.local,~/.local/state/nix/profile,/run/current-system/sw}/share/applications/$word.desktop(N) diff --git a/sources/modinfo.zsh b/sources/modinfo.zsh new file mode 100644 index 0000000..e79631c --- /dev/null +++ b/sources/modinfo.zsh @@ -0,0 +1,9 @@ +# :fzf-tab:complete:(\\|*/|)modinfo:argument-1 +case $group in +'module file') + [[ -f $realpath ]] && modinfo $realpath | bat --color=always -plyaml || less $realpath + ;; +module(|' alias')) + modinfo $word | bat --color=always -plyaml + ;; +esac diff --git a/sources/pacman-key.zsh b/sources/pacman-key.zsh new file mode 100644 index 0000000..ba95182 --- /dev/null +++ b/sources/pacman-key.zsh @@ -0,0 +1,5 @@ +# :fzf-tab:complete:(\\|*/|)pacman-key: +case $group in + 'keys in keyring') + pacman-key -f $word;; +esac diff --git a/sources/pkg-config.zsh b/sources/pkg-config.zsh index 45c806a..ddc29e1 100644 --- a/sources/pkg-config.zsh +++ b/sources/pkg-config.zsh @@ -1,7 +1,7 @@ # :fzf-tab:complete:(\\|*/|)pkg-config:argument-rest case $group in package) - less /usr/(lib|share)/pkgconfig/$word.pc + less "$(pkg-config --variable=pcfiledir $word)/$word.pc" ;; 'package file') less ${realpath#--*=} diff --git a/sources/rmmod.zsh b/sources/rmmod.zsh new file mode 100644 index 0000000..883ff08 --- /dev/null +++ b/sources/rmmod.zsh @@ -0,0 +1,3 @@ +# :fzf-tab:complete:(\\|*/|)rmmod:argument-rest +lsmod | head -n1 +lsmod | grep -E "^$word\>" diff --git a/sources/udisksctl-info.zsh b/sources/udisksctl-info.zsh new file mode 100644 index 0000000..0e74b6e --- /dev/null +++ b/sources/udisksctl-info.zsh @@ -0,0 +1,12 @@ +# :fzf-tab:complete:(\\|*/|)udisksctl-info:* +case $group in +'block device') + udisksctl info -b $word | bat --color=always -plyaml + ;; +'object path') + udisksctl info -p $word | bat --color=always -plyaml + ;; +drive) + udisksctl info -d $word | bat --color=always -plyaml + ;; +esac diff --git a/sources/xdg-settings.zsh b/sources/xdg-settings.zsh index c76cb1d..ba28046 100644 --- a/sources/xdg-settings.zsh +++ b/sources/xdg-settings.zsh @@ -1,3 +1,3 @@ # :fzf-tab:complete:(\\|*/|)xdg-settings: file=$(xdg-settings get $word) -[[ -n $file ]] && less {/usr,~/.local}/share/applications/$file(N) +[[ -n $file ]] && less {/usr,~/.local,~/.local/state/nix/profile,/run/current-system/sw}/share/applications/$file(N)