Simple fuzzy searcher for Neovim
Plug 'shoumodip/ido.nvim'ido.start(items, callback, title)
require("ido").start({"red", "green", "blue"}, function (v)
print(v)
end)| Key | Description |
|---|---|
| <esc> | Quit |
| <c-c> | Quit |
| <c-j> | Accept the query |
| <cr> | Accept the selection |
| <tab> | Select next item |
| <s-tab> | Select previous item |
Execute registered ido functions, which are listed below
require("lua").execute()Navigate the filesystem
require("ido").browse()| Key | Description |
|---|---|
| <a-l> | Enter directory |
| <a-h> | Parent directory |
| <a-o> | Change directory to current active |
Switch between buffers
require("ido").buffers()Search the lines of the current buffer
require("ido").lines()| Key | Description |
|---|---|
| <a-o> | Save matches to the quickfix list |
Switch between colorschemes
require("ido").colorschemes()Open git files, default to Browser outside git repos
require("ido").git_files()Search patterns in git repos
require("ido").git_grep()| Key | Description |
|---|---|
| <a-o> | Save matches to the quickfix list |
Switch to a project within a directory
require("ido").projects("~/Git") -- Projects base path of choice
-- OR --
require("ido").projects() -- Select projects base path via input promptOpen man pages
require("ido").man_pages()Open vim helptags
require("ido").helptags()Will bind for all Ido runs
local ido = require("ido")
ido.bind {
["jk"] = ido.exit,
["<c-j>"] = ido.next,
["<c-k>"] = ido.prev,
["<tab>"] = ido.accept_item,
}Will bind for the current run only
local ido = require("ido")
ido.git_files()
ido.bind {
["<a-i>"] = function ()
vim.fn.mkdir(ido.get_query())
end
}require("ido").start({"red", "green", "blue"}, print, "Select Colors")Registered functions show up in the ido.execute selector as well as in the
ido namespace
local ido = require("ido")
ido.register("lines_that_match", function ()
local query = vim.fn.input("Query: ")
if query == "" then
return
end
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
local max = #tostring(#lines)
for i in ipairs(lines) do
lines[i] = string.rep(" ", max - #tostring(i))..i..": "..lines[i]
end
lines = vim.tbl_filter(
function (line)
return string.find(line, query, max + 2, true)
end,
lines
)
ido.start(lines, function (line)
local index = line:find(":")
if index then
vim.api.nvim_win_set_cursor(0, {tonumber(line:sub(1, index - 1)), 0})
end
end, "Lines That Match")
end)This function can now be called with both the following ways
require("ido").lines_that_match()OR
require("ido").execute()