.config/nvim/after/ftplugin/qf.lua

Wed, 28 Aug 2024 04:44:05 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Wed, 28 Aug 2024 04:44:05 -0500
changeset 1178
8993dc4128de
parent 1101
40419d8e3cbb
permissions
-rw-r--r--

add assign types gopls hint too

1082
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 local fn = vim.fn
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3 local wininfo = fn.getwininfo(fn.win_getid())[1] or {}
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 local is_loc = wininfo.loclist == 1
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5 local qftitle = wininfo.variables.quickfix_title
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
6
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7 vim.bo.buflisted = false
1091
f407eccdaf61 tweak qf conceals for when tagfunc is fixed
Meredith Howard <mhoward@roomag.org>
parents: 1082
diff changeset
8 vim.wo.conceallevel = 2
1082
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 vim.wo.concealcursor = "n"
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10 vim.wo.wrap = false
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12 -- easy close
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
13 vim.keymap.set("n", "q", "<C-w>q", { buffer = true })
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15 if is_loc then
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
16 -- simplify noisy :ltag output
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
17 if qftitle and string.match(qftitle, "^ltag") then
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18 -- Hide ctags regex anchors
1091
f407eccdaf61 tweak qf conceals for when tagfunc is fixed
Meredith Howard <mhoward@roomag.org>
parents: 1082
diff changeset
19 fn.matchadd("Conceal", [[|\zs\^\\V\|\\$\ze|]])
1082
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
20
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
21 -- Hide lsp tagfunc line/col seek references
1091
f407eccdaf61 tweak qf conceals for when tagfunc is fixed
Meredith Howard <mhoward@roomag.org>
parents: 1082
diff changeset
22 fn.matchadd("Conceal", [[|\zs\\V\\%\|c\ze|]])
1101
40419d8e3cbb cleanup
Meredith Howard <mhoward@roomag.org>
parents: 1091
diff changeset
23 fn.matchadd("Conceal", [[|\\V\\%\d\+\zsl\\%]], 10, -1, { conceal = "," })
1082
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
24
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
25 -- highlight match in line. if tagname begins with / the rest is a \v
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
26 -- regex. match must be between vertical bars, so its the 2nd column.
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
27 local tagstack = fn.gettagstack()
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
28 if tagstack then
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
29 local tagmatch = string.gsub(tagstack.items[1].tagname, "^/", "\\v", 1)
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
30 fn.matchadd("Underlined", [[\m|.*\zs]] .. tagmatch .. [[\m\ze.*|]])
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
31 end
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
32 end
098f661195c1 move quickfix tweaks to after/ftplugin
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
33 end

mercurial