|
|
@ -10,6 +10,7 @@ return { |
|
|
|
config = function() |
|
|
|
local telescope = require("telescope") |
|
|
|
local actions = require("telescope.actions") |
|
|
|
local action_state = require('telescope.actions.state') |
|
|
|
local previewers = require("telescope.previewers") |
|
|
|
local previewers_utils = require("telescope.previewers.utils") |
|
|
|
local sorters = require("telescope.sorters") |
|
|
@ -35,30 +36,30 @@ return { |
|
|
|
end |
|
|
|
|
|
|
|
telescope.setup({ |
|
|
|
defaults = vim.tbl_extend( |
|
|
|
"force", |
|
|
|
require("telescope.themes").get_ivy(), |
|
|
|
{ |
|
|
|
file_sorter = sorters.get_fzy_sorter, |
|
|
|
color_devicons = true, |
|
|
|
buffer_previewer_maker = truncate_large_files, |
|
|
|
|
|
|
|
initial_mode = "insert", |
|
|
|
selection_strategy = "reset", |
|
|
|
sorting_strategy = "ascending", |
|
|
|
path_display = { "truncate" }, |
|
|
|
defaults = { |
|
|
|
file_sorter = sorters.get_fzy_sorter, |
|
|
|
color_devicons = true, |
|
|
|
buffer_previewer_maker = truncate_large_files, |
|
|
|
|
|
|
|
initial_mode = "insert", |
|
|
|
selection_strategy = "reset", |
|
|
|
sorting_strategy = "ascending", |
|
|
|
path_display = { "truncate" }, |
|
|
|
|
|
|
|
layout_config = { |
|
|
|
prompt_position = "top", |
|
|
|
}, |
|
|
|
|
|
|
|
mappings = { |
|
|
|
i = { |
|
|
|
["<C-n>"] = actions.move_selection_next, |
|
|
|
["<C-p>"] = actions.move_selection_previous, |
|
|
|
["<C-j>"] = actions.cycle_history_next, |
|
|
|
["<C-k>"] = actions.cycle_history_prev, |
|
|
|
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist, |
|
|
|
}, |
|
|
|
mappings = { |
|
|
|
i = { |
|
|
|
["<C-n>"] = actions.move_selection_next, |
|
|
|
["<C-p>"] = actions.move_selection_previous, |
|
|
|
["<C-j>"] = actions.cycle_history_next, |
|
|
|
["<C-k>"] = actions.cycle_history_prev, |
|
|
|
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist, |
|
|
|
}, |
|
|
|
} |
|
|
|
), |
|
|
|
}, |
|
|
|
}, |
|
|
|
pickers = { |
|
|
|
diagnostics = { |
|
|
|
initial_mode = "normal", |
|
|
@ -67,14 +68,6 @@ return { |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
themes = { |
|
|
|
ivy = { |
|
|
|
layout_strategy = 'bottom_pane', |
|
|
|
layout_config = { |
|
|
|
height = 50, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
extensions = { |
|
|
|
undo = { |
|
|
|
side_by_side = true, |
|
|
@ -126,6 +119,11 @@ return { |
|
|
|
|
|
|
|
keymap.set("n", "<leader>fr", builtin.resume, {}) |
|
|
|
|
|
|
|
keymap.set("n", "<leader>ss", builtin.spell_suggest, {}) |
|
|
|
|
|
|
|
keymap.set("n", "<leader>ql", builtin.quickfix, {}) |
|
|
|
keymap.set("n", "<leader>qhl", builtin.quickfixhistory, {}) |
|
|
|
|
|
|
|
keymap.set("n", "<leader>fb", builtin.buffers, {}) |
|
|
|
keymap.set("n", "<leader>fo", builtin.oldfiles, {}) |
|
|
|
|
|
|
@ -171,5 +169,39 @@ return { |
|
|
|
end) |
|
|
|
|
|
|
|
vim.keymap.set("n", "<leader>u", "<cmd>Telescope undo<cr>") |
|
|
|
|
|
|
|
keymap.set("n", "/", function() |
|
|
|
builtin.current_buffer_fuzzy_find({ |
|
|
|
attach_mappings = function(prompt_bufnr, map) |
|
|
|
-- Override the default select action |
|
|
|
map('i', '<CR>', function() |
|
|
|
local selection = action_state.get_selected_entry() |
|
|
|
local prompt = action_state.get_current_line() |
|
|
|
|
|
|
|
actions.close(prompt_bufnr) |
|
|
|
|
|
|
|
-- Set the search register to the prompt text |
|
|
|
if prompt and prompt ~= "" then |
|
|
|
vim.fn.setreg('/', prompt) |
|
|
|
end |
|
|
|
|
|
|
|
-- Jump to the selected result with proper error handling |
|
|
|
if selection then |
|
|
|
-- Try different possible field names for line/column |
|
|
|
local line = selection.lnum or selection.line_number or selection.row or 1 |
|
|
|
local col = selection.col or selection.column or selection.start_col or 0 |
|
|
|
|
|
|
|
-- Ensure we have valid numbers |
|
|
|
if type(line) == "number" and type(col) == "number" then |
|
|
|
-- Vim uses 1-based indexing for lines, 0-based for columns |
|
|
|
vim.api.nvim_win_set_cursor(0, { line, col }) |
|
|
|
end |
|
|
|
end |
|
|
|
end) |
|
|
|
|
|
|
|
return true |
|
|
|
end, |
|
|
|
}) |
|
|
|
end, {}) |
|
|
|
end, |
|
|
|
} |