ref(nvim): use after/plugin (faster)

This commit is contained in:
Léana 江 2024-02-10 18:20:34 +01:00 committed by Léana 江
parent 54a64a534c
commit 90980cb81a
20 changed files with 4 additions and 48 deletions

View file

@ -0,0 +1,47 @@
local ts = require "telescope"
local actions = require "telescope.actions"
local themes = require "telescope.themes"
local config = require "telescope.config"
local builtin = require "telescope.builtin"
local map = vim.keymap.set
-- Clone the default Telescope configuration
local vimgrep_arguments = { unpack(config.values.vimgrep_arguments) }
table.insert(vimgrep_arguments, "--hidden") -- search hidden
table.insert(vimgrep_arguments, "--glob") -- ignore git
table.insert(vimgrep_arguments, "!**/.git/*")
ts.setup {
defaults = {
vimgrep_arguments = vimgrep_arguments,
mappings = {
i = {
["<esc>"] = actions.close,
},
},
},
pickers = {
find_files = {
find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" },
},
},
}
-- Enable telescope fzf native, if installed
pcall(require "telescope".load_extension, "fzf")
map("n", "<leader>/",
function()
builtin.current_buffer_fuzzy_find(themes.get_dropdown { previewer = false })
end
)
map("n", "<leader>sf", builtin.find_files)
map("n", "<leader>gf", builtin.git_files)
map("n", "<leader>?", builtin.help_tags)
map("n", "<leader>sw", builtin.grep_string)
map("n", "<leader>sg", builtin.live_grep)
map("n", "<leader>sd", builtin.diagnostics)
map("n", "<leader>b", builtin.buffers)
map("n", "<leader>sp", builtin.spell_suggest)