Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cd 'single dot' returns nothing when ENHANCD_USE_ABBREV is enabled #216

Open
BapRx opened this issue Jul 22, 2023 · 0 comments
Open

cd 'single dot' returns nothing when ENHANCD_USE_ABBREV is enabled #216

BapRx opened this issue Jul 22, 2023 · 0 comments

Comments

@BapRx
Copy link

BapRx commented Jul 22, 2023

What did you expect to happen?
cd . should open the fzf with a preview of the files present under my current directory.

What actually happened?
fzf opens without any path in input, not exiting automatically:

Output
image

Additional context

❯ env | grep ENHANCD_
ENHANCD_DIR=/home/baptiste/.enhancd
ENHANCD_ENABLE_DOUBLE_DOT=true
ENHANCD_ENABLE_SINGLE_DOT=true
ENHANCD_ENABLE_HYPHEN=true
ENHANCD_ENABLE_HOME=true
ENHANCD_ARG_DOUBLE_DOT=..
ENHANCD_ARG_SINGLE_DOT=.
ENHANCD_ARG_HYPHEN=-
ENHANCD_ARG_HOME=!
ENHANCD_HYPHEN_NUM=10
ENHANCD_COMPLETION_KEYBIND=^I
ENHANCD_COMPLETION_BEHAVIOR=default
ENHANCD_USE_ABBREV=true
ENHANCD_ROOT=/home/baptiste/.sheldon/repos/github.com/b4b4r07/enhancd
_ENHANCD_VERSION=2.5.1
ENHANCD_COMMAND=cd
ENHANCD_FILTER=fzy:fzf:peco:sk:zf

If I run manually the commands:

❯ filter="$(__enhancd::helper::parse_filter_string "${ENHANCD_FILTER}")"echo $filter
fzf
❯ filter="__enhancd::filter::replace ${HOME} \~ | ${filter} | __enhancd::filter::replace \~ ${HOME}"echo $filter
__enhancd::filter::replace /home/baptiste \~ | fzf | __enhancd::filter::replace \~ /home/baptiste
❯ __enhancd::sources::current_dirs
Screenshots/
test/
❯ __enhancd::sources::current_dirs | eval "${filter}"
  ❯
    0/0 (0)
❯ cd .
  ❯
    0/0 (0)

If I disable ENHANCD_USE_ABBREV it works:

export ENHANCD_USE_ABBREV=false
❯ cd .
  ❯
    2/2 (0)
    ▶ Screenshots/
    ▶ test/

The issue seems to be related to the __enhancd::filter::replace function

❯ __enhancd::sources::current_dirs | __enhancd::filter::replace ${HOME} \~echo $?
0

I personnaly don't need that function at all since I handle it in my FZF filter (I simplified the filter for the demo). My filter works great with the home abbrev enabled:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant