From 88c1a9e07ae4289e3e5d85b9018332c9c1f4db80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Riegel?= Date: Wed, 5 Mar 2025 01:03:38 +0100 Subject: [PATCH] add zoxide custom completions --- custom-completions/bat/bat-completions.nu | 2 +- custom-completions/zoxide/RAEDME.md | 13 +++++ .../zoxide/zoxide-completions.nu | 53 +++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 custom-completions/zoxide/RAEDME.md create mode 100644 custom-completions/zoxide/zoxide-completions.nu diff --git a/custom-completions/bat/bat-completions.nu b/custom-completions/bat/bat-completions.nu index c0c5f71b6..a67b3fc5b 100644 --- a/custom-completions/bat/bat-completions.nu +++ b/custom-completions/bat/bat-completions.nu @@ -1,6 +1,6 @@ # A cat(1) clone with syntax highlighting and Git integration export extern "bat" [ - ...file: path # file to print / concatenate + ...file: path # file(s) to print / concatenate --help # Print help (see a summary with '-h') -h # Print help (see more with '--help') --version # Print version diff --git a/custom-completions/zoxide/RAEDME.md b/custom-completions/zoxide/RAEDME.md new file mode 100644 index 000000000..f489e7e2f --- /dev/null +++ b/custom-completions/zoxide/RAEDME.md @@ -0,0 +1,13 @@ +# pytest completions + +Completions for [zoxide](https://github.com/ajeetdsouza/zoxide). ``zoxide`` is a smarter cd command, inspired by z and autojump. It remembers which directories you use most frequently, so you can "jump" to them in just a few keystrokes. zoxide works on all major shells. + +## Usage + +```nushell +use zoxide-completions.nu * +``` +or +```nushell +source zoxide-completions.nu +``` diff --git a/custom-completions/zoxide/zoxide-completions.nu b/custom-completions/zoxide/zoxide-completions.nu new file mode 100644 index 000000000..44af59140 --- /dev/null +++ b/custom-completions/zoxide/zoxide-completions.nu @@ -0,0 +1,53 @@ +def "nu-complete zoxide import" [] { + ["autojump", "z"] +} + +def "nu-complete zoxide shells" [] { + ["bash", "elvish", "fish", "nushell", "posix", "powershell", "xonsh", "zsh"] +} + +def "nu-complete zoxide hooks" [] { + ["none", "prompt", "pwd"] +} + +# Add a new directory or increment its rank +export extern "zoxide add" [ + ...paths: path +] + +# Edit the database +export extern "zoxide edit" [ ] + +# Import entries from another application +export extern "zoxide import" [ + --from: string@"nu-complete zoxide import" # Application to import from + --merge # Merge into existing database +] + +# Generate shell configuration +export extern "zoxide init" [ + shell: string@"nu-complete zoxide shells" + --no-cmd # Prevents zoxide from defining the `z` and `zi` commands + --cmd: string # Changes the prefix of the `z` and `zi` commands [default: z] + --hook: string@"nu-complete zoxide hooks" # Changes how often zoxide increments a directory's score [default: pwd] +] + +# Search for a directory in the database +export extern "zoxide query" [ + ...keywords: string + --all(-a) # Show unavailable directories + --interactive(-i) # Use interactive selection + --list(-l) # List all matching directories + --score(-s) # Print score with results + --exclude: path # Exclude the current directory +] + +# Remove a directory from the database +export extern "zoxide remove" [ + ...paths: path +] + +export extern zoxide [ + --help(-h) # Print help + --version(-V) # Print version +]