Skip to content

Commit

Permalink
Use builtin and command in fish
Browse files Browse the repository at this point in the history
  • Loading branch information
ajeetdsouza committed Feb 17, 2021
1 parent 70c350f commit 7b00d5a
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions templates/fish.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@
# pwd based on the value of _ZO_RESOLVE_SYMLINKS.
function __zoxide_pwd
{%- if resolve_symlinks %}
command pwd -P
builtin pwd -P
{%- else %}
command pwd -L
builtin pwd -L
{%- endif %}
end

# cd + custom logic based on the value of _ZO_ECHO.
function __zoxide_cd
command cd $argv
builtin cd $argv
{%- if echo %}
and __zoxide_pwd
{%- endif %}
and commandline -f repaint
and builtin commandline -f repaint
end

{{ SECTION }}
Expand All @@ -41,7 +41,7 @@ function __zoxide_hook --on-event fish_prompt
function __zoxide_hook --on-variable PWD

{%- endmatch %}
zoxide add (__zoxide_pwd)
command zoxide add (__zoxide_pwd)
end

{{ SECTION }}
Expand All @@ -59,40 +59,40 @@ function __zoxide_z
else if begin; test $argc -eq 1; and test -d $argv[1]; end
__zoxide_cd $argv[1]
else
set -l __zoxide_result (zoxide query -- $argv)
set -l __zoxide_result (command zoxide query -- $argv)
and __zoxide_cd $__zoxide_result
end
end

# Jump to a directory using interactive search.
function __zoxide_zi
set -l __zoxide_result (zoxide query -i -- $argv)
set -l __zoxide_result (command zoxide query -i -- $argv)
and __zoxide_cd $__zoxide_result
end

# Add a new entry to the database.
function __zoxide_za
zoxide add $argv
command zoxide add $argv
end

# Query an entry from the database using only keywords.
function __zoxide_zq
zoxide query $argv
command zoxide query $argv
end

# Query an entry from the database using interactive selection.
function __zoxide_zqi
zoxide query -i $argv
command zoxide query -i $argv
end

# Remove an entry from the database using the exact path.
function __zoxide_zr
zoxide remove $argv
command zoxide remove $argv
end

# Remove an entry from the database using interactive selection.
function __zoxide_zri
zoxide remove -i $argv
command zoxide remove -i $argv
end

{{ SECTION }}
Expand All @@ -106,7 +106,7 @@ end
function __zoxide_unset
set --erase $argv > {{ Opts::DEVNULL }} 2>&1
abbr --erase $argv > {{ Opts::DEVNULL }} 2>&1
functions --erase $argv > {{ Opts::DEVNULL }} 2>&1
builtin functions --erase $argv > {{ Opts::DEVNULL }} 2>&1
end

__zoxide_unset '{{cmd}}'
Expand Down

0 comments on commit 7b00d5a

Please sign in to comment.