@@ -50,24 +50,24 @@ endfunction
50
50
function ! FMLParseMapping (mapping_line)
51
51
let pattern = ' \V\^\(\a\| \)\s\+' . s: fml_escaped_leader . ' \(\S\+\)\s\+\%(*\| \)\%(@\| \)\(\.\+\)'
52
52
let groups = matchlist (a: mapping_line , pattern)
53
- return { ' mode' : groups[1 ], ' lhs' : groups[2 ], ' rhs' : groups[3 ] }
53
+ return { ' id ' : substitute (groups[ 1 ] . ' _ ' . groups[ 2 ], ' ' , ' ' , ' ' ), ' mode' : groups[1 ], ' lhs' : groups[2 ], ' rhs' : groups[3 ] }
54
54
endfunction
55
55
56
56
function ! FMLAddDescription (src , mappings)
57
57
let src_lines = readfile (glob (a: src ))
58
58
let lines_with_index = map (deepcopy (src_lines), ' [v:key, v:val]' )
59
- let comments_by_lhs = {}
59
+ let comments_by_id = {}
60
60
for [idx, line ] in lines_with_index
61
- let lhs = matchlist (line , ' \c\m^\a* map.*<leader>\(\S\+\)' )
61
+ let lhs = matchlist (line , ' \c\m^\(\a*\) map.*<leader>\(\S\+\)' )
62
62
if (! empty (lhs))
63
63
let prev_line = src_lines[idx - 1 ]
64
64
let comment = matchlist (prev_line, ' ^"\s*\(.*\)' )
65
65
if (! empty (comment ))
66
- let comments_by_lhs [lhs[1 ]] = comment [1 ]
66
+ let comments_by_id [lhs[1 ] . ' _ ' . lhs[ 2 ]] = comment [1 ]
67
67
endif
68
68
endif
69
69
endfor
70
- return map (a: mappings , ' has_key(comments_by_lhs , v:val.lhs ) ? extend(v:val, {"desc": comments_by_lhs [v:val.lhs ]}) : v:val' )
70
+ return map (a: mappings , ' has_key(comments_by_id , v:val.id ) ? extend(v:val, {"desc": comments_by_id [v:val.id ]}) : v:val' )
71
71
endfunction
72
72
73
73
function ! FMLFormatMappings (source , mappings)
0 commit comments