telescope-frecency.nvim icon indicating copy to clipboard operation
telescope-frecency.nvim copied to clipboard

FZF Like Anchors/Selectors

Open joshuarubin opened this issue 2 years ago • 5 comments

This plugin is great! One thing I really miss though is that since this is implemented essentially as a sorter (with underlying matching done just with substrings) I lose all the intelligence of the grammar I have with my default sorter (fzf-native). Primarily, I miss being able to use ^ (consecutive chars at the beginning of the match), ' (consecutive chars anywhere in the match) and $ (consecutive chars at the end of the match.

Is there any way I can regain this functionality? Thanks!

joshuarubin avatar Sep 17 '21 15:09 joshuarubin

You can just override the sorter. This for example to set your configured default file sorter

:lua require'telescope'.extensions.frecency.frecency{ sorter = require('telescope.config').values.file_sorter() }

Conni2461 avatar Sep 17 '21 16:09 Conni2461

Interesting. This works, but the displayed results are shortened, though I'm only able to match against absolute paths, so I always have to match with things like ^/ even though that might not be displayed in the result.

Edit: using the command:

require("telescope").extensions.frecency.frecency({ sorter = require("telescope").extensions.fzf.native_fzf_sorter() })

joshuarubin avatar Sep 17 '21 16:09 joshuarubin

I wonder if the sorter could be a config option instead?

lougreenwood avatar Dec 21 '21 09:12 lougreenwood

https://github.com/nvim-telescope/telescope-frecency.nvim/issues/44 shows how to use other sorter

if you're using https://github.com/natecraddock/telescope-zf-native.nvim , after setup, you can use the following code to use zf as sorter (prioritizes basename/file_name)

    require  'telescope'.extensions.frecency.frecency({
      sorter = require  'telescope.config'.values.file_sorter(),

require 'telescope.config'.values.file_sorter is modified by telescope-zf-native, so this is actually another sorter that we're using (not get_fzy_sorter). But, anyway... it gives you an idea of how to use a non-default sorter with this extension

FelipeLema avatar Jul 15 '22 13:07 FelipeLema

@FelipeLema thanks for that, i was actually wondering exactly how to use this with zf-native :)

mizlan avatar Apr 23 '23 03:04 mizlan