Created
July 21, 2022 15:04
-
-
Save tjdevries/8968cadee0bcaed5aa85bd18961029da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local sorter = require("telescope").extensions.fzf.native_fzf_sorter() | |
-- Save original scoring function to get the score | |
local fzf_scoring_function = sorter.scoring_function | |
-- Override function to do whatever you want. | |
-- Telescope is just functions | |
sorter.scoring_function = function(self, prompt, line) | |
local score = fzf_scoring_function(self, prompt, line) | |
-- line is the file entry, you could get the full line filename, etc. | |
if vim.startswith(line, "/home/tjdevries/example") then | |
score = score * 2 | |
end | |
return score | |
end | |
require("telescope.builtin").find_files { | |
sorter = sorter, | |
-- ... other options here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment