@@ -96,10 +96,13 @@ function M.create(window, params)
9696 change = params .change ,
9797 }
9898
99- local map_opts = {
100- buffer = buf ,
101- nowait = true ,
102- }
99+ local function map_opts (desc )
100+ return {
101+ buffer = buf ,
102+ nowait = true ,
103+ desc = desc ,
104+ }
105+ end
103106
104107 for _ , chord in ipairs (utils .into_table (config .keys .diff .toggle_line )) do
105108 vim .keymap .set (" n" , chord , function ()
@@ -109,7 +112,7 @@ function M.create(window, params)
109112 lines = { line },
110113 file = File ,
111114 })
112- end , map_opts )
115+ end , map_opts ( " Toggle line under cursor " ) )
113116
114117 vim .keymap .set (" v" , chord , function ()
115118 local lines = get_selected_lines ()
@@ -120,7 +123,7 @@ function M.create(window, params)
120123 file = File ,
121124 })
122125 end )
123- end , map_opts )
126+ end , map_opts ( " Toggle selected line(s) " ) )
124127 end
125128
126129 for _ , chord in ipairs (utils .into_table (config .keys .diff .toggle_line_pair )) do
@@ -132,7 +135,7 @@ function M.create(window, params)
132135 file = File ,
133136 both_sides = true ,
134137 })
135- end , map_opts )
138+ end , map_opts ( " Toggle line pair under cursor (left + right) " ) )
136139
137140 vim .keymap .set (" v" , chord , function ()
138141 local lines = get_selected_lines ()
@@ -144,7 +147,7 @@ function M.create(window, params)
144147 both_sides = true ,
145148 })
146149 end )
147- end , map_opts )
150+ end , map_opts ( " Toggle selected line pair(s) (left + right) " ) )
148151 end
149152
150153 for _ , chord in ipairs (utils .into_table (config .keys .diff .toggle_hunk )) do
@@ -154,7 +157,7 @@ function M.create(window, params)
154157 line = vim .api .nvim_win_get_cursor (window )[1 ],
155158 file = File ,
156159 })
157- end , map_opts )
160+ end , map_opts ( " Toggle entire hunk under cursor " ) )
158161 end
159162
160163 for _ , chord in ipairs (utils .into_table (config .keys .diff .prev_hunk )) do
@@ -168,7 +171,7 @@ function M.create(window, params)
168171 break
169172 end
170173 end
171- end , map_opts )
174+ end , map_opts ( " Go to prev hunk " ) )
172175 end
173176
174177 for _ , chord in ipairs (utils .into_table (config .keys .diff .next_hunk )) do
@@ -181,7 +184,7 @@ function M.create(window, params)
181184 break
182185 end
183186 end
184- end , map_opts )
187+ end , map_opts ( " Go to next hunk " ) )
185188 end
186189
187190 for _ , chord in ipairs (utils .into_table (config .keys .diff .toggle_focus )) do
@@ -190,7 +193,7 @@ function M.create(window, params)
190193 type = " toggle-focus" ,
191194 side = params .side ,
192195 })
193- end , map_opts )
196+ end , map_opts ( " Toggle focused window between left/right " ) )
194197 end
195198
196199 config .hooks .on_diff_mount ({ buf = buf , win = window })
0 commit comments