1
Fork 0

A lot of neovim config updates

This commit is contained in:
Matei Adriel 2022-10-09 03:28:51 +02:00
parent d3ab72c6c8
commit 98e8510ae7
21 changed files with 874 additions and 152 deletions
dotfiles/neovim/lua/my/plugins

View file

@ -6,13 +6,19 @@ local function find_files_by_extension(extension)
return "find_files find_command=rg,--files,--glob=**/*." .. extension
end
local function with_theme(base, theme)
return base .. " theme=" .. theme
end
local defaultTheme = "ivy"
local keybinds = {
{ "<C-P>", "find_files" },
{ "<Leader>ft", find_files_by_extension("tex") },
{ "<Leader>fl", find_files_by_extension("lua") },
{ "<Leader>d", "diagnostics" },
{ "<C-F>", "live_grep" },
{ "<Leader>t", "builtin" },
{ "<C-P>", "find_files", "Find files" },
{ "<Leader>ft", find_files_by_extension("tex"), "Find tex files" },
{ "<Leader>fl", find_files_by_extension("lua"), "Find lua files" },
{ "<Leader>d", "diagnostics", "Diagnostics" },
{ "<C-F>", "live_grep", "Search in project" },
{ "<Leader>t", "builtin", "Show builtin pickers" },
}
local chords = {
@ -20,12 +26,16 @@ local chords = {
}
local function mkAction(action)
if not string.find(action, "theme=") then
action = with_theme(action, defaultTheme)
end
return ":Telescope " .. action .. "<cr>"
end
local function setupKeybinds()
for _, mapping in pairs(keybinds) do
vim.keymap.set("n", mapping[1], mkAction(mapping[2]))
vim.keymap.set("n", mapping[1], mkAction(mapping[2]), { desc = mapping[3] })
end
for _, mapping in pairs(chords) do