1
Fork 0
satellite/dotfiles/neovim/lua/my/plugins/telescope.lua

53 lines
1.1 KiB
Lua
Raw Normal View History

local arpeggio = require("my.plugins.arpeggio")
local M = {}
2022-09-25 22:03:11 +02:00
local function find_files_by_extension(extension)
return "find_files find_command=rg,--files,--glob=**/*." .. extension
end
2022-09-25 22:03:11 +02:00
local keybinds = {
{ "<C-P>", "find_files" },
{ "<Leader>ft", find_files_by_extension("tex") },
{ "<Leader>fl", find_files_by_extension("lua") },
{ "<C-F>", "live_grep" },
{ "<Leader>t", "builtin" },
}
2022-09-25 22:03:11 +02:00
local chords = {
{ "jp", "file_browser" }
}
2022-09-25 22:03:11 +02:00
local function mkAction(action)
return ":Telescope " .. action .. "<cr>"
end
2022-09-25 22:03:11 +02:00
local function setupKeybinds()
for _, mapping in pairs(keybinds) do
vim.keymap.set("n", mapping[1], mkAction(mapping[2]))
end
2022-08-08 16:25:54 +02:00
2022-09-25 22:03:11 +02:00
for _, mapping in pairs(chords) do
arpeggio.chord("n", mapping[1], mkAction(mapping[2]))
2022-08-08 16:25:54 +02:00
end
2022-02-22 21:52:01 +01:00
end
2022-02-22 21:52:01 +01:00
function M.setup()
2022-09-25 22:03:11 +02:00
setupKeybinds()
2022-02-22 21:52:01 +01:00
2022-08-08 16:25:54 +02:00
local settings = {
defaults = { mappings = { i = { ["<C-h>"] = "which_key" } } },
pickers = { find_files = { hidden = true } },
extensions = {
file_browser = {
2022-09-25 22:03:11 +02:00
path = "%:p:h"
2022-08-08 16:25:54 +02:00
}
2022-02-22 21:52:01 +01:00
}
2022-08-08 16:25:54 +02:00
}
2022-02-22 21:52:01 +01:00
2022-08-08 16:25:54 +02:00
require("telescope").setup(settings)
require("telescope").load_extension "file_browser"
end
return M