From 350cf53acf5aa5246fa6530c73a5a54bcc234d64 Mon Sep 17 00:00:00 2001 From: Eric Hodel Date: Thu, 12 May 2022 13:46:42 -0700 Subject: [PATCH] Allow relative entries in CDPATH (#216) This allows `c` to work with relative directories like "." for the current directory or shorthand like "~/Repos" to complete from a common directory. --- CD-path/cdpath.nu | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CD-path/cdpath.nu b/CD-path/cdpath.nu index a99fd32..b271ff5 100644 --- a/CD-path/cdpath.nu +++ b/CD-path/cdpath.nu @@ -5,6 +5,7 @@ def-env c [dir = ""] { $default } else { $env.CDPATH + | path expand | reduce -f "" { |$it, $acc| if $acc == "" { let new_path = ([$it $dir] | path join) if ($new_path | path exists) { @@ -21,4 +22,4 @@ def-env c [dir = ""] { } # You need to have $env.CDPATH variable declared, my suggestion from config.nu: -# let-env CDPATH = [$env.HOME, "/", ([$env.HOME, ".config"] | path join)] +# let-env CDPATH = [".", $env.HOME, "/", ([$env.HOME, ".config"] | path join)]