diff --git a/lua/ivy/backends/rg.lua b/lua/ivy/backends/rg.lua new file mode 100644 index 0000000..56d9921 --- /dev/null +++ b/lua/ivy/backends/rg.lua @@ -0,0 +1,12 @@ +local utils = require "ivy.utils" + +local rg = { + name = "RG", + command = "IvyRg", + description = "Run ripgrep to search for content in files", + keymap = "/", + items = utils.command_finder "rg --vimgrep --", + callback = utils.vimgrep_action(), +} + +return rg diff --git a/plugin/ivy.lua b/plugin/ivy.lua index 2834681..a3a670e 100644 --- a/plugin/ivy.lua +++ b/plugin/ivy.lua @@ -31,4 +31,10 @@ register_backend(require "ivy.backends.files") register_backend(require "ivy.backends.lines") register_backend(require "ivy.backends.lsp-workspace-symbols") +if vim.fn.executable "rg" then + register_backend(require "ivy.backends.rg") +elseif vim.fn.executable "ag" then + register_backend(require "ivy.backends.ag") +end + vim.cmd "highlight IvyMatch cterm=bold gui=bold"