nushell dump
This commit is contained in:
parent
25483702ac
commit
655dfe3d48
6 changed files with 187 additions and 206 deletions
|
@ -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
|
||||
|
||||
# =============================================================================
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue