nvim: Fix telescope grep

Fixed grepping for telescope to work again, and work with the native
'live_grep' function.

Replaced fzy extension with precompiled fzf since I have that installed
anyway.

Changed some theming around so I have a fast, minimal file switcher
instead of the big window by default. Can still call the big preview
window through the Telescope command if need be.
This commit is contained in:
Marty Oehme 2022-02-13 20:07:21 +01:00
parent dee44417a6
commit 438547251a
Signed by: Marty
GPG key ID: B7538B8F50A1C800
3 changed files with 37 additions and 40 deletions

View file

@ -76,9 +76,6 @@ map.n.nore[']q'] = ':cnext<cr>'
-- Location list
map.n.nore['[l'] = ':lprevious<cr>'
map.n.nore[']l'] = ':lnext<cr>'
-- Hunks (from gitsigns)
map.n.nore.expr['[h'] = [[&diff ? ']c' : '<cmd>Gitsigns prev_hunk<CR>']]
map.n.nore.expr[']h'] = [[&diff ? '[c' : '<cmd>Gitsigns next_hunk<CR>']]
-- set our leader key to space since with hjkl, space is largely useless
vim.g.mapleader = " "
@ -131,11 +128,9 @@ map.n.nore['<leader>s'] =
map.n.nore['<leader>S'] =
[[:lua require 'telescope.builtin'.oldfiles(require 'telescope.themes'.get_ivy())<cr>]]
-- fuzzy find files in cwd
map.n.nore['<leader>f'] =
[[:lua require 'telescope.builtin'.find_files({follow=true, hidden=true})<cr>]]
map.n.nore['<leader>f'] = [[:lua require 'telescope.builtin'.find_files()<cr>]]
-- general full-text search in cwd with rg
map.n.nore['<leader>F'] =
[[:lua require 'telescope'.extensions.fzf_writer.grep()<cr>]]
map.n.nore['<leader>F'] = [[:lua require 'telescope.builtin'.live_grep()<cr>]]
-- git status
map.n.nore['<leader>gs'] = [[:lua require 'telescope.builtin'.git_status()<cr>]]
@ -187,9 +182,6 @@ map.n.nore.silent['<F10>'] = ':TZMinimalist<cr>'
-- map @@ to automatically insert citation reference at cursor
map.i.nore.silent['@@'] = '<c-g>u<c-o>:CiteRef<cr>'
-- map <leader>cc to insert a complete citation at cursor
map.n.nore.silent['<leader>cc'] = ':CiteRef<cr>'
-- map <leader>cm to insert markdown prettified citation
map.n.nore.silent['<localleader>cm'] = ':CiteMarkdown<cr>'
-- SPELL CHECKING
-- Spell check set to <leader>O, 'o' for 'orthography':

View file

@ -1,32 +1,36 @@
-- Setup up telescope fuzzy finding settings
--
-- Makes use of optionally installed external programs to work fully:
-- rg (ripgrep) for in-text searches
-- fd for quicker directory structure searches
-- lsp for a variety of lsp queries
require("telescope").setup {
defaults = {
file_sorter = require("telescope.sorters").get_fzy_sorter,
vimgrep_arguments = {
'rg',
'--ignore-vcs',
'--hidden',
'--color=never',
'--no-heading',
'--with-filename',
'--line-number',
'--column',
'--smart-case'
},
},
extensions = {
fzy_native = {
override_generic_sorter = false,
override_file_sorter = true
},
fzf_writer = {
minimum_grep_characters = 2,
minimum_files_characters = 2,
-- Disabled by default.
-- Will probably slow down some aspects of the sorter, but can make color highlights.
use_highlighter = true,
'rg', '--ignore-vcs', '--hidden', '--color=never', '--no-heading',
'--with-filename', '--line-number', '--column', '--smart-case'
}
}
},
pickers = {
buffers = {theme = "ivy"},
oldfiles = {theme = "ivy"},
find_files = {
theme = "dropdown",
-- nice minimal picker design
borderchars = {
{'', '', '', '', '', '', '', ''},
prompt = {"", "", " ", "", '', '', "", ""},
results = {
"", "", "", "", "", "", "", ""
},
preview = {
'', '', '', '', '', '', '', ''
}
},
width = 0.8,
previewer = false,
prompt_title = false
}
}
}
require("telescope").load_extension("fzy_native")
require("telescope").load_extension("fzf_writer")
require("telescope").load_extension("fzf")

View file

@ -159,11 +159,12 @@ require("packer").startup(function()
-- fuzzy matching
use {
"nvim-telescope/telescope.nvim",
requires = {{"nvim-lua/popup.nvim"}, {"nvim-lua/plenary.nvim"}},
requires = {
{"nvim-lua/popup.nvim"}, {"nvim-lua/plenary.nvim"},
{"nvim-telescope/telescope-fzf-native.nvim", run = 'make'}
},
config = function() require('plug._telescope') end
}
use "nvim-telescope/telescope-fzy-native.nvim"
use "nvim-telescope/telescope-fzf-writer.nvim"
-- snippeting
use {"hrsh7th/vim-vsnip", event = "InsertEnter"} -- snippet engine