junegunn / fzf

:cherry_blossom: A command-line fuzzy finder
https://junegunn.github.io/fzf/
MIT License
61.81k stars 2.35k forks source link

Cannot exclude symbolic links from search #3857

Closed rudvfaden closed 3 weeks ago

rudvfaden commented 3 weeks ago

Checklist

Output of fzf --version

0.53.0 (c4a9ccd)

OS

Shell

Problem / Steps to reproduce

fzf still seems to follow symbolic links. I have several links to large folders that are searched.

I also tried to add the folders to --walker-skip, but that still does not work.

junegunn commented 3 weeks ago

fzf still seems to follow symbolic links.

Yes, that's the default.

   Directory traversal
       --walker=[file][,dir][,follow][,hidden]
              Determines the behavior of the built-in directory walker that is used when
              $FZF_DEFAULT_COMMAND is not set. The default value is file,follow,hidden.

              * file: Include files in the search result
              * dir: Include directories in the search result
              * hidden: Include and follow hidden directories
              * follow: Follow symbolic links

I also tried to add the folders to --walker-skip, but that still does not work.

And please provide the exact steps to reproduce the problem.

rudvfaden commented 3 weeks ago

Thanks for a very quick reply.

I add this to .zhsrc

export FZF_CTRL_T_OPTS="
  --walker-skip .git,node_modules,target,o_drev_da1943,analyse,batch,Dataudveksling,eg_source
  --preview 'bat -n --color=always {}'
  --bind 'ctrl-/:change-preview-window(down|hidden|)'"

When i pres CTRL + T i still get results for e.g. analyse in my results. the folder analyse is a symbolig link.

junegunn commented 3 weeks ago

Do you also have FZF_CTRL_T_COMMAND? If the variable is defined, fzf will use it instead of its built-in walker.

rudvfaden commented 3 weeks ago

Sorry. It seems no to work either way

junegunn commented 3 weeks ago

Okay, I can see what's going on. --walker-skip is applied to directories, and currently, it is not applied to a "symlink" to a directory. I agree that this is confusing. I'll look into it.

Anyway, if you don't want fzf to follow symlinks, consider setting --walker instead of --walker-skip.

export FZF_DEFAULT_OPTS='--walker file,hidden
rudvfaden commented 3 weeks ago

So that file is a list of folders that should be included? Think that will be hard to maintian.

But thanks for your reply. Cool if it can be implemented in a comming release.

junegunn commented 3 weeks ago

Directory traversal --walker=[file][,dir][,follow][,hidden] Determines the behavior of the built-in directory walker that is used when $FZF_DEFAULT_COMMAND is not set. The default value is file,follow,hidden.

          * file: Include files in the search result
          * dir: Include directories in the search result
          * hidden: Include and follow hidden directories
          * follow: Follow symbolic links

No, file means walker should list "files", it's a type.

rudvfaden commented 3 weeks ago

So If I set it to file,dir,hidden it will not follow symbolic links?

On Thu, 13 June 2024, 15:09 Junegunn Choi, @.***> wrote:

Directory traversal --walker=[file][,dir][,follow][,hidden] Determines the behavior of the built-in directory walker that is used when $FZF_DEFAULT_COMMAND is not set. The default value is file,follow,hidden.

      * file: Include files in the search result
      * dir: Include directories in the search result
      * hidden: Include and follow hidden directories
      * follow: Follow symbolic links

— Reply to this email directly, view it on GitHub https://github.com/junegunn/fzf/issues/3857#issuecomment-2165623581, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASVCCJVCONHO3PFV6UZTV3ZHGKXHAVCNFSM6AAAAABJIHQWXWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRVGYZDGNJYGE . You are receiving this because you modified the open/close state.Message ID: @.***>

junegunn commented 3 weeks ago

Correct.