Skip to content

Commit

Permalink
Fix :Rg for nvim 0.11
Browse files Browse the repository at this point in the history
  • Loading branch information
dietrichm committed Sep 29, 2024
1 parent 8f8b7d0 commit c76e6f2
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions nvim/.config/nvim/lua/dietrichm/telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,17 @@ map('n', '<Leader>fs', function()
builtin.find_files({ search_file = file_root_without_test })
end)

local function rg(add_options)
local function rg(...)
local additional_args = { ... }
return function(options)
builtin.grep_string({
search = options.args,
use_regex = true,
additional_args = function(rg_options)
for _, add_option in ipairs(add_options) do
table.insert(rg_options, add_option)
end
return rg_options
end,
additional_args = additional_args,
})
end
end

vim.api.nvim_create_user_command('Rg', rg({}), { nargs = '*' })
vim.api.nvim_create_user_command('Rgi', rg({ '--no-ignore-vcs' }), { nargs = '*' })
vim.api.nvim_create_user_command('Rgw', rg({ '--word-regexp' }), { nargs = '*' })
vim.api.nvim_create_user_command('Rg', rg(), { nargs = '*' })
vim.api.nvim_create_user_command('Rgi', rg('--no-ignore-vcs'), { nargs = '*' })
vim.api.nvim_create_user_command('Rgw', rg('--word-regexp'), { nargs = '*' })

0 comments on commit c76e6f2

Please sign in to comment.