80 lines
1.8 KiB
Lua
80 lines
1.8 KiB
Lua
|
|
local init = function()
|
||
|
|
local telescope = require('telescope')
|
||
|
|
local themes = require('telescope.themes')
|
||
|
|
local actions = require('telescope.actions')
|
||
|
|
|
||
|
|
telescope.setup {
|
||
|
|
defaults = themes.get_ivy {
|
||
|
|
file_ignore_pattern = { 'build', '.cache', '.ccls*' },
|
||
|
|
sorting_strategy = 'ascending',
|
||
|
|
preview = false,
|
||
|
|
layout_config = {
|
||
|
|
horizontal = {
|
||
|
|
prompt_position = 'top',
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
pickers = {
|
||
|
|
find_files = {
|
||
|
|
find_command = { 'rg', '--ignore', '-L', '--files' },
|
||
|
|
theme = 'ivy',
|
||
|
|
mappings = {
|
||
|
|
i = {
|
||
|
|
['<esc>'] = actions.close,
|
||
|
|
['<C-e>'] = { '<esc>', type = 'command' }
|
||
|
|
}
|
||
|
|
}
|
||
|
|
},
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
local builtin = require('telescope.builtin')
|
||
|
|
|
||
|
|
vim.api.nvim_create_user_command(
|
||
|
|
'SearchDotfiles',
|
||
|
|
function(opts)
|
||
|
|
builtin.find_files({ cwd = '~/.config/nvim' })
|
||
|
|
end,
|
||
|
|
{})
|
||
|
|
|
||
|
|
vim.api.nvim_create_user_command(
|
||
|
|
'SearchNotes',
|
||
|
|
function(opts)
|
||
|
|
builtin.find_files({ cwd = '~/notes' })
|
||
|
|
end,
|
||
|
|
{})
|
||
|
|
|
||
|
|
vim.keymap.set('n', 'ff', builtin.find_files, {})
|
||
|
|
vim.keymap.set('n', 'fd', function() vim.cmd('SearchDotfiles') end, {})
|
||
|
|
vim.keymap.set('n', 'fn', function() vim.cmd('SearchNotes') end, {})
|
||
|
|
vim.keymap.set('n', 'fb', function() vim.cmd('Telescope buffers') end, {})
|
||
|
|
vim.keymap.set('n', 'fs', function() vim.cmd('Telescope lsp_dynamic_workspace_symbols') end, {})
|
||
|
|
end
|
||
|
|
|
||
|
|
return {
|
||
|
|
{
|
||
|
|
'nvim-telescope/telescope.nvim',
|
||
|
|
tag = '0.1.8',
|
||
|
|
priority = 1000,
|
||
|
|
dependencies = {
|
||
|
|
'nvim-lua/plenary.nvim'
|
||
|
|
},
|
||
|
|
config = init
|
||
|
|
},
|
||
|
|
{
|
||
|
|
'kelly-lin/telescope-ag',
|
||
|
|
dependencies = {
|
||
|
|
'nvim-telescope/telescope.nvim'
|
||
|
|
},
|
||
|
|
config = function()
|
||
|
|
local telescope_ag = require('telescope-ag')
|
||
|
|
telescope_ag.setup({
|
||
|
|
cmd = telescope_ag.cmds.ag,
|
||
|
|
})
|
||
|
|
|
||
|
|
local telescope = require('telescope')
|
||
|
|
telescope.load_extension("ag")
|
||
|
|
end
|
||
|
|
}
|
||
|
|
}
|