local g={"\106\114\101\109\109\101\110\047\118\105\109-\114\105\112\103\114\101\112",event="\086\101\114\121\076\097\122\121",init=function()vim.g.rg_command="\114\103 --\118\105\109\103\114\101\112 --\104\105\100\100\101\110 --\115\109\097\114\116-\099\097\115\101"vim.g.rg_highlight=1 end;config=function()vim.keymap.set("\118","\060\108\101\097\100\101\114\062\114\103","\121 \058\082\103 \"\060\067\082\062",{desc="\091\082\093\105\112\091\071\093\114\101\112 \115\101\108\101\099\116\105\111\110"})vim.keymap.set("\110","\060\076\101\097\100\101\114\062\114\103","\058\082\103 \060\067-\114\062\060\067-\119\062\060\067\082\062",{desc="\091\082\093\105\112\091\071\093\114\101\112 \119\111\114\100 \117\110\100\101\114 \099\117\114\115\111\114"})vim.keymap.set("\118","\060\108\101\097\100\101\114\062\114\116","\121 \058\082\103 \" -\103 \'\033\042\047\042\042\047\116\101\115\116\047\042\' -\103 \'\033\042\047\042\042\047\109\105\103\114\097\116\105\111\110\115\047\042\'\060\067\082\062",{desc="\082\105\112\091\071\093\114\101\112 \101\120\099\108\117\100\105\110\103 \116\101\115\116 \102\105\108\101\115"})vim.keymap.set("\110","\060\076\101\097\100\101\114\062\114\116","\058\082\103 \060\067-\114\062\060\067-\119\062 -\103 \'\033\042\047\042\042\047\116\101\115\116\047\042\' -\103 \'\033\042\047\042\042\047\109\105\103\114\097\116\105\111\110\115\047\042\'\060\067\082\062",{desc="\082\105\112\091\071\093\114\101\112 \101\120\099\108\117\100\105\110\103 \116\101\115\116 \102\105\108\101\115"})end}return g
-- RipGrep (text search tool)
local M = {
  'jremmen/vim-ripgrep',
  event = 'VeryLazy',
  init = function()
    -- allow hidden files to be searched and smart case
    vim.g.rg_command = 'rg --vimgrep --hidden --smart-case'
    vim.g.rg_highlight = 1
  end,
  config = function()
    --  alias for above
    --  Grep project for selection with Rg
    vim.keymap.set('v', '<leader>rg', 'y :Rg "<CR>', { desc = '[R]ip[G]rep selection' })
    --  Grep project for word under the cursor with Rg
    vim.keymap.set('n', '<Leader>rg', ':Rg <C-r><C-w><CR>', { desc = '[R]ip[G]rep word under cursor' })

    --  Grep selection with Rg (excluding tests and migrations)
    vim.keymap.set('v', '<leader>rt', "y :Rg \" -g '!*/**/test/*' -g '!*/**/migrations/*'<CR>", { desc = 'Rip[G]rep excluding test files' })
    vim.keymap.set('n', '<Leader>rt', ":Rg <C-r><C-w> -g '!*/**/test/*' -g '!*/**/migrations/*'<CR>", { desc = 'Rip[G]rep excluding test files' })
  end,
}

return M
