1
Fork 0

Started rewriting my neovim config

This commit is contained in:
Matei Adriel 2022-12-27 14:02:03 +01:00
parent 686bdd12c4
commit 47d704ad01
17 changed files with 181 additions and 122 deletions
dotfiles/neovim/lua/my/plugins

View file

@ -1,5 +1,3 @@
local arpeggio = require("my.plugins.arpeggio")
local M = {}
local function find_files_by_extension(extension)
@ -14,18 +12,23 @@ local defaultTheme = "ivy"
local keybinds = {
{ "<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>fp", find_files_by_extension("purs"), "Find purescript files" },
{ "<Leader>d", "diagnostics", "Diagnostics" },
{ "<C-F>", "live_grep", "Search in project" },
{ "<Leader>t", "builtin", "Show builtin pickers" }
{ "<Leader>ft", find_files_by_extension("tex"), "[F]ind [t]ex files" },
{ "<Leader>fl", find_files_by_extension("lua"), "[F]ind [l]ua files" },
{
"<Leader>fp",
find_files_by_extension("purs"),
"[F]ind [p]urescript files",
},
{ "<Leader>d", "diagnostics", "[D]iagnostics" },
{ "<C-F>", "live_grep", "[F]ind in project" },
{ "<C-S-F>", "file_browser", "[F]ile browser" },
{ "<Leader>t", "builtin", "[T]elescope pickers" },
}
local chords = { { "jp", "file_browser" } }
local function mkAction(action)
if not string.find(action, "theme=") then action = with_theme(action, defaultTheme) end
if not string.find(action, "theme=") then
action = with_theme(action, defaultTheme)
end
return ":Telescope " .. action .. "<cr>"
end
@ -34,8 +37,6 @@ local function setupKeybinds()
for _, mapping in pairs(keybinds) do
vim.keymap.set("n", mapping[1], mkAction(mapping[2]), { desc = mapping[3] })
end
for _, mapping in pairs(chords) do arpeggio.chord("n", mapping[1], mkAction(mapping[2])) end
end
function M.setup()
@ -44,11 +45,11 @@ function M.setup()
local settings = {
defaults = { mappings = { i = { ["<C-h>"] = "which_key" } } },
pickers = { find_files = { hidden = true } },
extensions = { file_browser = { path = "%:p:h" } }
extensions = { file_browser = { path = "%:p:h" } },
}
require("telescope").setup(settings)
require("telescope").load_extension "file_browser"
require("telescope").load_extension("file_browser")
end
return M