🪴 my neovim config:)
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

plugin: add find options to grep plugin

robin 8407b2a7 11867c00

+30 -1
+1
config/lua/ivy/config/options.lua
··· 116 116 -- use rg for grepping 117 117 vim.o.grepprg = vim.fn.executable("rg") == 1 and "rg --vimgrep" or "grep -n $* /dev/null" 118 118 vim.o.grepformat = "%f:%l:%c:%m" 119 + vim.g.findprg = vim.fn.executable("fd") == 1 and "fd -t f --color=never" or "find . -type f" 119 120 120 121 -- let me have spelling checking for english 121 122 vim.opt.spelllang = { "en" }
+29 -1
config/plugin/grep.lua
··· 36 36 vim.system({ vim.o.shell, "-c", grepcmd }, { 37 37 text = true, 38 38 }, fn) 39 - print(grepcmd) 40 39 end 41 40 42 41 vim.api.nvim_create_user_command("Grep", grep, { nargs = "+", complete = "file_in_path", force = true }) ··· 59 58 local line = string.gsub(lines[1], "<", [[<lt>]]) 60 59 return ":Grep " .. line 61 60 end, { noremap = true, silent = false, expr = true }) 61 + 62 + -- find -- 63 + 64 + vim.o.findfunc = "v:lua.vim.g.findfunc" 65 + ---@type fun(cmdarg: string, cmdcomplete: boolean): string[] 66 + vim.g.findfunc = function(cmdarg, _) 67 + if not vim.g.findprg then 68 + return {} 69 + end 70 + local farg = string.format("'%s'", cmdarg) 71 + local findcmd, n = vim.o.grepprg:gsub("%$%*", farg) 72 + if n == 0 then 73 + findcmd = findcmd .. " " .. farg 74 + end 75 + local fn = function(o) 76 + local src = o.stderr 77 + if o.code == 0 then 78 + src = o.stdout 79 + end 80 + src = src 81 + local lines = vim.split(src, "\n", { trimempty = true }) 82 + return lines 83 + end 84 + return fn(vim 85 + .system({ vim.o.shell, "-c", findcmd }, { 86 + text = true, 87 + }) 88 + :wait()) 89 + end