nvim/plug: +telescope.nvim@0.1.x, -fzf, -fzf.nvim

This commit removes (direct) FZF plugins in favor of telescope.nvim,
which provides a significantly nicer, native experience in doing fuzzy
searching.

The primary out of the box method for interacting with Telescope is
through the <C-Right> super key, which opens a 'meta-menu' of searchers
that you can choose from.

Some of the more interesting options are 'find_files', 'live_grep_search',
and 'lsp_symbols'. Note that you can use fuzzy searching for these. For
example, the chord <C-Right>ff<CR> brings up the 'find_files' menu.

Users are encouraged to create their own key maps for commonly used
searchers.

Also ignore Telescope windows in pear-tree as pear-tree's <CR> bind seems
to interact poorly with Telescope usage of <CR> (i.e it blocks it completely),
so we disable it
This commit is contained in:
Paul Stemmet 2022-09-10 08:04:41 +00:00
parent 3cb079be10
commit d6f7bbaa3a
Signed by: Paul Stemmet
GPG Key ID: EDEA539F594E7E75
4 changed files with 18 additions and 40 deletions

View File

@ -1,35 +0,0 @@
return function()
local fn, o, api = vim.fn, vim.o, vim.api
if fn.executable('rg') == 1 then
-- Override the default grep implementation in vim
o.grepprg = 'rg --vimgrep --smart-case --follow'
if fn.has('nvim-0.7') == 1 then
-- Only search file contents, not file name
-- We can use the stock :Files for that
local rg_func = function(opts)
return fn['fzf#vim#grep'](
"rg --column --line-number --no-heading --color=always --smart-case " .. fn.shellescape(opts.args),
true,
fn['fzf#vim#with_preview']({options = '--delimiter : --nth 4..'}),
opts.bang
)
end
api.nvim_create_user_command('Rg', rg_func, { nargs = '*', bang = true })
-- If the user hasn't set a default FZF command, and has ripgrep installed,
-- use it over find, otherwise defer to the user's preferred command
if fn.empty(os.getenv('FZF_DEFAULT_COMMAND')) == 1 then
local files_func = function(opts)
return fn['fzf#vim#files'](
opts.args,
fn['fzf#vim#with_preview']({source = 'rg --files --hidden --glob "!**/.git/**" '}),
opts.bang
)
end
api.nvim_create_user_command('Files', files_func, { nargs = '?', bang = true, complete = 'dir' })
end
end
end
end

View File

@ -5,4 +5,5 @@ return function()
g.pear_tree_smart_openers = 1
g.pear_tree_smart_closers = 1
g.pear_tree_smart_backspace = 1
g.pear_tree_ft_disabled = { 'TelescopePrompt' }
end

View File

@ -0,0 +1,11 @@
return function()
local ts, util = require 'telescope', require 'psoxizsh.util'
local defaults = {}
ts.setup(util.mconfig('config.telescope', { defaults = defaults }))
-- Requires telescope-fzf-native.nvim
-- Speeds up search times by 5-10x
ts.load_extension('fzf')
end

View File

@ -151,12 +151,13 @@ local plugins = {
},
-- Fuzzy search helpers
{ 'junegunn/fzf',
cmd = 'FZF',
fn = { 'fzf#run', 'fzf#wrap' }
{ 'nvim-telescope/telescope.nvim',
branch = '0.1.x',
requires = { 'nvim-lua/plenary.nvim', 'nvim-telescope/telescope-fzf-native.nvim' },
config = require 'psoxizsh.plugins.config.telescope'
},
{ 'junegunn/fzf.vim',
config = require 'psoxizsh.plugins.config.fzf'
{ 'nvim-telescope/telescope-fzf-native.nvim',
run = 'make'
},
{ 'romainl/vim-cool' },
{ 'adelarsq/vim-matchit' },