diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2021-08-20 11:11:24 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-20 11:11:24 -0400 |
| commit | a97af306c4e9c9a6fa7c886c0ffe3079822c5203 (patch) | |
| tree | f5e2b50a767e93618d0d8fdddb8a964c90633c8a /scratch/example.lua | |
| parent | d6d28dbe324de9826a579155076873888169ba0f (diff) | |
feat(performance): Major performance improvements using async v2 from @oberblastmeister (#987)
* start: Working w/ async jobs
* short circuit to using bad finder if you pass writer.
Diffstat (limited to 'scratch/example.lua')
| -rw-r--r-- | scratch/example.lua | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/scratch/example.lua b/scratch/example.lua deleted file mode 100644 index 19952dc..0000000 --- a/scratch/example.lua +++ /dev/null @@ -1,68 +0,0 @@ - -local finder = Finder:new { - 'rg %s -l', - pipeable = true, - ... -} - -local filter = Filter:new { - "fzf --filter '%s'" -} - -local lua_filter = Filter:new { - function(input, line) - if string.match(line, input) then - return true - end - - return false - end -} - - -local picker_read = Picker:new { - filter = filter, - - previewer = function(window, buffer, line) - local file = io.open(line, "r") - - local filename = vim.split(line, ':')[1] - if vim.fn.bufexists(filename) then - vim.api.nvim_win_set_buf(window, vim.fn.bufnr(filename)) - return - end - - local lines = {} - for _ = 1, 100 do - table.insert(lines, file:read("l")) - - -- TODO: Check if we're out of lines - end - - -- optionally set the filetype or whatever... - vim.api.nvim_buf_set_lines(buffer, 0, -1, false, lines) - end, - - mappings = { - ["<CR>"] = function(line) - vim.cmd(string.format('e ', vim.split(line, ':'))) - end, - }, -} - -local picker = Picker:new { - filter = filter, - - -- idk - previewer = function(window, line) - vim.api.nvim_win_set_current_window(window) - - -- if is_file_loaded(line) then - -- lien_number = vim.api.nvim_... - - vim.fn.termopen(string.format( - 'bat --color=always --style=grid %s', - vim.split(line, ':')[1] - )) - end -} |
