Awesome
ido.nvim
Simple fuzzy searcher for Neovim
Install
Plug 'shoumodip/ido.nvim'
Basic Usage
ido.start(items, callback, title)
require("ido").start({"red", "green", "blue"}, function (v)
print(v)
end)
Key | Description |
---|---|
<kbd><esc></kbd> | Quit |
<kbd><c-c></kbd> | Quit |
<kbd><c-j></kbd> | Accept the query |
<kbd><cr></kbd> | Accept the selection |
<kbd><tab></kbd> | Select next item |
<kbd><s-tab></kbd> | Select previous item |
Execute
Execute registered ido functions, which are listed below
require("lua").execute()
Browse
Navigate the filesystem
require("ido").browse()
Key | Description |
---|---|
<kbd><a-l></kbd> | Enter directory |
<kbd><a-h></kbd> | Parent directory |
<kbd><a-o></kbd> | Change directory to current active |
Buffers
Switch between buffers
require("ido").buffers()
Colorschemes
Switch between colorschemes
require("ido").colorschemes()
Git Files
Open git files, default to Browser outside git repos
require("ido").git_files()
Git Grep
Search patterns in git repos
require("ido").git_grep()
Key | Description |
---|---|
<kbd><a-o></kbd> | Save matches to the quickfix list |
Projects
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 prompt
Man Pages
Open man pages
require("ido").man_pages()
Helptags
Open vim helptags
require("ido").helptags()
Global Keybindings
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,
}
Instance Keybindings
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
}
Custom Window Title
require("ido").start({"red", "green", "blue"}, print, "Select Colors")
Custom Registered Function
Registered functions show up in the ido.execute
selector as well as in the
ido
namespace
local ido = require("ido")
ido.register("lines", function ()
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
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")
end)
This function can now be called with both the following ways
require("ido").lines()
OR
require("ido").execute()