babarot/enhancd

Changing a directory takes almost half a second

Gorthog opened this issue · 25 comments

What did you expect to happen?
changing directory should be instant

What actually happened?
takes around 400ms

Output
to the left is what i get with enhancd, to the right is right before i installed it
image

install and uninstall method:

fisher install b4b4r07/enhancd
fisher remove b4b4r07/enhancd

Additional context
using fish 3.2.2
enhancd version 2.2.4
fisher version 4.3.0
prompt is starship version 0.51

this might be related - i'm getting a strange permission error
image

Have you visited any remote directories? If so, could be related to #85.

Nope. I've also deleted ~/.enhancd/enhancd.log but there was no effect.
Is there anywhere else enhancd is keeping state? It worked really good and then suddenly stopped.

Maybe try set fish_trace 1 and see what command is triggering the errors in cd?

Thanks for fish_trace! I didn't know about it.
Do you see anything interesting here?
Do you know of a way I can profile enhancd? Maybe then I can pinpoint what's the part that taking so long

❯ cd ~
> cd /home/amir
--> enhancd /home/amir
----> set -l arg
----> set -l args
----> set -l opts
----> set -l code 0
----> if
----> _enhancd_source_is_available
------> _enhancd_filepath_split_list fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta 2
--------> set -l str
--------> if
--------> test -z fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
--------> end if
---------> string join : fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
--------> set str fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
--------> while
--------> test -n fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
----------> string split : fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
---------> for fzy fzf-tmux fzf peco percol gof pick icepick sentaku selecta
----------> if
----------> _enhancd_command_which fzy
------------> if
------------> test -z fzy
------------> type -q fzy
-------------> return 1
------------> end if
----------> else
-----------> continue
----------> end if
----------> if
----------> _enhancd_command_which fzf-tmux
------------> if
------------> test -z fzf-tmux
------------> type -q fzf-tmux
------------> else
-------------> return 0
------------> end if
-----------> echo fzf-tmux
-----------> return 0
----------> end if
---------> end for
--------> end while
------> test -s /home/amir/.enhancd/enhancd.log
------> return 0
----> end if
----> set -l i 1
----> while
-----> count /home/amir
----> '[' 1 -le 1 ']'
-----> switch /home/amir
-------> _enhancd_source_argument /home/amir
---------> set -l dir /home/amir
---------> if
---------> test -d /home/amir
----------> echo /home/amir
----------> return 0
---------> end if
------> set -a args /home/amir
-----> end switch
------> math '1 + 1'
-----> set i 2
-----> count /home/amir
----> '[' 2 -le 1 ']'
----> end while
-----> count /home/amir
----> switch 1
----> end switch
----> switch 0
-----> _enhancd_cd_builtin /home/amir
-------> set -l code 0
-------> _enhancd_cd_before
---------> :
-------> cd /home/amir
-------> set code 0
-------> _enhancd_cd_after
---------> set -l IFS ''
----------> _enhancd_history_update
------------> function sub
------------> sub
--------------> _enhancd_filepath_list_step
----------------> if
----------------> set -q 'argv[1]'
-----------------> set 'argv[1]' /home/amir
----------------> end if
----------------> _enhancd_command_awk -f /home/amir/.config/fish/functions/enhancd/lib/step_by_step.awk -v dir=/home/amir
------------------> set -l awk_cmd
------------------> if
------------------> type -q gawk
-------------------> set awk_cmd gawk
------------------> end if
------------------> if
------------------> set -q 'argv[1]'
-------------------> gawk -f /home/amir/.config/fish/functions/enhancd/lib/step_by_step.awk -v dir=/home/amir
------------------> end if
--------------> _enhancd_filter_reverse
---------------->
-----------------> if
-----------------> test -n ''
-----------------> else
------------------> cat
-----------------> end if
----------------> _enhancd_command_awk -f /home/amir/.config/fish/functions/enhancd/lib/reverse.awk
------------------> set -l awk_cmd
------------------> if
------------------> type -q gawk
-------------------> set awk_cmd gawk
------------------> end if
------------------> if
------------------> set -q 'argv[1]'
-------------------> gawk -f /home/amir/.config/fish/functions/enhancd/lib/reverse.awk
------------------> end if
--------------> _enhancd_filepath_walk
----------------> if
----------------> set -q 'argv[1]'
-----------------> set 'argv[1]' /home/amir
----------------> end if
----------------> find /home/amir -maxdepth 1 -type d
----------------> _enhancd_command_grep -v \\/\\.
------------------> grep -E -v \\/\\.
------------------>
-------------------> if
-------------------> test -n -v
-------------------> test -f -v
-------------------> else
--------------------> cat
-------------------> end if
--------------> _enhancd_history_open
----------------> if
----------------> test -f /home/amir/.enhancd/enhancd.log
-----------------> cat /home/amir/.enhancd/enhancd.log
-----------------> return 0
----------------> end if
--------------> echo /home/amir
------------> _enhancd_filter_reverse
-------------->
---------------> if
---------------> test -n ''
---------------> else
----------------> cat
---------------> end if
--------------> _enhancd_command_awk -f /home/amir/.config/fish/functions/enhancd/lib/reverse.awk
----------------> set -l awk_cmd
----------------> if
----------------> type -q gawk
-----------------> set awk_cmd gawk
----------------> end if
----------------> if
----------------> set -q 'argv[1]'
-----------------> gawk -f /home/amir/.config/fish/functions/enhancd/lib/reverse.awk
----------------> end if
------------> _enhancd_filter_unique
-------------->
---------------> if
---------------> test -n ''
---------------> else
----------------> cat
---------------> end if
--------------> _enhancd_command_awk '!a[$0]++'
----------------> set -l awk_cmd
----------------> if
----------------> type -q gawk
-----------------> set awk_cmd gawk
----------------> end if
----------------> if
----------------> set -q 'argv[1]'
-----------------> gawk '!a[$0]++'
----------------> end if
------------> _enhancd_filter_reverse
-------------->
---------------> if
---------------> test -n ''
---------------> else
----------------> cat
---------------> end if
--------------> _enhancd_command_awk -f /home/amir/.config/fish/functions/enhancd/lib/reverse.awk
----------------> set -l awk_cmd
----------------> if
----------------> type -q gawk
-----------------> set awk_cmd gawk
----------------> end if
----------------> if
----------------> set -q 'argv[1]'
-----------------> gawk -f /home/amir/.config/fish/functions/enhancd/lib/reverse.awk
----------------> end if
------------> _enhancd_filepath_current_dir
--------------> if
--------------> set -q PWD
---------------> echo /home/amir
--------------> end if
---------> set -l list /\n/home\n/home/amir/packer\n/home/amir/Downloads\n/home/amir/go\n/home/amir/LogFiles\n/home/amir/Memoit\n/home/amir/lib\n/home/amir/exchange\n/home/amir/projects\n/home/amir/dotnet_install\n/home/amir/IgorPestow\n/home/amir/google-cloud-sdk\n/home/amir/candidates\n/home/amir/ts\n/home/amir\n/home/amir
---------> if
---------> test -n /\n/home\n/home/amir/packer\n/home/amir/Downloads\n/home/amir/go\n/home/amir/LogFiles\n/home/amir/Memoit\n/home/amir/lib\n/home/amir/exchange\n/home/amir/projects\n/home/amir/dotnet_install\n/home/amir/IgorPestow\n/home/amir/google-cloud-sdk\n/home/amir/candidates\n/home/amir/ts\n/home/amir\n/home/amir
----------> echo /\n/home\n/home/amir/packer\n/home/amir/Downloads\n/home/amir/go\n/home/amir/LogFiles\n/home/amir/Memoit\n/home/amir/lib\n/home/amir/exchange\n/home/amir/projects\n/home/amir/dotnet_install\n/home/amir/IgorPestow\n/home/amir/google-cloud-sdk\n/home/amir/candidates\n/home/amir/ts\n/home/amir\n/home/amir
---------> end if
---------> if
---------> test -n ''
---------> end if
-------> return 0
-----> return 0
----> end switch

What happens if you run fish_trace on just cd? Does it still show the permission error?

Yes.

This seems to be the relevant part:

---------------> source /home/amir/.config/fish/functions/_enhancd_filepath_list_step.fish
-----------------> function _enhancd_filepath_list_step
--------------> _enhancd_filepath_list_step
----------------> if
----------------> set -q 'argv[1]'
-----------------> set 'argv[1]' /home/amir
----------------> end if
----------------> _enhancd_command_awk -f /home/amir/.config/fish/functions/enhancd/lib/step_by_step.awk -v dir=/home/amir
------------------> set -l awk_cmd
------------------> if
------------------> type -q gawk
sh: 1: [[: Permission denied
sh: 1: [[: Permission denied

Any idea what's going on here? I don't understand this syntax

Here is the full output

❯ cd --help
> cd --help
--> enhancd --help
----> set -l arg
----> set -l args
----> set -l opts
----> set -l code 0
----> if
----> _enhancd_source_is_available
------> _enhancd_filepath_split_list fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta 2
--------> set -l str
--------> if
--------> test -z fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
--------> end if
---------> string join : fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
--------> set str fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
--------> while
--------> test -n fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
----------> string split : fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
---------> for fzy fzf-tmux fzf peco percol gof pick icepick sentaku selecta
----------> if
----------> _enhancd_command_which fzy
------------> if
------------> test -z fzy
------------> type -q fzy
-------------> return 1
------------> end if
----------> else
-----------> continue
----------> end if
----------> if
----------> _enhancd_command_which fzf-tmux
------------> if
------------> test -z fzf-tmux
------------> type -q fzf-tmux
------------> else
-------------> return 0
------------> end if
-----------> echo fzf-tmux
-----------> return 0
----------> end if
---------> end for
--------> end while
------> test -s /home/amir/.enhancd/enhancd.log
------> return 0
----> end if
----> set -l i 1
----> while
-----> count --help
----> '[' 1 -le 1 ']'
-----> switch --help
-------> source /home/amir/.config/fish/functions/_enhancd_help.fish
---------> function _enhancd_help
------> _enhancd_help
---------> source /home/amir/.config/fish/functions/_enhancd_ltsv_open.fish
-----------> function _enhancd_ltsv_open
--------> _enhancd_ltsv_open
----------> set -l configs /home/amir/.config/fish/functions/enhancd/config.ltsv
----------> for /home/amir/.config/fish/functions/enhancd/config.ltsv
-----------> if
-----------> test -f /home/amir/.config/fish/functions/enhancd/config.ltsv
------------> cat /home/amir/.config/fish/functions/enhancd/config.ltsv
-----------> end if
----------> end for
--------> _enhancd_command_awk -f /home/amir/.config/fish/functions/enhancd/lib/help.awk
----------> set -l awk_cmd
----------> if
----------> type -q gawk
-----------> set awk_cmd gawk
----------> end if
----------> if
----------> set -q 'argv[1]'
-----------> gawk -f /home/amir/.config/fish/functions/enhancd/lib/help.awk
Usage: cd [OPTIONS] [dir]

OPTIONS:
  -h, --help          show help message
  -q                  quiet, no output or use of hooks
  -s                  refuse to use paths with symlinks
  -L                  retain symbolic links ignoring CHASE_LINKS
  -P                  resolve symbolic links as CHASE_LINKS

Version: 2.2.4
----------> end if
--------> return 0
-----> end switch
------> math '1 + 1'
-----> set i 2
-----> count --help
----> '[' 2 -le 1 ']'
----> end while
-----> count --help
----> switch 1
----> end switch
----> switch 0
------> source /home/amir/.config/fish/functions/_enhancd_cd_builtin.fish
--------> function _enhancd_cd_builtin
-----> _enhancd_cd_builtin
-------> set -l code 0
--------> source /home/amir/.config/fish/functions/_enhancd_cd_before.fish
----------> function _enhancd_cd_before
-------> _enhancd_cd_before
---------> :
-------> cd
-------> set code 0
--------> source /home/amir/.config/fish/functions/_enhancd_cd_after.fish
----------> function _enhancd_cd_after
-------> _enhancd_cd_after
---------> set -l IFS ''
-----------> source /home/amir/.config/fish/functions/_enhancd_history_update.fish
-------------> function _enhancd_history_update
----------> _enhancd_history_update
------------> function sub
------------> sub
---------------> source /home/amir/.config/fish/functions/_enhancd_filepath_list_step.fish
-----------------> function _enhancd_filepath_list_step
--------------> _enhancd_filepath_list_step
----------------> if
----------------> set -q 'argv[1]'
-----------------> set 'argv[1]' /home/amir
----------------> end if
----------------> _enhancd_command_awk -f /home/amir/.config/fish/functions/enhancd/lib/step_by_step.awk -v dir=/home/amir
------------------> set -l awk_cmd
------------------> if
------------------> type -q gawk
sh: 1: [[: Permission denied
sh: 1: [[: Permission denied
-------------------> set awk_cmd gawk
------------------> end if
------------------> if
------------------> set -q 'argv[1]'
-------------------> gawk -f /home/amir/.config/fish/functions/enhancd/lib/step_by_step.awk -v dir=/home/amir
------------------> end if
--------------> _enhancd_filter_reverse
---------------->
-----------------> if
-----------------> test -n ''
-----------------> else
------------------> cat
-----------------> end if
----------------> _enhancd_command_awk -f /home/amir/.config/fish/functions/enhancd/lib/reverse.awk
------------------> set -l awk_cmd
------------------> if
------------------> type -q gawk
-------------------> set awk_cmd gawk
------------------> end if
------------------> if
------------------> set -q 'argv[1]'
-------------------> gawk -f /home/amir/.config/fish/functions/enhancd/lib/reverse.awk
------------------> end if
---------------> source /home/amir/.config/fish/functions/_enhancd_filepath_walk.fish
-----------------> function _enhancd_filepath_walk
--------------> _enhancd_filepath_walk
----------------> if
----------------> set -q 'argv[1]'
-----------------> set 'argv[1]' /home/amir
----------------> end if
----------------> find /home/amir -maxdepth 1 -type d
----------------> _enhancd_command_grep -v \\/\\.
------------------> grep -E -v \\/\\.
------------------>
-------------------> if
-------------------> test -n -v
-------------------> test -f -v
-------------------> else
--------------------> cat
-------------------> end if
--------------> _enhancd_history_open
----------------> if
----------------> test -f /home/amir/.enhancd/enhancd.log
-----------------> cat /home/amir/.enhancd/enhancd.log
-----------------> return 0
----------------> end if
--------------> echo /home/amir
------------> _enhancd_filter_reverse
-------------->
---------------> if
---------------> test -n ''
---------------> else
----------------> cat
---------------> end if
--------------> _enhancd_command_awk -f /home/amir/.config/fish/functions/enhancd/lib/reverse.awk
----------------> set -l awk_cmd
----------------> if
----------------> type -q gawk
-----------------> set awk_cmd gawk
----------------> end if
----------------> if
----------------> set -q 'argv[1]'
-----------------> gawk -f /home/amir/.config/fish/functions/enhancd/lib/reverse.awk
----------------> end if
------------> _enhancd_filter_unique
-------------->
---------------> if
---------------> test -n ''
---------------> else
----------------> cat
---------------> end if
--------------> _enhancd_command_awk '!a[$0]++'
----------------> set -l awk_cmd
----------------> if
----------------> type -q gawk
-----------------> set awk_cmd gawk
----------------> end if
----------------> if
----------------> set -q 'argv[1]'
-----------------> gawk '!a[$0]++'
----------------> end if
------------> _enhancd_filter_reverse
-------------->
---------------> if
---------------> test -n ''
---------------> else
----------------> cat
---------------> end if
--------------> _enhancd_command_awk -f /home/amir/.config/fish/functions/enhancd/lib/reverse.awk
----------------> set -l awk_cmd
----------------> if
----------------> type -q gawk
-----------------> set awk_cmd gawk
----------------> end if
----------------> if
----------------> set -q 'argv[1]'
-----------------> gawk -f /home/amir/.config/fish/functions/enhancd/lib/reverse.awk
----------------> end if
-------------> source /home/amir/.config/fish/functions/_enhancd_filepath_current_dir.fish
---------------> function _enhancd_filepath_current_dir
------------> _enhancd_filepath_current_dir
--------------> if
--------------> set -q PWD
---------------> echo /home/amir
--------------> end if
---------> set -l list /home/amir/projects/Cynet/backend/node_modules\n/home/amir/projects/Cynet/backend/src\n/home/amir/projects/Cynet/backend/dist\n/home/amir/projects/Cynet/backend/config\n/home/amir/projects/Cynet/backend/certs\n/home/amir/projects/Cynet/backend/test\n/home/amir/projects/Cynet/backend/seeders\n/home/amir/projects/Cynet/backend/migrations\n/home/amir/projects/memoit/node_modules\n/home/amir/projects/memoit/docker\n/home/amir/projects/memoit/bo\n/home/amir/projects/memoit/azure-pipelines\n/home/amir/projects/memoit/testing\n/home/amir/projects/memoit/memoit-common\n/home/amir/projects/Cynet/scheduler/node_modules\n/home/amir/projects/Cynet/scheduler/src\n/home/amir/projects/Cynet/scheduler/coverage\n/home/amir/projects/Cynet/scheduler/dist\n/home/amir/projects/Cynet/scheduler/test\n/home/amir/projects/Cynet/docker/db\n/home/amir/projects/Cynet/mock-api\n/home/amir/projects/Cynet/frontend\n/home/amir/projects/Cynet/admin-ui\n/home/amir/projects/Cynet/powershell\n/home/amir/projects/Cynet/authservice\n/home/amir/projects/Cynet/common\n/home/amir/projects/Cynet/admin-backend\n/home/amir/projects/Cynet/logs\n/home/amir/projects/memoit/pixi/tasks\n/home/amir/projects/memoit/pixi/src\n/home/amir/projects/memoit/pixi/coverage\n/home/amir/projects/memoit/pixi/image\n/home/amir/projects/memoit/pixi/downloads\n/home/amir/projects/memoit/pixi/js\n/home/amir/projects/memoit/pixi/build\n/home/amir/projects/memoit/pixi/public\n/home/amir/projects/memoit/pixi/vendor\n/home/amir/projects/memoit/backend/functions/node_modules\n/home/amir/projects/memoit/backend/functions/src\n/home/amir/projects/memoit/backend/functions/tests\n/home/amir/projects/memoit/backend/functions/lib\n/home/amir/projects/memoit/backend/node_modules\n/home/amir/projects/memoit/frontend/node_modules\n/home/amir/projects/memoit/frontend/src\n/home/amir/projects/memoit/frontend/test\n/home/amir/projects/memoit/frontend/build\n/home/amir/projects/memoit/frontend/public\n/home/amir/projects/memoit/engine/node_modules\n/home/amir/projects/memoit/engine/src\n/home/amir/projects/memoit/engine/memoit-pixi\n/home/amir/projects/memoit/engine/build\n/\n/home\n/home/amir/packer\n/home/amir/Downloads\n/home/amir/go\n/home/amir/LogFiles\n/home/amir/Memoit\n/home/amir/lib\n/home/amir/exchange\n/home/amir/projects\n/home/amir/dotnet_install\n/home/amir/IgorPestow\n/home/amir/google-cloud-sdk\n/home/amir/candidates\n/home/amir/ts\n/home/amir/projects/memoit/engine\n/home/amir/projects/memoit/frontend\n/home/amir/projects/memoit/backend/functions\n/home/amir/projects/memoit/pixi\n/home/amir/projects/Cynet/docker\n/home/amir/projects/Cynet/scheduler\n/home/amir/projects/Cynet\n/home/amir/projects/memoit\n/home/amir/projects/memoit/backend\n/home/amir/projects/Cynet/backend\n/home/amir\n/home/amir
---------> if
---------> test -n /home/amir/projects/Cynet/backend/node_modules\n/home/amir/projects/Cynet/backend/src\n/home/amir/projects/Cynet/backend/dist\n/home/amir/projects/Cynet/backend/config\n/home/amir/projects/Cynet/backend/certs\n/home/amir/projects/Cynet/backend/test\n/home/amir/projects/Cynet/backend/seeders\n/home/amir/projects/Cynet/backend/migrations\n/home/amir/projects/memoit/node_modules\n/home/amir/projects/memoit/docker\n/home/amir/projects/memoit/bo\n/home/amir/projects/memoit/azure-pipelines\n/home/amir/projects/memoit/testing\n/home/amir/projects/memoit/memoit-common\n/home/amir/projects/Cynet/scheduler/node_modules\n/home/amir/projects/Cynet/scheduler/src\n/home/amir/projects/Cynet/scheduler/coverage\n/home/amir/projects/Cynet/scheduler/dist\n/home/amir/projects/Cynet/scheduler/test\n/home/amir/projects/Cynet/docker/db\n/home/amir/projects/Cynet/mock-api\n/home/amir/projects/Cynet/frontend\n/home/amir/projects/Cynet/admin-ui\n/home/amir/projects/Cynet/powershell\n/home/amir/projects/Cynet/authservice\n/home/amir/projects/Cynet/common\n/home/amir/projects/Cynet/admin-backend\n/home/amir/projects/Cynet/logs\n/home/amir/projects/memoit/pixi/tasks\n/home/amir/projects/memoit/pixi/src\n/home/amir/projects/memoit/pixi/coverage\n/home/amir/projects/memoit/pixi/image\n/home/amir/projects/memoit/pixi/downloads\n/home/amir/projects/memoit/pixi/js\n/home/amir/projects/memoit/pixi/build\n/home/amir/projects/memoit/pixi/public\n/home/amir/projects/memoit/pixi/vendor\n/home/amir/projects/memoit/backend/functions/node_modules\n/home/amir/projects/memoit/backend/functions/src\n/home/amir/projects/memoit/backend/functions/tests\n/home/amir/projects/memoit/backend/functions/lib\n/home/amir/projects/memoit/backend/node_modules\n/home/amir/projects/memoit/frontend/node_modules\n/home/amir/projects/memoit/frontend/src\n/home/amir/projects/memoit/frontend/test\n/home/amir/projects/memoit/frontend/build\n/home/amir/projects/memoit/frontend/public\n/home/amir/projects/memoit/engine/node_modules\n/home/amir/projects/memoit/engine/src\n/home/amir/projects/memoit/engine/memoit-pixi\n/home/amir/projects/memoit/engine/build\n/\n/home\n/home/amir/packer\n/home/amir/Downloads\n/home/amir/go\n/home/amir/LogFiles\n/home/amir/Memoit\n/home/amir/lib\n/home/amir/exchange\n/home/amir/projects\n/home/amir/dotnet_install\n/home/amir/IgorPestow\n/home/amir/google-cloud-sdk\n/home/amir/candidates\n/home/amir/ts\n/home/amir/projects/memoit/engine\n/home/amir/projects/memoit/frontend\n/home/amir/projects/memoit/backend/functions\n/home/amir/projects/memoit/pixi\n/home/amir/projects/Cynet/docker\n/home/amir/projects/Cynet/scheduler\n/home/amir/projects/Cynet\n/home/amir/projects/memoit\n/home/amir/projects/memoit/backend\n/home/amir/projects/Cynet/backend\n/home/amir\n/home/amir
----------> echo /home/amir/projects/Cynet/backend/node_modules\n/home/amir/projects/Cynet/backend/src\n/home/amir/projects/Cynet/backend/dist\n/home/amir/projects/Cynet/backend/config\n/home/amir/projects/Cynet/backend/certs\n/home/amir/projects/Cynet/backend/test\n/home/amir/projects/Cynet/backend/seeders\n/home/amir/projects/Cynet/backend/migrations\n/home/amir/projects/memoit/node_modules\n/home/amir/projects/memoit/docker\n/home/amir/projects/memoit/bo\n/home/amir/projects/memoit/azure-pipelines\n/home/amir/projects/memoit/testing\n/home/amir/projects/memoit/memoit-common\n/home/amir/projects/Cynet/scheduler/node_modules\n/home/amir/projects/Cynet/scheduler/src\n/home/amir/projects/Cynet/scheduler/coverage\n/home/amir/projects/Cynet/scheduler/dist\n/home/amir/projects/Cynet/scheduler/test\n/home/amir/projects/Cynet/docker/db\n/home/amir/projects/Cynet/mock-api\n/home/amir/projects/Cynet/frontend\n/home/amir/projects/Cynet/admin-ui\n/home/amir/projects/Cynet/powershell\n/home/amir/projects/Cynet/authservice\n/home/amir/projects/Cynet/common\n/home/amir/projects/Cynet/admin-backend\n/home/amir/projects/Cynet/logs\n/home/amir/projects/memoit/pixi/tasks\n/home/amir/projects/memoit/pixi/src\n/home/amir/projects/memoit/pixi/coverage\n/home/amir/projects/memoit/pixi/image\n/home/amir/projects/memoit/pixi/downloads\n/home/amir/projects/memoit/pixi/js\n/home/amir/projects/memoit/pixi/build\n/home/amir/projects/memoit/pixi/public\n/home/amir/projects/memoit/pixi/vendor\n/home/amir/projects/memoit/backend/functions/node_modules\n/home/amir/projects/memoit/backend/functions/src\n/home/amir/projects/memoit/backend/functions/tests\n/home/amir/projects/memoit/backend/functions/lib\n/home/amir/projects/memoit/backend/node_modules\n/home/amir/projects/memoit/frontend/node_modules\n/home/amir/projects/memoit/frontend/src\n/home/amir/projects/memoit/frontend/test\n/home/amir/projects/memoit/frontend/build\n/home/amir/projects/memoit/frontend/public\n/home/amir/projects/memoit/engine/node_modules\n/home/amir/projects/memoit/engine/src\n/home/amir/projects/memoit/engine/memoit-pixi\n/home/amir/projects/memoit/engine/build\n/\n/home\n/home/amir/packer\n/home/amir/Downloads\n/home/amir/go\n/home/amir/LogFiles\n/home/amir/Memoit\n/home/amir/lib\n/home/amir/exchange\n/home/amir/projects\n/home/amir/dotnet_install\n/home/amir/IgorPestow\n/home/amir/google-cloud-sdk\n/home/amir/candidates\n/home/amir/ts\n/home/amir/projects/memoit/engine\n/home/amir/projects/memoit/frontend\n/home/amir/projects/memoit/backend/functions\n/home/amir/projects/memoit/pixi\n/home/amir/projects/Cynet/docker\n/home/amir/projects/Cynet/scheduler\n/home/amir/projects/Cynet\n/home/amir/projects/memoit\n/home/amir/projects/memoit/backend\n/home/amir/projects/Cynet/backend\n/home/amir\n/home/amir
---------> end if
---------> if
---------> test -n ''
---------> end if
-------> return 0
-----> return 0
----> end switch

I’m just poking around here, but what happens if you run _enhancd_command_awk -f /home/amir/.config/fish/functions/enhancd/lib/step_by_step.awk -v dir=/home/amir ?

Looking at _enhancd_command_awk, it looks like it's using gawk if it's available, otherwise using awk. What are the perms on your gawk binary?

functions _enhancd_command_awk
> functions _enhancd_command_awk
# Defined in ~/.config/fish/functions/_enhancd_command_awk.fish @ line 2
function _enhancd_command_awk
    set -l awk_cmd

    if type -q gawk
        set awk_cmd "gawk"
    else
        set awk_cmd "awk"
    end

    if set -q argv[1]
        $awk_cmd $argv
    else
        $awk_cmd ""
    end
end

To answer your first question, I don't see any error.

❯ _enhancd_command_awk -f /home/amir/.config/fish/functions/enhancd/lib/step_by_step.awk -v dir=/home/amir
-> source /home/amir/.config/fish/functions/_enhancd_command_awk.fish
---> function _enhancd_command_awk
> _enhancd_command_awk -f /home/amir/.config/fish/functions/enhancd/lib/step_by_step.awk -v dir=/home/amir
--> set -l awk_cmd
--> if
--> type -q gawk
---> set awk_cmd gawk
--> end if
--> if
--> set -q 'argv[1]'
---> gawk -f /home/amir/.config/fish/functions/enhancd/lib/step_by_step.awk -v dir=/home/amir
/home
/
--> end if

And I hope this answers the second question
image

I changed ownership to amir:amir, but same permission error

Hmm. Probably not that, then. Can you see where the script is hanging when you run cd?

you mean if i just type "cd"?
it hangs here:
image

full log

> cd
--> enhancd
----> set -l arg
----> set -l args
----> set -l opts
----> set -l code 0
----> if
----> _enhancd_source_is_available
------> _enhancd_filepath_split_list fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta 2
--------> set -l str
--------> if
--------> test -z fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
--------> end if
---------> string join : fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
--------> set str fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
--------> while
--------> test -n fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
----------> string split : fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
---------> for fzy fzf-tmux fzf peco percol gof pick icepick sentaku selecta
----------> if
----------> _enhancd_command_which fzy
------------> if
------------> test -z fzy
------------> type -q fzy
-------------> return 1
------------> end if
----------> else
-----------> continue
----------> end if
----------> if
----------> _enhancd_command_which fzf-tmux
------------> if
------------> test -z fzf-tmux
------------> type -q fzf-tmux
------------> else
-------------> return 0
------------> end if
-----------> echo fzf-tmux
-----------> return 0
----------> end if
---------> end for
--------> end while
------> test -s /home/amir/.enhancd/enhancd.log
------> return 0
----> end if
----> set -l i 1
----> while
-----> count
----> '[' 1 -le 0 ']'
----> end while
-----> count
----> switch 0
------> _enhancd_source_default
--------> if
--------> test 0 = 1
--------> end if
-------->
---------> begin
----------> _enhancd_entry_git_root
------------>
-------------> if
-------------> git rev-parse --is-inside-work-tree
-------------> else
--------------> return
-------------> end if
------------> _enhancd_filter_exclude true
----------> _enhancd_history_list
------------> _enhancd_history_open
--------------> if
--------------> test -f /home/amir/.enhancd/enhancd.log
---------------> cat /home/amir/.enhancd/enhancd.log
---------------> return 0
--------------> end if
------------> _enhancd_filter_reverse
-------------->
---------------> if
---------------> test -n ''
---------------> else
----------------> cat
---------------> end if
--------------> _enhancd_command_awk -f /home/amir/.config/fish/functions/enhancd/lib/reverse.awk
----------------> set -l awk_cmd
----------------> echo 'before if type -q gawk'
----------------> if
----------------> type -q gawk
-----------------> echo 'after if type -q gawk'
-----------------> set awk_cmd gawk
----------------> end if
----------------> if
----------------> set -q 'argv[1]'
-----------------> gawk -f /home/amir/.config/fish/functions/enhancd/lib/reverse.awk
----------------> end if
------------> _enhancd_filter_unique
-------------->
---------------> if
---------------> test -n ''
---------------> else
----------------> cat
---------------> end if
--------------> _enhancd_command_awk '!a[$0]++'
----------------> set -l awk_cmd
----------------> echo 'before if type -q gawk'
----------------> if
----------------> type -q gawk
-----------------> echo 'after if type -q gawk'
-----------------> set awk_cmd gawk
----------------> end if
----------------> if
----------------> set -q 'argv[1]'
-----------------> gawk '!a[$0]++'
----------------> end if
------------> _enhancd_filter_exists
--------------> set -l line
--------------> while
--------------> read line
---------------> if
---------------> test -d 'before if type -q gawk'
---------------> end if
--------------> read line
---------------> if
---------------> test -d 'after if type -q gawk'
---------------> end if
--------------> read line
---------------> if
---------------> test -d 'before if type -q gawk'
---------------> end if
--------------> read line
---------------> if
---------------> test -d 'after if type -q gawk'
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir
----------------> echo /home/amir
---------------> end if
--------------> read line
---------------> if
---------------> test -d '************** before set awk_cmd gawk **********'
---------------> end if
--------------> read line
---------------> if
---------------> test -d '************** after set awk_cmd gawk **********'
---------------> end if
--------------> read line
---------------> if
---------------> test -d '************** finished -f /home/amir/.config/fish/functions/enhancd/lib/reverse.awk **********'
---------------> end if
--------------> read line
---------------> if
---------------> test -d '************** starting !a[$0]++ **********'
---------------> end if
--------------> read line
---------------> if
---------------> test -d '************** starting -f /home/amir/.config/fish/functions/enhancd/lib/reverse.awk **********'
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/.config/fish/functions
----------------> echo /home/amir/.config/fish/functions
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/.config/fish/functions/enhancd
----------------> echo /home/amir/.config/fish/functions/enhancd
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/.config/fish/functions/enhancd/lib
----------------> echo /home/amir/.config/fish/functions/enhancd/lib
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/lib
----------------> echo /home/amir/lib
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/backend
----------------> echo /home/amir/projects/Cynet/backend
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/backend
----------------> echo /home/amir/projects/memoit/backend
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit
----------------> echo /home/amir/projects/memoit
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet
----------------> echo /home/amir/projects/Cynet
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/scheduler
----------------> echo /home/amir/projects/Cynet/scheduler
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/docker
----------------> echo /home/amir/projects/Cynet/docker
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/pixi
----------------> echo /home/amir/projects/memoit/pixi
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/backend/functions
----------------> echo /home/amir/projects/memoit/backend/functions
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/frontend
----------------> echo /home/amir/projects/memoit/frontend
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/engine
----------------> echo /home/amir/projects/memoit/engine
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/ts
----------------> echo /home/amir/ts
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/candidates
----------------> echo /home/amir/candidates
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/google-cloud-sdk
----------------> echo /home/amir/google-cloud-sdk
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/IgorPestow
----------------> echo /home/amir/IgorPestow
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/dotnet_install
----------------> echo /home/amir/dotnet_install
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects
----------------> echo /home/amir/projects
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/exchange
----------------> echo /home/amir/exchange
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/Memoit
----------------> echo /home/amir/Memoit
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/LogFiles
----------------> echo /home/amir/LogFiles
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/go
----------------> echo /home/amir/go
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/Downloads
----------------> echo /home/amir/Downloads
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/packer
----------------> echo /home/amir/packer
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home
----------------> echo /home
---------------> end if
--------------> read line
---------------> if
---------------> test -d /
----------------> echo /
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/engine/build
----------------> echo /home/amir/projects/memoit/engine/build
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/engine/memoit-pixi
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/engine/src
----------------> echo /home/amir/projects/memoit/engine/src
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/engine/node_modules
----------------> echo /home/amir/projects/memoit/engine/node_modules
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/frontend/public
----------------> echo /home/amir/projects/memoit/frontend/public
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/frontend/build
----------------> echo /home/amir/projects/memoit/frontend/build
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/frontend/test
----------------> echo /home/amir/projects/memoit/frontend/test
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/frontend/src
----------------> echo /home/amir/projects/memoit/frontend/src
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/frontend/node_modules
----------------> echo /home/amir/projects/memoit/frontend/node_modules
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/backend/node_modules
----------------> echo /home/amir/projects/memoit/backend/node_modules
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/backend/functions/lib
----------------> echo /home/amir/projects/memoit/backend/functions/lib
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/backend/functions/tests
----------------> echo /home/amir/projects/memoit/backend/functions/tests
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/backend/functions/src
----------------> echo /home/amir/projects/memoit/backend/functions/src
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/backend/functions/node_modules
----------------> echo /home/amir/projects/memoit/backend/functions/node_modules
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/pixi/vendor
----------------> echo /home/amir/projects/memoit/pixi/vendor
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/pixi/public
----------------> echo /home/amir/projects/memoit/pixi/public
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/pixi/build
----------------> echo /home/amir/projects/memoit/pixi/build
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/pixi/js
----------------> echo /home/amir/projects/memoit/pixi/js
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/pixi/downloads
----------------> echo /home/amir/projects/memoit/pixi/downloads
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/pixi/image
----------------> echo /home/amir/projects/memoit/pixi/image
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/pixi/coverage
----------------> echo /home/amir/projects/memoit/pixi/coverage
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/pixi/src
----------------> echo /home/amir/projects/memoit/pixi/src
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/pixi/tasks
----------------> echo /home/amir/projects/memoit/pixi/tasks
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/logs
----------------> echo /home/amir/projects/Cynet/logs
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/admin-backend
----------------> echo /home/amir/projects/Cynet/admin-backend
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/common
----------------> echo /home/amir/projects/Cynet/common
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/authservice
----------------> echo /home/amir/projects/Cynet/authservice
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/powershell
----------------> echo /home/amir/projects/Cynet/powershell
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/admin-ui
----------------> echo /home/amir/projects/Cynet/admin-ui
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/frontend
----------------> echo /home/amir/projects/Cynet/frontend
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/mock-api
----------------> echo /home/amir/projects/Cynet/mock-api
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/docker/db
----------------> echo /home/amir/projects/Cynet/docker/db
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/scheduler/test
----------------> echo /home/amir/projects/Cynet/scheduler/test
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/scheduler/dist
----------------> echo /home/amir/projects/Cynet/scheduler/dist
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/scheduler/coverage
----------------> echo /home/amir/projects/Cynet/scheduler/coverage
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/scheduler/src
----------------> echo /home/amir/projects/Cynet/scheduler/src
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/scheduler/node_modules
----------------> echo /home/amir/projects/Cynet/scheduler/node_modules
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/memoit-common
----------------> echo /home/amir/projects/memoit/memoit-common
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/testing
----------------> echo /home/amir/projects/memoit/testing
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/azure-pipelines
----------------> echo /home/amir/projects/memoit/azure-pipelines
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/bo
----------------> echo /home/amir/projects/memoit/bo
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/docker
----------------> echo /home/amir/projects/memoit/docker
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/memoit/node_modules
----------------> echo /home/amir/projects/memoit/node_modules
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/backend/migrations
----------------> echo /home/amir/projects/Cynet/backend/migrations
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/backend/seeders
----------------> echo /home/amir/projects/Cynet/backend/seeders
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/backend/test
----------------> echo /home/amir/projects/Cynet/backend/test
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/backend/certs
----------------> echo /home/amir/projects/Cynet/backend/certs
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/backend/config
----------------> echo /home/amir/projects/Cynet/backend/config
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/backend/dist
----------------> echo /home/amir/projects/Cynet/backend/dist
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/backend/src
----------------> echo /home/amir/projects/Cynet/backend/src
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/projects/Cynet/backend/node_modules
----------------> echo /home/amir/projects/Cynet/backend/node_modules
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/.config/fish
----------------> echo /home/amir/.config/fish
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/.config
----------------> echo /home/amir/.config
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/lib/importlib_resources
----------------> echo /home/amir/lib/importlib_resources
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/lib/wcwidth
----------------> echo /home/amir/lib/wcwidth
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/lib/dateutil
----------------> echo /home/amir/lib/dateutil
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/lib/pygments
----------------> echo /home/amir/lib/pygments
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/lib/bin
----------------> echo /home/amir/lib/bin
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/lib/redis
----------------> echo /home/amir/lib/redis
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/lib/prompt_toolkit
----------------> echo /home/amir/lib/prompt_toolkit
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/lib/pendulum
----------------> echo /home/amir/lib/pendulum
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/lib/iredis
----------------> echo /home/amir/lib/iredis
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/lib/pytzdata
----------------> echo /home/amir/lib/pytzdata
---------------> end if
--------------> read line
---------------> if
---------------> test -d /home/amir/lib/click
----------------> echo /home/amir/lib/click
---------------> end if
--------------> read line
---------------> if
---------------> test -d '************** starting -f /home/amir/.config/fish/functions/enhancd/lib/step_by_step.awk -v dir=/home/amir **********'
---------------> end if
--------------> read line
---------------> if
---------------> test -d '************** finished -f /home/amir/.config/fish/functions/enhancd/lib/step_by_step.awk -v dir=/home/amir **********'
---------------> end if
--------------> read line
---------------> if
---------------> test -d '************** finished !a[$0]++ **********'
---------------> end if
--------------> read line
--------------> end while
------------> _enhancd_filter_fuzzy ''
--------------> if
--------------> test -z ''
---------------> cat
--------------> end if
------------> _enhancd_filter_exclude /home/amir/.config/fish/functions
--------------> _enhancd_command_grep -v -x /home/amir/.config/fish/functions
----------------> grep -E -v -x /home/amir/.config/fish/functions
---------------->
-----------------> if
-----------------> test -n -v
-----------------> test -f -v
-----------------> else
------------------> cat
-----------------> end if
---------> end begin
--------> _enhancd_filter_interactive
----------> set -l stdin ''
----------> if
----------> test -z ''
-----------> read -z stdin
----------> end if
----------> if
----------> test -z /home/amir\n/home/amir/.config/fish/functions/enhancd\n/home/amir/.config/fish/functions/enhancd/lib\n/home/amir/lib\n/home/amir/projects/Cynet/backend\n/home/amir/projects/memoit/backend\n/home/amir/projects/memoit\n/home/amir/projects/Cynet\n/home/amir/projects/Cynet/scheduler\n/home/amir/projects/Cynet/docker\n/home/amir/projects/memoit/pixi\n/home/amir/projects/memoit/backend/functions\n/home/amir/projects/memoit/frontend\n/home/amir/projects/memoit/engine\n/home/amir/ts\n/home/amir/candidates\n/home/amir/google-cloud-sdk\n/home/amir/IgorPestow\n/home/amir/dotnet_install\n/home/amir/projects\n/home/amir/exchange\n/home/amir/Memoit\n/home/amir/LogFiles\n/home/amir/go\n/home/amir/Downloads\n/home/amir/packer\n/home\n/\n/home/amir/projects/memoit/engine/build\n/home/amir/projects/memoit/engine/src\n/home/amir/projects/memoit/engine/node_modules\n/home/amir/projects/memoit/frontend/public\n/home/amir/projects/memoit/frontend/build\n/home/amir/projects/memoit/frontend/test\n/home/amir/projects/memoit/frontend/src\n/home/amir/projects/memoit/frontend/node_modules\n/home/amir/projects/memoit/backend/node_modules\n/home/amir/projects/memoit/backend/functions/lib\n/home/amir/projects/memoit/backend/functions/tests\n/home/amir/projects/memoit/backend/functions/src\n/home/amir/projects/memoit/backend/functions/node_modules\n/home/amir/projects/memoit/pixi/vendor\n/home/amir/projects/memoit/pixi/public\n/home/amir/projects/memoit/pixi/build\n/home/amir/projects/memoit/pixi/js\n/home/amir/projects/memoit/pixi/downloads\n/home/amir/projects/memoit/pixi/image\n/home/amir/projects/memoit/pixi/coverage\n/home/amir/projects/memoit/pixi/src\n/home/amir/projects/memoit/pixi/tasks\n/home/amir/projects/Cynet/logs\n/home/amir/projects/Cynet/admin-backend\n/home/amir/projects/Cynet/common\n/home/amir/projects/Cynet/authservice\n/home/amir/projects/Cynet/powershell\n/home/amir/projects/Cynet/admin-ui\n/home/amir/projects/Cynet/frontend\n/home/amir/projects/Cynet/mock-api\n/home/amir/projects/Cynet/docker/db\n/home/amir/projects/Cynet/scheduler/test\n/home/amir/projects/Cynet/scheduler/dist\n/home/amir/projects/Cynet/scheduler/coverage\n/home/amir/projects/Cynet/scheduler/src\n/home/amir/projects/Cynet/scheduler/node_modules\n/home/amir/projects/memoit/memoit-common\n/home/amir/projects/memoit/testing\n/home/amir/projects/memoit/azure-pipelines\n/home/amir/projects/memoit/bo\n/home/amir/projects/memoit/docker\n/home/amir/projects/memoit/node_modules\n/home/amir/projects/Cynet/backend/migrations\n/home/amir/projects/Cynet/backend/seeders\n/home/amir/projects/Cynet/backend/test\n/home/amir/projects/Cynet/backend/certs\n/home/amir/projects/Cynet/backend/config\n/home/amir/projects/Cynet/backend/dist\n/home/amir/projects/Cynet/backend/src\n/home/amir/projects/Cynet/backend/node_modules\n/home/amir/.config/fish\n/home/amir/.config\n/home/amir/lib/importlib_resources\n/home/amir/lib/wcwidth\n/home/amir/lib/dateutil\n/home/amir/lib/pygments\n/home/amir/lib/bin\n/home/amir/lib/redis\n/home/amir/lib/prompt_toolkit\n/home/amir/lib/pendulum\n/home/amir/lib/iredis\n/home/amir/lib/pytzdata\n/home/amir/lib/click\n
----------> end if
-----------> _enhancd_filepath_split_list fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
-------------> set -l str
-------------> if
-------------> test -z fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
-------------> end if
--------------> string join : fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
-------------> set str fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
-------------> while
-------------> test -n fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
---------------> string split : fzy:fzf-tmux:fzf:peco:percol:gof:pick:icepick:sentaku:selecta
--------------> for fzy fzf-tmux fzf peco percol gof pick icepick sentaku selecta
---------------> if
---------------> _enhancd_command_which fzy
-----------------> if
-----------------> test -z fzy
-----------------> type -q fzy
------------------> return 1
-----------------> end if
---------------> else
----------------> continue
---------------> end if
---------------> if
---------------> _enhancd_command_which fzf-tmux
-----------------> if
-----------------> test -z fzf-tmux
-----------------> type -q fzf-tmux
-----------------> else
------------------> return 0
-----------------> end if
----------------> echo fzf-tmux
----------------> return 0
---------------> end if
--------------> end for
-------------> end while
----------> set -l filter fzf-tmux
-----------> echo /home/amir\n/home/amir/.config/fish/functions/enhancd\n/home/amir/.config/fish/functions/enhancd/lib\n/home/amir/lib\n/home/amir/projects/Cynet/backend\n/home/amir/projects/memoit/backend\n/home/amir/projects/memoit\n/home/amir/projects/Cynet\n/home/amir/projects/Cynet/scheduler\n/home/amir/projects/Cynet/docker\n/home/amir/projects/memoit/pixi\n/home/amir/projects/memoit/backend/functions\n/home/amir/projects/memoit/frontend\n/home/amir/projects/memoit/engine\n/home/amir/ts\n/home/amir/candidates\n/home/amir/google-cloud-sdk\n/home/amir/IgorPestow\n/home/amir/dotnet_install\n/home/amir/projects\n/home/amir/exchange\n/home/amir/Memoit\n/home/amir/LogFiles\n/home/amir/go\n/home/amir/Downloads\n/home/amir/packer\n/home\n/\n/home/amir/projects/memoit/engine/build\n/home/amir/projects/memoit/engine/src\n/home/amir/projects/memoit/engine/node_modules\n/home/amir/projects/memoit/frontend/public\n/home/amir/projects/memoit/frontend/build\n/home/amir/projects/memoit/frontend/test\n/home/amir/projects/memoit/frontend/src\n/home/amir/projects/memoit/frontend/node_modules\n/home/amir/projects/memoit/backend/node_modules\n/home/amir/projects/memoit/backend/functions/lib\n/home/amir/projects/memoit/backend/functions/tests\n/home/amir/projects/memoit/backend/functions/src\n/home/amir/projects/memoit/backend/functions/node_modules\n/home/amir/projects/memoit/pixi/vendor\n/home/amir/projects/memoit/pixi/public\n/home/amir/projects/memoit/pixi/build\n/home/amir/projects/memoit/pixi/js\n/home/amir/projects/memoit/pixi/downloads\n/home/amir/projects/memoit/pixi/image\n/home/amir/projects/memoit/pixi/coverage\n/home/amir/projects/memoit/pixi/src\n/home/amir/projects/memoit/pixi/tasks\n/home/amir/projects/Cynet/logs\n/home/amir/projects/Cynet/admin-backend\n/home/amir/projects/Cynet/common\n/home/amir/projects/Cynet/authservice\n/home/amir/projects/Cynet/powershell\n/home/amir/projects/Cynet/admin-ui\n/home/amir/projects/Cynet/frontend\n/home/amir/projects/Cynet/mock-api\n/home/amir/projects/Cynet/docker/db\n/home/amir/projects/Cynet/scheduler/test\n/home/amir/projects/Cynet/scheduler/dist\n/home/amir/projects/Cynet/scheduler/coverage\n/home/amir/projects/Cynet/scheduler/src\n/home/amir/projects/Cynet/scheduler/node_modules\n/home/amir/projects/memoit/memoit-common\n/home/amir/projects/memoit/testing\n/home/amir/projects/memoit/azure-pipelines\n/home/amir/projects/memoit/bo\n/home/amir/projects/memoit/docker\n/home/amir/projects/memoit/node_modules\n/home/amir/projects/Cynet/backend/migrations\n/home/amir/projects/Cynet/backend/seeders\n/home/amir/projects/Cynet/backend/test\n/home/amir/projects/Cynet/backend/certs\n/home/amir/projects/Cynet/backend/config\n/home/amir/projects/Cynet/backend/dist\n/home/amir/projects/Cynet/backend/src\n/home/amir/projects/Cynet/backend/node_modules\n/home/amir/.config/fish\n/home/amir/.config\n/home/amir/lib/importlib_resources\n/home/amir/lib/wcwidth\n/home/amir/lib/dateutil\n/home/amir/lib/pygments\n/home/amir/lib/bin\n/home/amir/lib/redis\n/home/amir/lib/prompt_toolkit\n/home/amir/lib/pendulum\n/home/amir/lib/iredis\n/home/amir/lib/pytzdata\n/home/amir/lib/click\n
-----------> _enhancd_command_grep -c ''
-------------> grep -E -c ''
------------->
--------------> if
--------------> test -n -c
--------------> test -f -c
--------------> else
---------------> cat
--------------> end if
----------> set -l count 92
----------> switch 92
------------> echo /home/amir\n/home/amir/.config/fish/functions/enhancd\n/home/amir/.config/fish/functions/enhancd/lib\n/home/amir/lib\n/home/amir/projects/Cynet/backend\n/home/amir/projects/memoit/backend\n/home/amir/projects/memoit\n/home/amir/projects/Cynet\n/home/amir/projects/Cynet/scheduler\n/home/amir/projects/Cynet/docker\n/home/amir/projects/memoit/pixi\n/home/amir/projects/memoit/backend/functions\n/home/amir/projects/memoit/frontend\n/home/amir/projects/memoit/engine\n/home/amir/ts\n/home/amir/candidates\n/home/amir/google-cloud-sdk\n/home/amir/IgorPestow\n/home/amir/dotnet_install\n/home/amir/projects\n/home/amir/exchange\n/home/amir/Memoit\n/home/amir/LogFiles\n/home/amir/go\n/home/amir/Downloads\n/home/amir/packer\n/home\n/\n/home/amir/projects/memoit/engine/build\n/home/amir/projects/memoit/engine/src\n/home/amir/projects/memoit/engine/node_modules\n/home/amir/projects/memoit/frontend/public\n/home/amir/projects/memoit/frontend/build\n/home/amir/projects/memoit/frontend/test\n/home/amir/projects/memoit/frontend/src\n/home/amir/projects/memoit/frontend/node_modules\n/home/amir/projects/memoit/backend/node_modules\n/home/amir/projects/memoit/backend/functions/lib\n/home/amir/projects/memoit/backend/functions/tests\n/home/amir/projects/memoit/backend/functions/src\n/home/amir/projects/memoit/backend/functions/node_modules\n/home/amir/projects/memoit/pixi/vendor\n/home/amir/projects/memoit/pixi/public\n/home/amir/projects/memoit/pixi/build\n/home/amir/projects/memoit/pixi/js\n/home/amir/projects/memoit/pixi/downloads\n/home/amir/projects/memoit/pixi/image\n/home/amir/projects/memoit/pixi/coverage\n/home/amir/projects/memoit/pixi/src\n/home/amir/projects/memoit/pixi/tasks\n/home/amir/projects/Cynet/logs\n/home/amir/projects/Cynet/admin-backend\n/home/amir/projects/Cynet/common\n/home/amir/projects/Cynet/authservice\n/home/amir/projects/Cynet/powershell\n/home/amir/projects/Cynet/admin-ui\n/home/amir/projects/Cynet/frontend\n/home/amir/projects/Cynet/mock-api\n/home/amir/projects/Cynet/docker/db\n/home/amir/projects/Cynet/scheduler/test\n/home/amir/projects/Cynet/scheduler/dist\n/home/amir/projects/Cynet/scheduler/coverage\n/home/amir/projects/Cynet/scheduler/src\n/home/amir/projects/Cynet/scheduler/node_modules\n/home/amir/projects/memoit/memoit-common\n/home/amir/projects/memoit/testing\n/home/amir/projects/memoit/azure-pipelines\n/home/amir/projects/memoit/bo\n/home/amir/projects/memoit/docker\n/home/amir/projects/memoit/node_modules\n/home/amir/projects/Cynet/backend/migrations\n/home/amir/projects/Cynet/backend/seeders\n/home/amir/projects/Cynet/backend/test\n/home/amir/projects/Cynet/backend/certs\n/home/amir/projects/Cynet/backend/config\n/home/amir/projects/Cynet/backend/dist\n/home/amir/projects/Cynet/backend/src\n/home/amir/projects/Cynet/backend/node_modules\n/home/amir/.config/fish\n/home/amir/.config\n/home/amir/lib/importlib_resources\n/home/amir/lib/wcwidth\n/home/amir/lib/dateutil\n/home/amir/lib/pygments\n/home/amir/lib/bin\n/home/amir/lib/redis\n/home/amir/lib/prompt_toolkit\n/home/amir/lib/pendulum\n/home/amir/lib/iredis\n/home/amir/lib/pytzdata\n/home/amir/lib/click\n
------------> eval fzf-tmux

I mean if you cd to a directory, what command is it hanging on?

I don't know how to check that. I just see the output, no timing for each step

Since fish_trace prints the lines as they are executed, I thought it might be possible to see which command it printed and then hung on.

If not, try this to profile the function: fish --profile /tmp/fishprof.txt -ic 'cd/home/amir'

ooooh very neat!! i tried looking for something like this and couldn't find it

Is it normal that there are ... in the middle?

Here it is:

Time	Sum	Command
21	350892	> cd /home/amir
142	350871	-> enhancd $argv
174	179	--> source /home/amir/.config/fish/functions/enhancd.fish
5	5	---> function enhancd...
7	7	--> set -l arg
4	4	--> set -l args
3	3	--> set -l opts
3	3	--> set -l code 0
2	96788	--> if not _enhancd_source_is_available...
112	96786	---> not _enhancd_source_is_available
34	37	----> source /home/amir/.config/fish/functions/_enhancd_source_is_available.fish
3	3	-----> function _enhancd_source_is_available...
124	96620	----> _enhancd_filepath_split_list "$ENHANCD_FILTER" 2 >/dev/null
56	59	-----> source /home/amir/.config/fish/functions/_enhancd_filepath_split_list.fish
3	3	------> function _enhancd_filepath_split_list...
6	6	-----> set -l str
1	8	-----> if test -z "$argv[1]"...
7	7	------> test -z "$argv[1]"
99	111	-----> set str (string join ':' $argv[1])
12	12	------> string join ':' $argv[1]
5	96312	-----> while test -n "$str"
...
6	6	------> test -n "$str"
112	96301	------> for item in (string split ':' $str)...
14	14	-------> string split ':' $str
3	47691	-------> if _enhancd_command_which "$item"...
112	47685	--------> _enhancd_command_which "$item"
36	39	---------> source /home/amir/.config/fish/functions/_enhancd_command_which.fish
3	3	----------> function _enhancd_command_which...
17	47534	---------> if test -z "$argv[1]"...
7	7	----------> test -z "$argv[1]"
47497	47497	----------> ! type -q "$argv[1]"
13	13	----------> return 1
3	3	--------> continue
6	48484	-------> if _enhancd_command_which "$item"...
19	48459	--------> _enhancd_command_which "$item"
19	48440	---------> if test -z "$argv[1]"...
6	6	----------> test -z "$argv[1]"
48403	48403	----------> ! type -q "$argv[1]"
12	12	----------> return 0
17	17	--------> echo $item
2	2	--------> return 0
13	13	----> test -s $ENHANCD_DIR/enhancd.log
4	4	----> return $status
7	7	--> set -l i 1
19	779	--> while [ $i -le (count $argv) ]
...
128	143	---> [ $i -le (count $argv) ]
15	15	----> count $argv
26	324	---> switch $argv[$i]...
107	298	----> set -a args (_enhancd_source_argument "$argv[1]")
105	191	-----> _enhancd_source_argument "$argv[1]"
49	53	------> source /home/amir/.config/fish/functions/_enhancd_source_argument.fish
4	4	-------> function _enhancd_source_argument...
11	11	------> set -l dir "$argv[1]"
5	22	------> if test -d "$dir"...
9	9	-------> test -d "$dir"
6	6	-------> echo "$dir"
2	2	-------> return 0
131	182	---> set i (math "$i + 1")
51	51	----> math "$i + 1"
100	111	---> [ $i -le (count $argv) ]
11	11	----> count $argv
101	112	--> switch (count $argv)...
11	11	---> count $argv
7	252847	--> switch "$code"...
121	252836	---> _enhancd_cd_builtin $opts $args
42	45	----> source /home/amir/.config/fish/functions/_enhancd_cd_builtin.fish
3	3	-----> function _enhancd_cd_builtin...
20	20	----> set -l code 0
128	182	----> _enhancd_cd_before
38	41	-----> source /home/amir/.config/fish/functions/_enhancd_cd_before.fish
3	3	------> function _enhancd_cd_before...
13	13	-----> :
14	14	----> builtin cd $argv
6	6	----> set code $status
119	252442	----> _enhancd_cd_after
49	52	-----> source /home/amir/.config/fish/functions/_enhancd_cd_after.fish
3	3	------> function _enhancd_cd_after...
8	8	-----> set -l IFS ""
158	248267	-----> set -l list (_enhancd_history_update)
96	248109	------> _enhancd_history_update
42	45	-------> source /home/amir/.config/fish/functions/_enhancd_history_update.fish
3	3	--------> function _enhancd_history_update...
3	3	-------> function sub...
513	247784	-------> sub \
        | _enhancd_filter_reverse \
        | _enhancd_filter_unique \
        | _enhancd_filter_reverse
43	46	--------> source /home/amir/.config/fish/functions/_enhancd_filter_reverse.fish
3	3	---------> function _enhancd_filter_reverse...
43	46	--------> source /home/amir/.config/fish/functions/_enhancd_filter_unique.fish
3	3	---------> function _enhancd_filter_unique...
228	97801	--------> _enhancd_filepath_list_step | _enhancd_filter_reverse
39	42	---------> source /home/amir/.config/fish/functions/_enhancd_filepath_list_step.fish
3	3	----------> function _enhancd_filepath_list_step...
4	20	---------> if not set -q argv[1]...
8	8	----------> not set -q argv[1]
8	8	----------> set argv[1] "$PWD"
104	48523	---------> _enhancd_command_awk \
        -f "$ENHANCD_ROOT/lib/step_by_step.awk" \
        -v dir="$argv[1]"
48	51	----------> source /home/amir/.config/fish/functions/_enhancd_command_awk.fish
3	3	-----------> function _enhancd_command_awk...
5	5	----------> set -l awk_cmd
15	47084	----------> if type -q gawk...
47048	47048	-----------> type -q gawk
21	21	-----------> set awk_cmd "gawk"
9	1279	----------> if set -q argv[1]...
4	4	-----------> set -q argv[1]
1266	1266	-----------> $awk_cmd $argv
157	48988	---------> if test -n "$argv[1]"; and test -f "$argv[1]"
        command cat "$argv[1]"
    else
        command cat <&0
    end \
        | _enhancd_command_awk -f "$ENHANCD_ROOT/lib/reverse.awk" \
        2>/dev/null
11	11	----------> test -n "$argv[1]"
671	671	----------> command cat <&0
10	10	----------> set -l awk_cmd
16	46910	----------> if type -q gawk...
46874	46874	-----------> type -q gawk
20	20	-----------> set awk_cmd "gawk"
9	1229	----------> if set -q argv[1]...
5	5	-----------> set -q argv[1]
1215	1215	-----------> $awk_cmd $argv
107	1627	--------> _enhancd_filepath_walk
53	57	---------> source /home/amir/.config/fish/functions/_enhancd_filepath_walk.fish
4	4	----------> function _enhancd_filepath_walk...
4	20	---------> if not set -q argv[1]...
7	7	----------> not set -q argv[1]
9	9	----------> set argv[1] $PWD
306	1443	---------> command find "$argv[1]" -maxdepth 1 -type d \
        | _enhancd_command_grep -v "\/\."
45	48	----------> source /home/amir/.config/fish/functions/_enhancd_command_grep.fish
3	3	-----------> function _enhancd_command_grep...
354	1089	----------> if test -n "$argv[1]"; and test -f "$argv[1]"
        command cat "$argv[1]"
    else
        command cat <&0
    end \
        | command grep -E $argv 2>/dev/null
12	12	-----------> test -n "$argv[1]"
6	6	-----------> test -f "$argv[1]"
717	717	-----------> command cat <&0
100	794	--------> _enhancd_history_open
51	54	---------> source /home/amir/.config/fish/functions/_enhancd_history_open.fish
3	3	----------> function _enhancd_history_open...
11	640	---------> if test -f $ENHANCD_DIR/enhancd.log...
14	14	----------> test -f $ENHANCD_DIR/enhancd.log
600	600	----------> command cat "$ENHANCD_DIR/enhancd.log"
15	15	----------> return $status
24	24	--------> echo "$HOME"
152	48902	--------> if test -n "$argv[1]"; and test -f "$argv[1]"
        command cat "$argv[1]"
    else
        command cat <&0
    end \
        | _enhancd_command_awk -f "$ENHANCD_ROOT/lib/reverse.awk" \
        2>/dev/null
10	10	---------> test -n "$argv[1]"
620	620	---------> command cat <&0
19	19	---------> set -l awk_cmd
15	46876	---------> if type -q gawk...
46840	46840	----------> type -q gawk
21	21	----------> set awk_cmd "gawk"
10	1225	---------> if set -q argv[1]...
5	5	----------> set -q argv[1]
1210	1210	----------> $awk_cmd $argv
151	49447	--------> if test -n "$argv[1]"; and test -f "$argv[1]"
        command cat "$argv[1]"
    else
        command cat <&0
    end | _enhancd_command_awk '!a[$0]++' 2>/dev/null
12	12	---------> test -n "$argv[1]"
646	646	---------> command cat <&0
8	8	---------> set -l awk_cmd
16	47402	---------> if type -q gawk...
47364	47364	----------> type -q gawk
22	22	----------> set awk_cmd "gawk"
9	1228	---------> if set -q argv[1]...
6	6	----------> set -q argv[1]
1213	1213	----------> $awk_cmd $argv
150	48584	--------> if test -n "$argv[1]"; and test -f "$argv[1]"
        command cat "$argv[1]"
    else
        command cat <&0
    end \
        | _enhancd_command_awk -f "$ENHANCD_ROOT/lib/reverse.awk" \
        2>/dev/null
11	11	---------> test -n "$argv[1]"
656	656	---------> command cat <&0
11	11	---------> set -l awk_cmd
15	46550	---------> if type -q gawk...
46511	46511	----------> type -q gawk
24	24	----------> set awk_cmd "gawk"
7	1206	---------> if set -q argv[1]...
6	6	----------> set -q argv[1]
1193	1193	----------> $awk_cmd $argv
104	181	-------> _enhancd_filepath_current_dir
51	55	--------> source /home/amir/.config/fish/functions/_enhancd_filepath_current_dir.fish
4	4	---------> function _enhancd_filepath_current_dir...
4	22	--------> if set -q PWD...
6	6	---------> set -q PWD
12	12	---------> echo "$PWD"
10	3983	-----> if test -n "$list"...
20	20	------> test -n "$list"
3953	3953	------> echo "$list" >"$ENHANCD_DIR/enhancd.log"
3	13	-----> if test -n "$ENHANCD_HOOK_AFTER_CD"...
10	10	------> test -n "$ENHANCD_HOOK_AFTER_CD"
6	6	----> return $code
4	4	---> return $status

The 46511 46511 ----------> type -q gawk looks incredibly high.

On my machine, this is what I get from fish --profile fishprof -ic 'type -q gawk'

Time	Sum	Command
474	474	> type -q gawk

What time do you get?

takes around 50ms!

image

here is the interesting thing - if i run the same command using root,
it takes micros

image

Interesting! Does type take as long with other executables (like awk)?

yes. around the same time for all executable files. takes micros for built in (type time etc.) or functions

Hmm. I think we've determined this is an issue with fish, not enhancd. Maybe try reinstalling fish?

If that doesn't fix it, I'd make an issue with the fish-shell people.

You could also try testing enhancd with bash or zsh, and seeing if the problem persists.

Enhancd takes around 62 ms in bash
image

I commented out the check type -q, and hard code to always use gawk (since it exists on my machine)
image

now it's taking around 120 ms in fish, which is not great, but good enough for me.
image

I agree with your conclusion. This is not a problem with enhancd.
I will follow up with fish.

Thanks for all the help!
You rock! :-)

So the guys in Fish pointed me in the right direction immediately.
See my comment here

Now I can finally get decent performance:
image

Can't thank you enough!