···116116-- use rg for grepping
117117vim.o.grepprg = vim.fn.executable("rg") == 1 and "rg --vimgrep" or "grep -n $* /dev/null"
118118vim.o.grepformat = "%f:%l:%c:%m"
119119+vim.g.findprg = vim.fn.executable("fd") == 1 and "fd -t f --color=never" or "find . -type f"
119120120121-- let me have spelling checking for english
121122vim.opt.spelllang = { "en" }
+29-1
config/plugin/grep.lua
···3636 vim.system({ vim.o.shell, "-c", grepcmd }, {
3737 text = true,
3838 }, fn)
3939- print(grepcmd)
4039end
41404241vim.api.nvim_create_user_command("Grep", grep, { nargs = "+", complete = "file_in_path", force = true })
···5958 local line = string.gsub(lines[1], "<", [[<lt>]])
6059 return ":Grep " .. line
6160end, { noremap = true, silent = false, expr = true })
6161+6262+-- find --
6363+6464+vim.o.findfunc = "v:lua.vim.g.findfunc"
6565+---@type fun(cmdarg: string, cmdcomplete: boolean): string[]
6666+vim.g.findfunc = function(cmdarg, _)
6767+ if not vim.g.findprg then
6868+ return {}
6969+ end
7070+ local farg = string.format("'%s'", cmdarg)
7171+ local findcmd, n = vim.o.grepprg:gsub("%$%*", farg)
7272+ if n == 0 then
7373+ findcmd = findcmd .. " " .. farg
7474+ end
7575+ local fn = function(o)
7676+ local src = o.stderr
7777+ if o.code == 0 then
7878+ src = o.stdout
7979+ end
8080+ src = src
8181+ local lines = vim.split(src, "\n", { trimempty = true })
8282+ return lines
8383+ end
8484+ return fn(vim
8585+ .system({ vim.o.shell, "-c", findcmd }, {
8686+ text = true,
8787+ })
8888+ :wait())
8989+end