neovim-config/lua/plugins/telescope.lua

176 lines
4.9 KiB
Lua
Raw Normal View History

2022-10-06 04:44:41 +00:00
local trouble = require('trouble.providers.telescope')
local telescope = require('telescope')
telescope.setup {
defaults = {
mappings = {
i = {
['<c-t>'] = trouble.open_with_trouble,
['<c-h>'] = 'which_key',
},
n = {
['<c-t>'] = trouble.open_with_trouble,
['<c-h>'] = 'which_key',
},
},
},
extensions = {
project = {
theme = 'dropdown',
}
}
}
require('telescope').load_extension('fzf')
require('telescope').load_extension('gh')
require('telescope').load_extension('env')
require('telescope').load_extension('emoji')
require('telescope').load_extension('ui-select')
require('telescope').load_extension('project')
2023-12-01 20:26:00 +00:00
require('telescope').load_extension('session-lens')
2022-10-06 04:44:41 +00:00
vim.keymap.set(
'n',
'<leader>fgf',
[[<Cmd>lua require('telescope.builtin').git_files({ show_untracked = true })<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [G]it [F]iles" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<leader>f.',
[[<Cmd>lua require('telescope.builtin').git_files({ no_ignore = true })<CR>]],
{ noremap = true, silent = true, desc = "[F]ind ALL git files including ignored [.]" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'_',
[[<Cmd>lua require('telescope.builtin').live_grep()<CR>]],
{ noremap = true, silent = true, desc = "Search by live grep" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<leader>_',
[[<Cmd>lua require('telescope.builtin').live_grep({ search_dirs = { vim.fn.expand('%:p:h') } })<CR>]],
{ noremap = true, silent = true, desc = "Search by live grep in current (present) working directory" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<leader>8',
[[<Cmd>lua require('telescope.builtin').grep_string()<CR>]],
{ noremap = true, silent = true, desc = "Search by grep" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<leader>3',
[[<Cmd>lua require('telescope.builtin').grep_string()<CR>]],
{ noremap = true, silent = true, desc = "Search by grep" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
"n",
"<leader>fd",
[[<Cmd>lua require('telescope.builtin').find_files({cwd=require('telescope.utils').buffer_dir()})<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [D]irectories" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<leader>fb',
[[<Cmd>lua require('telescope.builtin').buffers()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [B]uffers" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<leader>fh',
[[<Cmd>lua require('telescope.builtin').help_tags()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [T]ags" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<leader>ft',
[[<Cmd>lua require('telescope.builtin').treesitter()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [T]reesitter objects" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<leader>fr',
[[<Cmd>lua require('telescope.builtin').resume()<CR>]],
{ noremap = true, silent = true, desc = "[R]esume last [F]ind" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<leader>fs',
[[<Cmd>lua require('telescope.builtin').spell_suggest()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [S]pelling suggestion" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<Leader>fgc',
[[<Cmd>lua require('telescope.builtin').git_commits()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [G]it [C]ommits" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
"n",
'<Leader>fga',
[[<Cmd>lua require('telescope.builtin').git_bcommits()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [G]it commits for current buffer" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<Leader>fgb',
[[<Cmd>lua require('telescope.builtin').git_branches()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [G]it [B]ranches" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<Leader>fe',
[[<Cmd>Telescope emoji<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [E]moji" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<Leader>f"',
[[<Cmd>lua require('telescope.builtin').registers()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind registers [\"]" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<Leader>fm',
[[<Cmd>lua require('telescope.builtin').keymaps()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind key [M]appings" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<Leader><tab>',
[[<Cmd>lua require('telescope.builtin').find_files()<CR>]],
{ noremap = true, silent = true, desc = "find files shortcut" }
)
2022-10-06 04:44:41 +00:00
vim.keymap.set(
'n',
'<Leader>ff',
2023-12-01 20:26:02 +00:00
[[<Cmd>lua require('telescope.builtin').find_files()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [F]iles" }
)
vim.keymap.set(
'n',
'<Leader>fi',
2022-10-06 04:44:41 +00:00
[[<Cmd>lua require('telescope.builtin').builtin()<CR>]],
2023-12-01 20:26:02 +00:00
{ noremap = true, silent = true, desc = "[F]ind telescope f[i]nders" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<Leader>fl',
[[<Cmd>lua require('telescope.builtin').reloader()<CR>]],
{ noremap = true, silent = true, desc = "[F]ind [L]ua module to reload" }
2022-10-06 04:44:41 +00:00
)
vim.keymap.set(
'n',
'<C-p>',
[[<Cmd>lua require('telescope').extensions.project.project({ display_type = 'full' })<CR>]],
{ noremap = true, silent = true, desc = "Find projects" }
2022-10-06 04:44:41 +00:00
)
2023-12-01 20:26:00 +00:00
vim.keymap.set(
'n',
'<leader>`',
[[<Cmd>lua require('session-lens').search_session()<CR>]],
{ noremap = true, silent = true, desc = "Find sessions" }
2023-12-01 20:26:00 +00:00
)