nushell dump

This commit is contained in:
Bloxx12 2025-07-15 21:31:31 +02:00
commit 655dfe3d48
Signed by: faukah
SSH key fingerprint: SHA256:Uj2AXqvtdCA4hn5Hq0ZonhIAyUqI1q4w2sMG3Z1TH7E
6 changed files with 187 additions and 206 deletions

View file

@ -1,8 +1,3 @@
# =============================================================================
#
# Hook configuration for zoxide.
#
# Initialize hook to add new entries to the database.
export-env {
$env.config = (
@ -23,13 +18,28 @@ export-env {
}
}
# =============================================================================
#
# When using zoxide with --no-cmd, alias these internal functions as desired.
#
def "nu-complete zoxide path" [context: string] {
let parts = $context | split row -r "[ /]" | skip 1
{
options: {
sort: false,
completion_algorithm: substring,
case_sensitive: false,
},
completions: (
^zoxide query --list --exclude $env.PWD -- ...$parts
| lines
| first 10
| each {|p| $p | path relative-to $env.PWD | $"($in)/"}
# | each {|p| echo p | path basename}
)
# | each {|p| echo p | path basename | $"($in)/"}),
}
}
# Jump to a directory using only keywords.
def --env --wrapped __zoxide_z [...rest: string] {
def --env --wrapped __zoxide_z [...rest: string@"nu-complete zoxide path"] {
let path = match $rest {
[] => {'~'},
[ '-' ] => {'-'},
@ -42,16 +52,9 @@ def --env --wrapped __zoxide_z [...rest: string] {
}
# Jump to a directory using interactive search.
def --env --wrapped __zoxide_zi [...rest:string] {
def --env --wrapped __zoxide_zi [...rest:string@"nu-complete zoxide path"] {
cd $'(zoxide query --interactive -- ...$rest | str trim -r -c "\n")'
}
# =============================================================================
#
# Commands for zoxide. Disable these using --no-cmd.
#
alias cd = __zoxide_z
alias ci = __zoxide_zi
# =============================================================================