Skip to content

Commit 09454d8

Browse files
committed
Lazy load fasd_cd function
1 parent e5c7065 commit 09454d8

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

functions/fasd_cd.fish

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
function fasd_cd -d 'Function to execute built-in cd'
2+
# if no $argv, identical with `fasd`
3+
if test (count $argv) -le 1
4+
command fasd "$argv"
5+
else
6+
set -l ret (command fasd -e 'printf %s' $argv)
7+
test -z "$ret";
8+
and return
9+
test -d "$ret";
10+
and cd "$ret";
11+
or printf "%s\n" $ret
12+
end
13+
end

init.fish

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,6 @@ function init --on-event init_fasd
1010
command fasd --proc (command fasd --sanitize "$argv") > "/dev/null" 2>&1
1111
end
1212

13-
function fasd_cd -d 'Function to execute built-in cd'
14-
# if no $argv, identical with `fasd`
15-
if test (count $argv) -le 1
16-
command fasd "$argv"
17-
else
18-
set -l ret (command fasd -e 'printf %s' $argv)
19-
test -z "$ret";
20-
and return
21-
test -d "$ret";
22-
and cd "$ret";
23-
or printf "%s\n" $ret
24-
end
25-
end
26-
2713
alias a='command fasd -a'
2814
alias s='command fasd -si'
2915
alias sd='command fasd -sid'

0 commit comments

Comments
 (0)