diff --git a/README.md b/README.md index 186ad82..0fee1c4 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,11 @@ _cscope_maps_ comes with following defaults: -- change cwd to where db_file is located change_cwd = false, -- "true" or "false" }, + }, + + -- stack view defaults + stack_view = { + tree_hl = true, -- toggle tree highlighting } } ``` diff --git a/lua/cscope/stack_view/init.lua b/lua/cscope/stack_view/init.lua index 0e4e758..7164318 100644 --- a/lua/cscope/stack_view/init.lua +++ b/lua/cscope/stack_view/init.lua @@ -4,6 +4,10 @@ local hl = require("cscope.stack_view.hl") local utils = require("cscope_maps.utils") local M = {} +M.opts = { + tree_hl = true, -- toggle tree highlighting +} + -- m() -- -> a() -- -> b() @@ -159,7 +163,9 @@ M.buf_update = function() group = augroup, buffer = M.cache.sv.buf, callback = function() - hl.refresh(M.cache.sv.buf, root, #buf_lines) + if M.opts.tree_hl then + hl.refresh(M.cache.sv.buf, root, #buf_lines) + end M.preview_update() end, }) @@ -373,7 +379,8 @@ M.set_user_cmd = function() }) end -M.setup = function() +M.setup = function(opts) + M.opts = vim.tbl_deep_extend("force", M.opts, opts) M.set_user_cmd() end diff --git a/lua/cscope_maps/init.lua b/lua/cscope_maps/init.lua index f6bf4c3..9cd6a26 100644 --- a/lua/cscope_maps/init.lua +++ b/lua/cscope_maps/init.lua @@ -12,6 +12,7 @@ M.opts = { skip_input_prompt = false, -- "true" doesn't ask for input prefix = "c", -- prefix to trigger maps cscope = {}, -- defaults are in cscope.lua + stack_view = {}, -- defaults are in stack_view } -- function to print xcscpoe.el like prompts @@ -64,7 +65,7 @@ M.setup = function(opts) end cs.setup(M.opts.cscope) - require("cscope.stack_view").setup() + require("cscope.stack_view").setup(M.opts.stack_view) end return M