nvim/lua/setup/telescope.lua

136 lines
2.9 KiB
Lua

local actions = require('telescope.actions')
local mappingTab = {
i = {
['<cr>'] = actions.select_tab,
['<C-b>'] = actions.select_default,
},
}
require('telescope').setup({
defaults = {
mappings = {
i = {
['<cr>'] = actions.select_default + actions.center,
['<C-l>'] = actions.send_selected_to_loclist,
['<C-q>'] = actions.smart_send_to_qflist,
},
},
},
pickers = {
-- Your special builtin config goes in here
buffers = {
sort_lastused = true,
theme = 'ivy',
mappings = {
i = {
['<c-w>'] = actions.delete_buffer,
['<cr>'] = actions.select_default,
},
n = {
['<c-w>'] = actions.delete_buffer,
},
},
},
find_files = {
theme = 'ivy',
previewer = false,
},
oldfiles = {
theme = 'ivy',
},
git_files = {
theme = 'ivy',
previewer = false,
},
lsp_references = {
show_line = false;
include_declaration = false,
},
lsp_dynamic_workspace_symbols = {},
},
extensions = {
["ui-select"] = {
require("telescope.themes").get_dropdown {
}
}
}
})
require("telescope").load_extension("ui-select")
Project_files = function()
local opts = {} -- define here if you want to define something
local ok = pcall(require "telescope.builtin".git_files, opts)
if not ok then require "telescope.builtin".find_files(opts) end
end
require('legendary').keymaps(
{
{
'<leader>f',
':lua require("telescope.builtin").find_files({no_ignore=true})<CR>',
description = 'Find file',
},
{
'<leader>g',
':lua Project_files()<CR>',
description = 'Find git files',
},
{
'<leader>o',
':Telescope oldfiles<CR>',
description = 'Find old files',
},
{
'<leader>h',
':Telescope command_history<CR>',
description = 'Open command history',
},
{
'<leader>b',
':Telescope buffers<CR>',
description = 'Select buffer',
},
{
'<leader>q',
':Telescope quickfix<CR>',
description = 'Quickfix list with telescope',
},
{
'<leader>l',
':Telescope live_grep<CR>',
description = 'Search in project',
},
{
'<C-y>',
':Telescope neoclip<CR>',
description = 'Open clipboard history',
},
{
'<leader>j',
':Telescope jumplist<CR>',
description = 'Open jumplist',
},
{
'<c-f>',
':Telescope current_buffer_fuzzy_find<CR>',
description = 'Find in buffer',
},
{
'<leader>d',
':Telescope grep_string<CR>',
description = 'Find in workspace',
}
}
)
require('legendary').func(
{
function()
require('telescope.builtin').live_grep({ prompt_title = 'find string in open buffers...', grep_open_files = true })
end,
description = 'Search in open files',
}
)