fix ripgrep drain out memory

Signed-off-by: Lee Tang <i@d0zingcat.dev>
This commit is contained in:
Lee Tang
2023-05-11 12:42:48 +08:00
parent 0442553c33
commit ccd57f9718
3 changed files with 21 additions and 6 deletions

View File

@@ -24,8 +24,14 @@ require('telescope').setup({
},
})
map('n', '<leader>ff', '<cmd>Telescope find_files<cr>')
map('n', '<leader>fg', '<cmd>Telescope live_grep<cr>')
map('n', '<leader>fb', '<cmd>Telescope buffers<cr>')
map('n', '<leader>fh', '<cmd>Telescope help_tags<cr>')
map('n', '<leader>;', '<cmd>Telescope commands<cr>')
local builtin = require('telescope.builtin')
map('n', '<leader>ff', builtin.find_files)
-- map('n', '<leader>fg', [[:lua require('telescope.builtin').live_grep({additional_args = {'-j8'}})<CR>]])
map('n', '<leader>fb', builtin.buffers)
map('n', '<leader>fg', function() builtin.live_grep({ additional_args = { '-j8' } }) end)
map('n', '<leader>fh', builtin.help_tags)
map('n', '<leader>;', builtin.commands)
-- To get fzf loaded and working with telescope, you need to call
-- load_extension, somewhere after setup function:
require('telescope').load_extension('fzf')

View File

@@ -96,6 +96,11 @@ return require('packer').startup(function(use)
config = function()
require('config.nvim_telescope')
end,
requires = {
{ 'nvim-telescope/telescope-fzf-native.nvim', run = 'make', config = function()
require('telescope').load_extension('fzf')
end }
},
})
use({
'hrsh7th/nvim-cmp',

View File

@@ -34,7 +34,11 @@ local function map(modes, lhs, rhs, opts)
modes = { modes }
end
for _, mode in ipairs(modes) do
map_key(mode, lhs, rhs, opts)
if type(rhs) == "string" then
map_key(mode, lhs, rhs, opts)
else
vim.keymap.set(mode, lhs, rhs, opts)
end
end
end