Create custom grep function

This commit is contained in:
Marco 2023-10-15 18:09:01 +02:00
parent 63e3cfdcd5
commit 9ae32ef0ef

View File

@ -1,5 +1,17 @@
local builtin = require('telescope.builtin') local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {}) vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fs', function() vim.keymap.set('n', '<leader>fs', function()
builtin.grep_string({ search = vim.fn.input("Find: ") }); local searchstring
vim.ui.input({ prompt = 'Grep: ' }, function(input)
searchstring = input
end);
if (searchstring == nil or searchstring == '') then
return
end
builtin.grep_string({ search = searchstring });
end) end)
vim.keymap.set('v', '<leader>fs', builtin.grep_string);