Skip to content

Commit 8c648be

Browse files
authored
Feat: Add highlight for mentions (#324)
Feat: Adds hightlight for when Gitlab users are mentioned in comments or notes.
1 parent 3a73329 commit 8c648be

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

after/syntax/gitlab.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ if filereadable($VIMRUNTIME . '/syntax/markdown.vim')
22
source $VIMRUNTIME/syntax/markdown.vim
33
endif
44

5-
syntax match Username "@\S*"
5+
syntax match Username "\%([]\)\@<= @\S*"
6+
syntax match Mention "\%([] \)\@<!@\S*"
67
syntax match Date "\v\d+\s+\w+\s+ago"
78
syntax match ChevronDown ""
89
syntax match ChevronRight ""
@@ -11,6 +12,7 @@ syntax match Unresolved /\s-\s\?/
1112
syntax match Pencil //
1213

1314
highlight link Username GitlabUsername
15+
highlight link Mention GitlabMention
1416
highlight link Date GitlabDate
1517
highlight link ChevronDown GitlabChevron
1618
highlight link ChevronRight GitlabChevron

doc/gitlab.nvim.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ you call this function with no values the defaults will be used:
199199
reply = "r", -- Reply to comment
200200
toggle_node = "t", -- Opens or closes the discussion
201201
add_emoji = "Ea" -- Add an emoji to the note/comment
202-
add_emoji = "Ed" -- Remove an emoji from a note/comment
202+
delete_emoji = "Ed" -- Remove an emoji from a note/comment
203203
toggle_all_discussions = "T", -- Open or close separately both resolved and unresolved discussions
204204
toggle_resolved_discussions = "R", -- Open or close all resolved discussions
205205
toggle_unresolved_discussions = "U", -- Open or close all unresolved discussions
@@ -283,11 +283,15 @@ you call this function with no values the defaults will be used:
283283
colors = {
284284
discussion_tree = {
285285
username = "Keyword",
286+
mention = "WarningMsg",
286287
date = "Comment",
287288
chevron = "DiffviewNonText",
288289
directory = "Directory",
289290
directory_icon = "DiffviewFolderSign",
290291
file_name = "Normal",
292+
resolved = "DiagnosticSignOk",
293+
unresolved = "DiagnosticSignWarn",
294+
draft = "DiffviewNonText",
291295
}
292296
}
293297
})

lua/gitlab/colors.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ local colors = state.settings.colors
55
local discussion = colors.discussion_tree
66

77
vim.api.nvim_set_hl(0, "GitlabUsername", u.get_colors_for_group(discussion.username))
8+
vim.api.nvim_set_hl(0, "GitlabMention", u.get_colors_for_group(discussion.mention))
89
vim.api.nvim_set_hl(0, "GitlabDate", u.get_colors_for_group(discussion.date))
910
vim.api.nvim_set_hl(0, "GitlabChevron", u.get_colors_for_group(discussion.chevron))
1011
vim.api.nvim_set_hl(0, "GitlabDirectory", u.get_colors_for_group(discussion.directory))

lua/gitlab/state.lua

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ M.settings = {
7474
opacity = 1.0,
7575
edit = nil,
7676
comment = nil,
77+
note = nil,
7778
help = nil,
7879
pipeline = nil,
80+
reply = nil,
7981
squash_message = nil,
8082
temp_registers = {},
8183
},
@@ -89,9 +91,6 @@ M.settings = {
8991
edit_comment = "e",
9092
delete_comment = "dd",
9193
refresh_data = "a",
92-
open_in_browser = "b",
93-
copy_node_url = "u",
94-
publish_draft = "P",
9594
reply = "r",
9695
toggle_node = "t",
9796
add_emoji = "Ea",
@@ -100,16 +99,19 @@ M.settings = {
10099
toggle_resolved_discussions = "R",
101100
toggle_unresolved_discussions = "U",
102101
keep_current_open = false,
102+
publish_draft = "P",
103103
toggle_resolved = "p",
104-
relative = "editor",
105104
position = "left",
105+
open_in_browser = "b",
106+
copy_node_url = "u",
106107
size = "20%",
108+
relative = "editor",
107109
resolved = "",
108110
unresolved = "-",
109111
tree_type = "simple",
110112
toggle_tree_type = "i",
111-
toggle_draft_mode = "D",
112113
draft_mode = false,
114+
toggle_draft_mode = "D",
113115
},
114116
create_mr = {
115117
target = nil,
@@ -154,12 +156,12 @@ M.settings = {
154156
severity = vim.diagnostic.severity.INFO,
155157
virtual_text = false,
156158
use_diagnostic_signs = true,
159+
priority = 100,
157160
icons = {
158161
comment = "→|",
159162
range = " |",
160163
},
161164
skip_old_revision_discussion = false,
162-
priority = 100,
163165
},
164166
pipeline = {
165167
created = "",
@@ -177,6 +179,7 @@ M.settings = {
177179
colors = {
178180
discussion_tree = {
179181
username = "Keyword",
182+
mention = "WarningMsg",
180183
date = "Comment",
181184
chevron = "DiffviewNonText",
182185
directory = "Directory",

0 commit comments

Comments
 (0)