return function() local icons = { ui = require("modules.utils.icons").get("ui", true) } local actions = require("glance").actions require("modules.utils").load_plugin("glance", { height = 20, zindex = 50, preview_win_opts = { cursorline = true, number = true, wrap = true, }, border = { enable = require("core.settings").transparent_background, top_char = "―", bottom_char = "―", }, list = { position = "right", width = 0.33, -- 33% width relative to the active window, min 0.1, max 0.5 }, folds = { folded = true, -- Automatically fold list on startup fold_closed = icons.ui.ArrowClosed, fold_open = icons.ui.ArrowOpen, }, indent_lines = { enable = true }, winbar = { enable = true }, mappings = { list = { ["k"] = actions.previous, ["j"] = actions.next, [""] = actions.previous, [""] = actions.next, [""] = actions.previous_location, -- Bring the cursor to the previous location skipping groups in the list [""] = actions.next_location, -- Bring the cursor to the next location skipping groups in the list [""] = actions.preview_scroll_win(8), [""] = actions.preview_scroll_win(-8), [""] = actions.jump, ["v"] = actions.jump_vsplit, ["s"] = actions.jump_split, ["t"] = actions.jump_tab, ["c"] = actions.close_fold, ["o"] = actions.open_fold, ["[]"] = actions.enter_win("preview"), -- Focus preview window ["q"] = actions.close, ["Q"] = actions.close, [""] = actions.close, ["gq"] = actions.quickfix, }, preview = { ["Q"] = actions.close, ["q"] = actions.close, ["o"] = actions.jump, ["v"] = actions.jump_vsplit, ["s"] = actions.jump_split, ["t"] = actions.jump_tab, [""] = actions.previous_location, [""] = actions.next_location, ["[]"] = actions.enter_win("list"), -- Focus list window }, }, hooks = { before_open = function(results, open, _, method) if #results == 0 then vim.notify( "This method is not supported by any of the servers registered for the current buffer", vim.log.levels.WARN, { title = "Glance" } ) elseif #results == 1 and method == "references" then vim.notify( "The identifier under cursor is the only one found", vim.log.levels.INFO, { title = "Glance" } ) else open(results) end end, }, }) end