flutter_ecommerce_app icon indicating copy to clipboard operation
flutter_ecommerce_app copied to clipboard

Invoke fzf with tab completion in zsh

Open protist opened this issue 4 years ago • 4 comments

I understand that you can use tab completion in both zsh and bash. For bash, you can change the z.lua initialisation to invoke fzf, but this doesn't seem to work for zsh.

(I don't run bash, but if I understand correctly, z -I foo works the same as the bash tab-completion.) Using fzf lists the candidates in order of frecency. However, the zsh tab-completion appears to list candidates in alphabetical order instead. Is it possible to make the zsh tab-completion use fzf?

protist avatar Mar 26 '20 10:03 protist

The bundled zsh plugin doesn't auto-detect fzf installation. z.lua.plugin.zsh#L25

How about auto use fzf when it's found in the path, or add an option to let the user choose.

mmqmzk avatar Apr 23 '20 11:04 mmqmzk

The bundled zsh plugin doesn't auto-detect fzf installation. z.lua.plugin.zsh#L25

How about auto use fzf when it's found in the path, or add an option to let the user choose.

Sorry, I was wrong, it's not the zsh plugin's problem, the Lua code does not contain init script for zsh fzf complete.

According to FZF's wiki, define a function _fzf_complete_z may help, but it seems to have a limitation, users have to type the complete trigger (default to **) then press tab to trigger completion. I'll take some more research to see if I can make a pull request.

mmqmzk avatar Apr 23 '20 12:04 mmqmzk

I find this plugin fzf-tab, turn default zsh complete menu to fzf. Solved my problem.

mmqmzk avatar Apr 24 '20 09:04 mmqmzk

Thanks for the comments @mmqmzk . Unfortunately fzf-tab is a bit too much for me. I don't want to replace tab-completion everywhere! Hopefully this is useful for other people though.

protist avatar Apr 24 '20 10:04 protist