-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathinit.lua
More file actions
81 lines (67 loc) · 2.16 KB
/
init.lua
File metadata and controls
81 lines (67 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
local M = {}
---@class RefjumpKeymapOptions
---@field enable? boolean
---@field next? string Keymap to jump to next LSP reference
---@field prev? string Keymap to jump to previous LSP reference
---@class RefjumpHighlightOptions
---@field enable? boolean Highlight the LSP references on jump
---@field auto_clear boolean Automatically clear highlights when cursor moves
---@field clear_on_escape? boolean Listen for escape key to clear highlights (non-intrusive)
---@class RefjumpCounterOptions
---@field enable? boolean Show virtual text counter at end of line
---@field hl_group? string Highlight group for counter text
---@class RefjumpIntegrationOptions
---@field demicolon? { enable?: boolean } Make `]r`/`[r` repeatable with `;`/`,` using demicolon.nvim
---@class RefjumpOptions
---@field keymaps? RefjumpKeymapOptions
---@field highlights? RefjumpHighlightOptions
---@field counter? RefjumpCounterOptions
---@field integrations? RefjumpIntegrationOptions
---@field verbose? boolean Print message if no reference is found
local options = {
keymaps = {
enable = true,
next = ']r',
prev = '[r',
},
highlights = {
enable = true,
auto_clear = true,
clear_on_escape = false,
},
counter = {
enable = true,
hl_group = 'WarningMsg',
},
integrations = {
demicolon = {
enable = true,
},
},
verbose = true,
}
---@return RefjumpOptions
function M.get_options()
return options
end
---@param opts? RefjumpOptions
function M.setup(opts)
options = vim.tbl_deep_extend('force', options, opts or {})
if options.keymaps.enable then
require('refjump.keymaps').create_keymaps_autocmd(options)
end
if options.highlights.enable then
require('refjump.highlight').create_fallback_hl_group('LspReferenceText')
if options.highlights.auto_clear then
require('refjump.highlight').auto_clear_reference_highlights()
end
if options.highlights.clear_on_escape then
require('refjump.highlight').clear_on_escape()
end
end
if options.counter.enable then
require('refjump.counter').create_fallback_hl_group(options.counter.hl_group)
end
end
M.reference_jump = require('refjump.jump').reference_jump
return M