🐻 minimal ui2 fuzzy finder for Neovim codeberg.org/comfysage/artio.nvim
3
fork

Configure Feed

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

feat(builtins): add loc information to grep

robin 6876c901 d6f6f1c5

+19 -3
+19 -3
lua/artio/builtins.lua
··· 89 89 props = props or {} 90 90 props.grepprg = props.grepprg or vim.o.grepprg 91 91 92 + local base_dir = vim.fn.getcwd(0) 92 93 local ext = require("vim._extui.shared") 93 94 local grepcmd = utils.make_cmd(props.grepprg, { 94 - cwd = vim.fn.getcwd(0), 95 + cwd = base_dir, 95 96 }) 96 97 97 98 return artio.pick(extend({ ··· 114 115 return vim 115 116 .iter(ipairs(vim.fn.getloclist(ext.wins.cmd))) 116 117 :map(function(i, locitem) 118 + local name = vim.fs.abspath(vim.fn.bufname(locitem.bufnr)) 117 119 return { 118 120 id = i, 119 - v = { vim.fn.bufname(locitem.bufnr), locitem.lnum, locitem.col }, 120 - text = locitem.text, 121 + v = { name, locitem.lnum, locitem.col }, 122 + text = ("%s:%d:%d:%s"):format(vim.fs.relpath(base_dir, name), locitem.lnum, locitem.col, locitem.text), 121 123 } 122 124 end) 123 125 :totable() ··· 139 141 get_icon = config.get().opts.use_icons and function(item) 140 142 return require("mini.icons").get("file", item.v[1]) 141 143 end or nil, 144 + hl_item = function(item) 145 + local name_end = string.find(item.text, ":") - 1 146 + local lnum_end = string.find(item.text, ":", name_end + 2) - 1 147 + local col_end = string.find(item.text, ":", lnum_end + 2) - 1 148 + 149 + return { 150 + { { 0, name_end }, "Title" }, 151 + { { name_end, name_end + 1 }, "NonText" }, 152 + { { name_end + 1, lnum_end }, "Number" }, 153 + { { lnum_end, lnum_end + 1 }, "NonText" }, 154 + { { lnum_end + 1, col_end }, "Number" }, 155 + { { col_end, col_end + 1 }, "NonText" }, 156 + } 157 + end, 142 158 actions = extend( 143 159 {}, 144 160 utils.make_setqflistactions(function(item)