+21
-8
lines changedFilter options
+21
-8
lines changed Original file line number Diff line number Diff line change
@@ -502,7 +502,7 @@ Note: When using mappings for Visual mode, you can use the "'<" mark, which
502
502
is the start of the last selected Visual area in the current buffer |'<|.
503
503
504
504
The |:filter| command can be used to select what mappings to list. The
505
-
pattern is matched against the {lhs} and {rhs} in the raw form.
505
+
pattern is matched against the {lhs}, {rhs} and {desc} in the raw form.
506
506
507
507
*:map-verbose*
508
508
When 'verbose' is non-zero, listing a key map will also display where it was
Original file line number Diff line number Diff line change
@@ -3433,8 +3433,8 @@ static void showmap(mapblock_T *mp, bool local)
3433
3433
{
3434
3434
size_t len = 1;
3435
3435
3436
-
if (message_filtered(mp->m_keys)
3437
-
&& mp->m_str != NULL && message_filtered(mp->m_str)) {
3436
+
if (message_filtered(mp->m_keys) && message_filtered(mp->m_str)
3437
+
&& (mp->m_desc == NULL || message_filtered((char_u *)mp->m_desc))) {
3438
3438
return;
3439
3439
}
3440
3440
Original file line number Diff line number Diff line change
@@ -877,6 +877,24 @@ describe('nvim_set_keymap, nvim_del_keymap', function()
877
877
eq("\nn lhs rhs\n map description",
878
878
helpers.exec_capture("nmap lhs"))
879
879
end)
880
+
881
+
it ('can :filter maps based on description', function()
882
+
meths.set_keymap('n', 'asdf1', 'qwert', {desc='do the one thing'})
883
+
meths.set_keymap('n', 'asdf2', 'qwert', {desc='doesnot really do anything'})
884
+
meths.set_keymap('n', 'asdf3', 'qwert', {desc='do the other thing'})
885
+
eq([[
886
+
887
+
n asdf3 qwert
888
+
do the other thing
889
+
n asdf1 qwert
890
+
do the one thing]],
891
+
helpers.exec_capture('filter the nmap'))
892
+
end)
893
+
894
+
it ('shows <nop> as map rhs', function()
895
+
meths.set_keymap('n', 'asdf', '<nop>', {})
896
+
eq('\nn asdf <Nop>', helpers.exec_capture('nmap asdf'))
897
+
end)
880
898
end)
881
899
882
900
describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function()
@@ -1037,9 +1055,4 @@ describe('nvim_buf_set_keymap, nvim_buf_del_keymap', function()
1037
1055
eq(1, exec_lua[[return GlobalCount]])
1038
1056
eq('\nNo mapping found', helpers.exec_capture('nmap asdf'))
1039
1057
end)
1040
-
1041
-
it ('shows <nop> as map rhs', function()
1042
-
meths.set_keymap('n', 'asdf', '<nop>', {})
1043
-
eq('\nn asdf <Nop>', helpers.exec_capture('nmap asdf'))
1044
-
end)
1045
1058
end)
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4