# HG changeset patch # User Meredith Howard # Date 1678737676 18000 # Node ID 098f661195c1a48c0fc67dee28d71fcb55a9804a # Parent 59e05e03851d77f67feea6558dbc2acf7e3d3c1a move quickfix tweaks to after/ftplugin diff --git a/.config/nvim/after/ftplugin/qf.lua b/.config/nvim/after/ftplugin/qf.lua new file mode 100644 --- /dev/null +++ b/.config/nvim/after/ftplugin/qf.lua @@ -0,0 +1,31 @@ +local fn = vim.fn + +local wininfo = fn.getwininfo(fn.win_getid())[1] or {} +local is_loc = wininfo.loclist == 1 +local qftitle = wininfo.variables.quickfix_title + +vim.bo.buflisted = false +vim.wo.concealcursor = "n" +vim.wo.wrap = false + +-- easy close +vim.keymap.set("n", "q", "q", { buffer = true }) + +if is_loc then + -- simplify noisy :ltag output + if qftitle and string.match(qftitle, "^ltag") then + -- Hide ctags regex anchors + fn.matchadd("Conceal", [[\m|\zs\^\\V\|\\$\ze|]]) + + -- Hide lsp tagfunc line/col seek references + fn.matchadd("Conceal", [[\m|\zs\\Vcall cursor(\|)\ze|]]) + + -- highlight match in line. if tagname begins with / the rest is a \v + -- regex. match must be between vertical bars, so its the 2nd column. + local tagstack = fn.gettagstack() + if tagstack then + local tagmatch = string.gsub(tagstack.items[1].tagname, "^/", "\\v", 1) + fn.matchadd("Underlined", [[\m|.*\zs]] .. tagmatch .. [[\m\ze.*|]]) + end + end +end diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -50,22 +50,3 @@ end) autocmd(g, "BufReadPost", "*", function() fn.matchadd("Error", [[\m^\([<>|]\)\{7} \@=\|^=\{7}$]]) end) - --- >> nicer quickfix -autocmd(g, "BufReadPost", "quickfix", { - callback = function(ctx) - -- simplify noisy :ltag output - if string.match(vim.w.quickfix_title, "^ltag") then - -- Hide ctags regex anchors - fn.matchadd("Conceal", [[\m|\zs\^\\V\|\\$\ze|]]) - - -- highlight match in line. if tagname begins with / the rest is a \v - -- regex. match must be between vertical bars, so its the 2nd column. - local tagmatch = string.gsub(vim.fn.gettagstack().items[1].tagname, "^/", "\\v", 1) - fn.matchadd("Underlined", [[\m|.*\zs]] .. tagmatch .. [[\m\ze.*|]]) - end - - -- easy close - vim.keymap.set("n", "q", "q", { buffer = true }) - end, -})