chore: remove media and scratch directory
This commit is contained in:
committed by
Simon Hauser
parent
edc6f55ba2
commit
7648e5d891
@@ -1,47 +0,0 @@
|
|||||||
local finders = require('telescope.finders')
|
|
||||||
local previewers = require('telescope.previewers')
|
|
||||||
local pickers = require('telescope.pickers')
|
|
||||||
local sorters = require('telescope.sorters')
|
|
||||||
|
|
||||||
-- Get all the items from v:oldfiles that are valid files
|
|
||||||
local valid_oldfiles = vim.tbl_filter(function(val)
|
|
||||||
return 0 ~= vim.fn.filereadable(val)
|
|
||||||
end, vim.v.oldfiles)
|
|
||||||
|
|
||||||
-- print(vim.inspect(valid_oldfiles))
|
|
||||||
-- => {
|
|
||||||
-- "/home/tj/blah.txt",
|
|
||||||
-- "/home/tj/another_dir/file.py",
|
|
||||||
-- ...
|
|
||||||
-- }
|
|
||||||
|
|
||||||
-- Create a finder from a Lua list.
|
|
||||||
local oldfiles_finder = finders.new_table(valid_oldfiles)
|
|
||||||
|
|
||||||
-- Get a pre-defined sorter.
|
|
||||||
-- Sorters return a "score" for each "Entry" found by a finder.
|
|
||||||
--
|
|
||||||
-- This sorter is optimized to best find files in a fuzzy manner.
|
|
||||||
local oldfiles_sorter = sorters.get_fuzzy_file()
|
|
||||||
|
|
||||||
-- Get a pre-defined previewer.
|
|
||||||
-- Previewers take the currently selected entry,
|
|
||||||
-- and put a preview of it in a floating window
|
|
||||||
local oldfiles_previewer = previewers.cat
|
|
||||||
|
|
||||||
-- Create and run a Picker.
|
|
||||||
-- Pickers are the main entry point to telescope.
|
|
||||||
-- They manage the interactions between:
|
|
||||||
-- Finder,
|
|
||||||
-- Sorter,
|
|
||||||
-- Previewer
|
|
||||||
--
|
|
||||||
-- And provide the UI for the user.
|
|
||||||
pickers.new {
|
|
||||||
prompt = 'Oldfiles',
|
|
||||||
finder = oldfiles_finder,
|
|
||||||
sorter = oldfiles_sorter,
|
|
||||||
previewer = oldfiles_previewer,
|
|
||||||
}:find()
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
local finders = require('telescope.finders')
|
|
||||||
local previewers = require('telescope.previewers')
|
|
||||||
local pickers = require('telescope.pickers')
|
|
||||||
|
|
||||||
-- Create a new finder.
|
|
||||||
-- This finder, rather than taking a Lua list,
|
|
||||||
-- generates a shell command that should be run.
|
|
||||||
--
|
|
||||||
-- Each line of the shell command is converted to an entry,
|
|
||||||
-- and is possible to preview with builtin previews.
|
|
||||||
--
|
|
||||||
-- In this example, we use ripgrep to search over your entire directory
|
|
||||||
-- live as you type.
|
|
||||||
local live_grepper = finders.new_job(function(prompt)
|
|
||||||
if not prompt or prompt == "" then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
return { 'rg', "--vimgrep", prompt}
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Create and run the Picker.
|
|
||||||
--
|
|
||||||
-- NOTE: No sorter is needed to be passed.
|
|
||||||
-- Results will be returned in the order they are received.
|
|
||||||
pickers.new({
|
|
||||||
prompt = 'Live Grep',
|
|
||||||
finder = live_grepper,
|
|
||||||
previewer = previewers.vimgrep,
|
|
||||||
}):find()
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
### Simple demo to show the rg stuff
|
|
||||||
## key_delay 1
|
|
||||||
## feed_full
|
|
||||||
|
|
||||||
:e! ./scratch/simple_rg.lua\<CR>
|
|
||||||
:set foldlevel=100\<CR>
|
|
||||||
:luafile %\<CR>
|
|
||||||
|
|
||||||
## pause
|
|
||||||
## key_delay 80
|
|
||||||
|
|
||||||
Finder
|
|
||||||
|
|
||||||
## key_delay 150
|
|
||||||
|
|
||||||
\<c-n>
|
|
||||||
|
|
||||||
## pause
|
|
||||||
\<c-n>
|
|
||||||
|
|
||||||
## pause
|
|
||||||
\<c-n>
|
|
||||||
|
|
||||||
## pause
|
|
||||||
\<cr>
|
|
||||||
|
|
||||||
## pause
|
|
||||||
\<esc>
|
|
||||||
:" Went to the file!\<esc>
|
|
||||||
|
|
||||||
## pause
|
|
||||||
|
|
||||||
## feed_full
|
|
||||||
:qa!\<CR>
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
+-------------------------------------------------------------------+
|
|
||||||
| Picker:find()--------------------+ +------>Picker |
|
|
||||||
| | ^ | | |
|
|
||||||
| | | v | |
|
|
||||||
| | +----------------+ +----------------+ |
|
|
||||||
| +->| Finder + | Sorter | |
|
|
||||||
| +----------------+ +----------------+ |
|
|
||||||
| [1] |
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
+-------------------------------------------------------------------+
|
|
||||||
|
|
||||||
Picker starts a `finder`.
|
|
||||||
Finder returns a list of `entries` to Picker.
|
|
||||||
Picker can optionally sort w/ `Sorter`.
|
|
||||||
Picker can optionally preview selected with `Previewer`
|
|
||||||
|
|
||||||
Then you can map stuff in the picker to decide what to do next.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
local actions = require('telescope.actions')
|
|
||||||
local finders = require('telescope.finders')
|
|
||||||
local previewers = require('telescope.previewers')
|
|
||||||
local pickers = require('telescope.pickers')
|
|
||||||
local sorters = require('telescope.sorters')
|
|
||||||
local utils = require('telescope.utils')
|
|
||||||
|
|
||||||
local Job = require('plenary.job')
|
|
||||||
|
|
||||||
-- local live_grepper = finders.new {
|
|
||||||
-- fn_command = function(_, prompt)
|
|
||||||
-- -- TODO: Make it so that we can start searching on the first character.
|
|
||||||
-- if not prompt or prompt == "" then
|
|
||||||
-- return nil
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- return {
|
|
||||||
-- command = 'rg',
|
|
||||||
-- args = {"--vimgrep", prompt},
|
|
||||||
-- }
|
|
||||||
-- end
|
|
||||||
-- }
|
|
||||||
|
|
||||||
local f = function(prompt, process_result, process_complete)
|
|
||||||
local fzf = Job:new {
|
|
||||||
command = 'fzf';
|
|
||||||
|
|
||||||
writer = Job:new {
|
|
||||||
command = "fdfind",
|
|
||||||
args = nil,
|
|
||||||
cwd = "/home/tj/build/neovim",
|
|
||||||
|
|
||||||
enable_handlers = false,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Still doesn't work if you don't pass these args and just run `fzf`
|
|
||||||
args = {'--no-sort', '--filter', prompt};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local start = vim.fn.reltime()
|
|
||||||
print(vim.inspect(fzf:sync()), vim.fn.reltimestr(vim.fn.reltime(start)))
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Process all the files
|
|
||||||
-- f("", nil, nil)
|
|
||||||
-- Filter on nvimexec
|
|
||||||
f("nvim/executor", nil, nil)
|
|
||||||
|
|
||||||
-- pickers.new({}, {
|
|
||||||
-- prompt = 'Live Grep',
|
|
||||||
-- finder = f,
|
|
||||||
-- previewer = previewers.vimgrep,
|
|
||||||
-- }):find()
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
RELOAD('telescope')
|
|
||||||
RELOAD('plenary')
|
|
||||||
|
|
||||||
local finders = require('telescope.finders')
|
|
||||||
local make_entry = require('telescope.make_entry')
|
|
||||||
local pickers = require('telescope.pickers')
|
|
||||||
local sorters = require('telescope.sorters')
|
|
||||||
|
|
||||||
local Job = require('plenary.job')
|
|
||||||
|
|
||||||
pickers.new {
|
|
||||||
prompt = "Piped FZF",
|
|
||||||
|
|
||||||
finder = finders._new {
|
|
||||||
fn_command = function(_, prompt)
|
|
||||||
return {
|
|
||||||
command = 'fzf',
|
|
||||||
args = {'--no-sort', '--filter', prompt or ''},
|
|
||||||
|
|
||||||
writer = Job:new {
|
|
||||||
command = 'rg',
|
|
||||||
args = {'--files'},
|
|
||||||
cwd = '/home/tj/',
|
|
||||||
|
|
||||||
enable_handlers = false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
|
|
||||||
entry_maker = make_entry.gen_from_file(),
|
|
||||||
sorter = sorters.get_fuzzy_file(),
|
|
||||||
},
|
|
||||||
}:find()
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
|
|
||||||
echo "hello"
|
|
||||||
sleep 1
|
|
||||||
echo "help"
|
|
||||||
sleep 1
|
|
||||||
echo "hi"
|
|
||||||
sleep 1
|
|
||||||
echo "husband"
|
|
||||||
sleep 1
|
|
||||||
echo "helper"
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user