mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 22:59:15 +00:00
parent
dad88aa92f
commit
1bdcd3386e
13 changed files with 0 additions and 0 deletions
|
|
@ -1,95 +0,0 @@
|
|||
local telescope = require("telescope")
|
||||
local actions = require("telescope.actions")
|
||||
local themes = require("telescope.themes")
|
||||
local config = require("telescope.config")
|
||||
local builtin = require("telescope.builtin")
|
||||
local state = require("telescope.state")
|
||||
|
||||
-- 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/*")
|
||||
|
||||
telescope.setup {
|
||||
-- Workaround
|
||||
-- https://github.com/nvim-telescope/telescope.nvim/issues/938#issuecomment-877539724
|
||||
defaults = themes.get_ivy {
|
||||
vimgrep_arguments = vimgrep_arguments,
|
||||
mappings = {
|
||||
n = {
|
||||
["<C-c>"] = actions.close,
|
||||
["r"] = actions.to_fuzzy_refine,
|
||||
["j"] = actions.move_selection_next,
|
||||
["k"] = actions.move_selection_previous,
|
||||
},
|
||||
i = {
|
||||
["<Up>"] = actions.cycle_history_prev,
|
||||
["<Down>"] = actions.cycle_history_next,
|
||||
},
|
||||
},
|
||||
layout_config = { height = 0.5 },
|
||||
borderchars = { "", "", "", "│", "", "", "", "" },
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" },
|
||||
},
|
||||
current_buffer_fuzzy_find = {
|
||||
mappings = {
|
||||
n = {
|
||||
["n"] = actions.move_selection_next,
|
||||
["N"] = actions.move_selection_previous,
|
||||
},
|
||||
},
|
||||
},
|
||||
lsp_references = {
|
||||
layout_config = { height = 0.7 },
|
||||
initial_mode = "normal",
|
||||
},
|
||||
live_grep = {
|
||||
layout_config = { height = 0.7 },
|
||||
},
|
||||
buffers = {
|
||||
initial_mode = "normal",
|
||||
},
|
||||
resume = {
|
||||
initial_mode = "normal",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require("telescope").load_extension, "fzf")
|
||||
|
||||
local function find_undercursor_in_buffer()
|
||||
builtin["current_buffer_fuzzy_find"] {
|
||||
layout_config = { height = 0.8 }, -- Already have word, no need to think
|
||||
default_text = vim.fn.expand("<cword>"),
|
||||
initial_mode = "normal",
|
||||
}
|
||||
end
|
||||
local function grep_undercursor()
|
||||
builtin["live_grep"] {
|
||||
layout_config = { height = 0.8 }, -- Already have word, no need to think
|
||||
default_text = vim.fn.expand("<cword>"),
|
||||
initial_mode = "normal",
|
||||
}
|
||||
end
|
||||
|
||||
-- Better than builtin /
|
||||
vim.keymap.set("n", "/", builtin["current_buffer_fuzzy_find"])
|
||||
vim.keymap.set("n", "<leader>w", find_undercursor_in_buffer)
|
||||
vim.keymap.set("n", "<leader>W", grep_undercursor)
|
||||
|
||||
-- Use / as prefix to avoid collision in bindings
|
||||
vim.keymap.set("n", "<leader>/f", builtin["find_files"])
|
||||
vim.keymap.set("n", "<leader>/?", builtin["help_tags"])
|
||||
vim.keymap.set("n", "<leader>/g", builtin["live_grep"])
|
||||
vim.keymap.set("n", "<leader>/d", builtin["diagnostics"])
|
||||
vim.keymap.set("n", "<leader>/b", builtin["buffers"])
|
||||
vim.keymap.set("n", "<leader>/p", builtin["spell_suggest"])
|
||||
|
||||
-- for GHC
|
||||
-- grep -> refine for `.hs:` files
|
||||
Loading…
Add table
Add a link
Reference in a new issue