diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-08-03 20:40:04 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-08-03 20:40:04 -0400 |
| commit | 96cac0a8c861d5cdb1bb7765cc2d20e47ebb7885 (patch) | |
| tree | 43edecaeef53e683cdacc9588c75817d62f7844f /scratch/file_finder.lua | |
| parent | fa0382d93e73b66e7ec769cec27b9fbb21020641 (diff) | |
Work on ngram sorter
Diffstat (limited to 'scratch/file_finder.lua')
| -rw-r--r-- | scratch/file_finder.lua | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/scratch/file_finder.lua b/scratch/file_finder.lua index ae84e2f..bf3c411 100644 --- a/scratch/file_finder.lua +++ b/scratch/file_finder.lua @@ -1,4 +1,3 @@ -package.loaded['telescope.pickers'] = nil local telescope = require('telescope') -- Goals: @@ -40,38 +39,34 @@ fzf_job.stdin = ls_files_job.stdout --]] -local string_distance = require('telescope.algos.string_distance') local file_finder = telescope.finders.new { - fn_command = function(self, prompt) - -- todo figure out how to cache this later - if false then - if self[prompt] == nil then - self[prompt] = nil - end - - return self[prompt] - else - return 'git ls-files' - end + static = true, + + -- self, prompt + fn_command = function() + return 'git ls-files' end, } -local file_sorter = telescope.sorters.new { - scoring_function = function(self, prompt, line) - if prompt == '' then return 0 end - if not line then return -1 end - - return tonumber(vim.fn.systemlist(string.format( - "echo '%s' | ~/tmp/fuzzy_test/target/debug/fuzzy_test '%s'", - line, - prompt - ))[1]) - end -} +local file_sorter = telescope.sorters.get_ngram_sorter() + +-- local string_distance = require('telescope.algos.string_distance') +-- new { +-- scoring_function = function(self, prompt, line) +-- if prompt == '' then return 0 end +-- if not line then return -1 end + +-- return tonumber(vim.fn.systemlist(string.format( +-- "echo '%s' | ~/tmp/fuzzy_test/target/debug/fuzzy_test '%s'", +-- line, +-- prompt +-- ))[1]) +-- end +-- } -local file_previewer = telescope.previewers.vim_buffer +local file_previewer = telescope.previewers.vim_buffer_or_bat local file_picker = telescope.pickers.new { previewer = file_previewer |
