natecraddock / telescope-zf-native.nvim Goto Github PK
View Code? Open in Web Editor NEWnative telescope bindings to zf for sorting results
License: MIT License
native telescope bindings to zf for sorting results
License: MIT License
When two paths rank the same, telescope will keep the results in the same order as given. That means that results like this are possible. It is preferable to match the shorter path, and then require an extra query term to match the longer path.
Thanks for this sorter, it's definitely an improvement which definitely deserves to be more popular.
So one issue I have is the initial sorting of results. It seems that when the query is empty, this sorter just passes the results from fd
through without any sorting.
This initial order is often not desirable, as this results for example in Makefile
and README
always being placed at the top, even though they are files that are rarely accessed in comparison to other files.
One reasonable solution would be to sort specific files further to the top, e.g. prioritizing lua, js, py files over md and Makefiles. Since there are probably quite diverse preferences for initial sorting, it might also make sense to offer an option for an initial-sorting-function, working similarly to telescope's tiebreaker
.
For reference and more details, see also the issue I opened at the telescope repo: nvim-telescope/telescope.nvim#2905
Since nvim-telescope/telescope.nvim#2909, we will get the following error when we do :Telescope current_buffer_fuzzy_find
.
E5108: Error executing lua: ...plugins/telescope.nvim/lua/telescope/builtin/__files.lua:549: bad argument #1 to 'unpack'
(table expected, got nil)
stack traceback:
[C]: in function 'unpack'
...plugins/telescope.nvim/lua/telescope/builtin/__files.lua:549: in function 'run_replace_or_original'
...epro/plugins/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'
....repro/plugins/telescope.nvim/lua/telescope/mappings.lua:269: in function <....repro/plugins/telescope.nvim/l
ua/telescope/mappings.lua:268>
To reproduce this error:
local root = vim.fn.fnamemodify('./.repro', ':p')
for _, name in ipairs({ 'config', 'data', 'state', 'cache' }) do
vim.env[('XDG_%s_HOME'):format(name:upper())] = root .. '/' .. name
end
local lazypath = root .. '/plugins/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
local plugins = {
'folke/tokyonight.nvim',
{
'nvim-telescope/telescope.nvim',
commit = 'fac5da839e23e7a4c17a332a640541cd59ebfbd5',
lazy = false,
dependencies = {
'nvim-lua/plenary.nvim',
'natecraddock/telescope-zf-native.nvim',
},
config = function()
require('telescope').setup({
extensions = { ['zf-native'] = { generic = { enable = true } } },
})
require('telescope').load_extension('zf-native')
end,
},
}
require('lazy').setup(plugins, { root = root .. '/plugins' })
vim.cmd.colorscheme('tokyonight')
Hey, thanks so much for this plugin, it has greatly improved my telescope
experience :)
This is somewhat similar to #10 requests but based on a different criteria. If say I'm working in a large repo with a large amount of files that have the same name:
dir_a/
- file_1
- file_2
dir_b/
- file_1
- file_2
I would love to configure the sorting such that if I'm in dir_b/file_1
and I open Telescope and type file_2
, the closest selection in Telescope is dir_b/file_2
even though alphabetically dir_a/
might be sooner.
Is that something achievable in the current sorting configuration or will I need to drop down and fiddle with Telescope comps myself? Thanks! :)
Hey. ๐
I've been using this sorter for quite some time, and been very happy with it. Lately, I have been wanting to turn off the default smart casing though.
Would it be possible to add an option to enforce the result to be case sensitive?
All the best!
First of all, thank you for the zf project. I really like it!
The issue I'm facing is that I can't seem to get the same results for the Telescope plugin when searching with an additional space-delimited token. Here are the screenshots I took with ZF (git ls-files
and fd
) and Telescope:
MacOS 14.3
nvim 0.9.5
zf-native: require("zf-native.health").check()
Installation ~
- libzf library path: .../lib/libzf-osx-arm64.so
- OK libzf path is valid
Configuration
- zf telescope file sorter enabled
- highlights: true
- filename score priority: true
- zf telescope generic sorter enabled
- highlights: true
- filename score priority: false ~
Picker settings:
pickers = {
find_files = {
theme = "dropdown",
find_command = {
"fd",
"--type",
"f",
"--color=never",
"--hidden",
"--follow",
"-E",
".git/*",
},
Thank you in advance
Hi! I hope you are all doing well!
I no longer use Neovim regularly, but I really would like to keep this plugin alive. It's been really simple to maintain, but I worry about the long-term.
So I'm looking for someone willing to step in and maintain this plugin. Either
I think the second is the simplest, and no one has to update their configs to point to a new repository.
If no one steps up, I will try my best to make sure this works for as long as possible. But I won't make any promises. If a future Neovim release would cause an unreasonable amount of work for me to update this plugin, I probably wouldn't update it.
Sorry if that's sad news for anyone, and I apologize if this breaks someone's workflow someday. I don't think this plugin will stop working anytime soon, but if it does... ๐ฌ
Probably the biggest risk in this breaking is a breaking change to Telescope.
hey, there
great plugin y'all got going here. I use it everyday and it works real good
One thing I noticed is that, when used with https://github.com/nvim-telescope/telescope-frecency.nvim the candidates will get re-ordered as the user types an input.
I don't exactly know the sorting algorithm that gets used, but, while prioritizing basename as expected, the relative order of candidates won't stick.
I've tried this by inputting "wiki" to match the .wiki extension and the order between wiki files changes. Matching for my input works because I have no "wiki.something" path and "/some/path/file.wiki" has priority over "/wiki/path/file.something", but "/file/I/access/a/lot.wiki" will have lower priority "/other/file/I/have/visited/once.wiki"
I hope I've described the problem ok
If any query string contains uppercase letters no search results are returned. From the same directory using fd -t f | zf
and uppercase letters works fine, so it seems the bug is in the interface between telescope and libzf, not in zf itself.
I noticed that the initial_sort
for files also affects the oldfiles
picker. This is somewhat unfortunate, since oldfiles
is the one picker where the initial order of files actually makes sense as they are sorted by recency.
Applying the initial sort here basically makes the oldfiles picker worse. Could the oldfiles picker therefore be excluded from initial_sort
?
Love your algorithm, sometimes fzf gets very annoying. I'm already getting better matches in the terminal!
The zf repo generates an executable, how do I build the library?
Hi,
Would you consider packaging this nvim plugin to LuaRocks so that the package manager rocks.nvim can detect it?
The rocks.nvim
team prepared a github action that automates this process.
I guess your algorithm is simpler to have better performance? Would be nice to have some numbers.
See https://github.com/nvim-telescope/telescope.nvim/wiki/Extensions#sorter
Hi, I love your sorter! Finally something which prioritizes the proper parts in paths.
But I would like to merge three pickers which I often use and I hate that I need THREE of them separately:
I think that if I can prioritize recently used buffers/files in the sorted result then I don't have to switch between pickers.
Is that already possible with your sorter or not? :) Or if you can point me to the right direction where I should investigate of how to do it..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.