summaryrefslogtreecommitdiff
path: root/scratch
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-08-03 20:40:04 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-08-03 20:40:04 -0400
commit96cac0a8c861d5cdb1bb7765cc2d20e47ebb7885 (patch)
tree43edecaeef53e683cdacc9588c75817d62f7844f /scratch
parentfa0382d93e73b66e7ec769cec27b9fbb21020641 (diff)
Work on ngram sorter
Diffstat (limited to 'scratch')
-rw-r--r--scratch/file_finder.lua47
-rw-r--r--scratch/picker_locations.lua3
2 files changed, 24 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
diff --git a/scratch/picker_locations.lua b/scratch/picker_locations.lua
index 82fe7f7..251b617 100644
--- a/scratch/picker_locations.lua
+++ b/scratch/picker_locations.lua
@@ -1,4 +1,7 @@
+-- Hot reload stuff
package.loaded['telescope'] = nil
package.loaded['telescope.init'] = nil
package.loaded['telescope.picker'] = nil
package.loaded['telescope.finder'] = nil
+
+