mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2024-12-28 03:45:06 +00:00
Use builtin and command in fish
This commit is contained in:
parent
70c350ff96
commit
7b00d5a423
@ -10,19 +10,19 @@
|
|||||||
# pwd based on the value of _ZO_RESOLVE_SYMLINKS.
|
# pwd based on the value of _ZO_RESOLVE_SYMLINKS.
|
||||||
function __zoxide_pwd
|
function __zoxide_pwd
|
||||||
{%- if resolve_symlinks %}
|
{%- if resolve_symlinks %}
|
||||||
command pwd -P
|
builtin pwd -P
|
||||||
{%- else %}
|
{%- else %}
|
||||||
command pwd -L
|
builtin pwd -L
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
end
|
end
|
||||||
|
|
||||||
# cd + custom logic based on the value of _ZO_ECHO.
|
# cd + custom logic based on the value of _ZO_ECHO.
|
||||||
function __zoxide_cd
|
function __zoxide_cd
|
||||||
command cd $argv
|
builtin cd $argv
|
||||||
{%- if echo %}
|
{%- if echo %}
|
||||||
and __zoxide_pwd
|
and __zoxide_pwd
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
and commandline -f repaint
|
and builtin commandline -f repaint
|
||||||
end
|
end
|
||||||
|
|
||||||
{{ SECTION }}
|
{{ SECTION }}
|
||||||
@ -41,7 +41,7 @@ function __zoxide_hook --on-event fish_prompt
|
|||||||
function __zoxide_hook --on-variable PWD
|
function __zoxide_hook --on-variable PWD
|
||||||
|
|
||||||
{%- endmatch %}
|
{%- endmatch %}
|
||||||
zoxide add (__zoxide_pwd)
|
command zoxide add (__zoxide_pwd)
|
||||||
end
|
end
|
||||||
|
|
||||||
{{ SECTION }}
|
{{ SECTION }}
|
||||||
@ -59,40 +59,40 @@ function __zoxide_z
|
|||||||
else if begin; test $argc -eq 1; and test -d $argv[1]; end
|
else if begin; test $argc -eq 1; and test -d $argv[1]; end
|
||||||
__zoxide_cd $argv[1]
|
__zoxide_cd $argv[1]
|
||||||
else
|
else
|
||||||
set -l __zoxide_result (zoxide query -- $argv)
|
set -l __zoxide_result (command zoxide query -- $argv)
|
||||||
and __zoxide_cd $__zoxide_result
|
and __zoxide_cd $__zoxide_result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Jump to a directory using interactive search.
|
# Jump to a directory using interactive search.
|
||||||
function __zoxide_zi
|
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
|
and __zoxide_cd $__zoxide_result
|
||||||
end
|
end
|
||||||
|
|
||||||
# Add a new entry to the database.
|
# Add a new entry to the database.
|
||||||
function __zoxide_za
|
function __zoxide_za
|
||||||
zoxide add $argv
|
command zoxide add $argv
|
||||||
end
|
end
|
||||||
|
|
||||||
# Query an entry from the database using only keywords.
|
# Query an entry from the database using only keywords.
|
||||||
function __zoxide_zq
|
function __zoxide_zq
|
||||||
zoxide query $argv
|
command zoxide query $argv
|
||||||
end
|
end
|
||||||
|
|
||||||
# Query an entry from the database using interactive selection.
|
# Query an entry from the database using interactive selection.
|
||||||
function __zoxide_zqi
|
function __zoxide_zqi
|
||||||
zoxide query -i $argv
|
command zoxide query -i $argv
|
||||||
end
|
end
|
||||||
|
|
||||||
# Remove an entry from the database using the exact path.
|
# Remove an entry from the database using the exact path.
|
||||||
function __zoxide_zr
|
function __zoxide_zr
|
||||||
zoxide remove $argv
|
command zoxide remove $argv
|
||||||
end
|
end
|
||||||
|
|
||||||
# Remove an entry from the database using interactive selection.
|
# Remove an entry from the database using interactive selection.
|
||||||
function __zoxide_zri
|
function __zoxide_zri
|
||||||
zoxide remove -i $argv
|
command zoxide remove -i $argv
|
||||||
end
|
end
|
||||||
|
|
||||||
{{ SECTION }}
|
{{ SECTION }}
|
||||||
@ -106,7 +106,7 @@ end
|
|||||||
function __zoxide_unset
|
function __zoxide_unset
|
||||||
set --erase $argv > {{ Opts::DEVNULL }} 2>&1
|
set --erase $argv > {{ Opts::DEVNULL }} 2>&1
|
||||||
abbr --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
|
end
|
||||||
|
|
||||||
__zoxide_unset '{{cmd}}'
|
__zoxide_unset '{{cmd}}'
|
||||||
|
Loading…
Reference in New Issue
Block a user