|
1 local fn = vim.fn |
|
2 |
|
3 local wininfo = fn.getwininfo(fn.win_getid())[1] or {} |
|
4 local is_loc = wininfo.loclist == 1 |
|
5 local qftitle = wininfo.variables.quickfix_title |
|
6 |
|
7 vim.bo.buflisted = false |
|
8 vim.wo.concealcursor = "n" |
|
9 vim.wo.wrap = false |
|
10 |
|
11 -- easy close |
|
12 vim.keymap.set("n", "q", "<C-w>q", { buffer = true }) |
|
13 |
|
14 if is_loc then |
|
15 -- simplify noisy :ltag output |
|
16 if qftitle and string.match(qftitle, "^ltag") then |
|
17 -- Hide ctags regex anchors |
|
18 fn.matchadd("Conceal", [[\m|\zs\^\\V\|\\$\ze|]]) |
|
19 |
|
20 -- Hide lsp tagfunc line/col seek references |
|
21 fn.matchadd("Conceal", [[\m|\zs\\Vcall cursor(\|)\ze|]]) |
|
22 |
|
23 -- highlight match in line. if tagname begins with / the rest is a \v |
|
24 -- regex. match must be between vertical bars, so its the 2nd column. |
|
25 local tagstack = fn.gettagstack() |
|
26 if tagstack then |
|
27 local tagmatch = string.gsub(tagstack.items[1].tagname, "^/", "\\v", 1) |
|
28 fn.matchadd("Underlined", [[\m|.*\zs]] .. tagmatch .. [[\m\ze.*|]]) |
|
29 end |
|
30 end |
|
31 end |