mirror of
https://github.com/kossLAN/nvim-flake.git
synced 2025-11-05 02:09:49 -05:00
90 lines
2.7 KiB
Lua
90 lines
2.7 KiB
Lua
if vim.g.did_load_telescope_plugin then
|
|
return
|
|
end
|
|
vim.g.did_load_telescope_plugin = true
|
|
|
|
local telescope = require('telescope')
|
|
local actions = require('telescope.actions')
|
|
|
|
local builtin = require('telescope.builtin')
|
|
|
|
local layout_config = {
|
|
vertical = {
|
|
width = function(_, max_columns)
|
|
return math.floor(max_columns * 0.99)
|
|
end,
|
|
height = function(_, _, max_lines)
|
|
return math.floor(max_lines * 0.99)
|
|
end,
|
|
prompt_position = 'bottom',
|
|
preview_cutoff = 0,
|
|
},
|
|
}
|
|
|
|
vim.keymap.set('n', '<leader>tp', function()
|
|
builtin.find_files()
|
|
end, { desc = '[t]elescope find files - ctrl[p] style' })
|
|
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
|
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
|
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
|
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
|
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
|
|
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
|
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
|
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
|
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
|
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
|
|
|
telescope.setup {
|
|
defaults = {
|
|
path_display = {
|
|
'truncate',
|
|
},
|
|
layout_strategy = 'vertical',
|
|
layout_config = layout_config,
|
|
mappings = {
|
|
i = {
|
|
['<C-q>'] = actions.send_to_qflist,
|
|
['<C-l>'] = actions.send_to_loclist,
|
|
-- ['<esc>'] = actions.close,
|
|
['<C-s>'] = actions.cycle_previewers_next,
|
|
['<C-a>'] = actions.cycle_previewers_prev,
|
|
},
|
|
n = {
|
|
q = actions.close,
|
|
},
|
|
},
|
|
preview = {
|
|
treesitter = true,
|
|
},
|
|
history = {
|
|
path = vim.fn.stdpath('data') .. '/telescope_history.sqlite3',
|
|
limit = 1000,
|
|
},
|
|
color_devicons = true,
|
|
set_env = { ['COLORTERM'] = 'truecolor' },
|
|
prompt_prefix = ' ',
|
|
selection_caret = ' ',
|
|
entry_prefix = ' ',
|
|
initial_mode = 'insert',
|
|
vimgrep_arguments = {
|
|
'rg',
|
|
'-L',
|
|
'--color=never',
|
|
'--no-heading',
|
|
'--with-filename',
|
|
'--line-number',
|
|
'--column',
|
|
'--smart-case',
|
|
},
|
|
},
|
|
extensions = {
|
|
fzy_native = {
|
|
override_generic_sorter = false,
|
|
override_file_sorter = true,
|
|
},
|
|
},
|
|
}
|
|
|
|
telescope.load_extension('fzy_native')
|
|
-- telescope.load_extension('smart_history')
|