diff --git a/scripts/lsi.nu b/scripts/lsi.nu index 084a141..d09349e 100644 --- a/scripts/lsi.nu +++ b/scripts/lsi.nu @@ -1,10 +1,10 @@ # add the following function to env.nu # you can open env.nu in nushell with `config env` -def-env lsi [...path: string] { +def --env lsi [...path: string] { let output = (ls-interactive ($path | str join ' ')) - cd ( - if ($output | is-empty) { $env.PWD } - else { $output } - ) + if ($output | is-empty) { return } + if (($output | path type) == 'file') { + start $output # replace with your preferred editor + } else { cd $output } }