File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -5,13 +5,22 @@ function! fall#internal#mapping#store() abort
55 let s: saved_maps = maplist ()- >filter ({ _, m - > m .mode == # ' c' || m .mode == # ' !' })
66endfunction
77
8+ " NOTE:
9+ "
10+ " It seems restore step must be called twice to restore the mappings correctly.
11+ " Otherwise, mappings with recursive references are not restored correctly.
12+ "
13+ " For example:
14+ "
15+ " cnoremap <Up> <C-p>
16+ " cnoremap <C-p> <Up>
17+ "
818function ! fall#internal#mapping#restore ()
919 if ! exists (' s:saved_maps' )
1020 return
1121 endif
1222 cmapclear
13- for l: m in s: saved_maps
14- call mapset (l: m )
15- endfor
23+ call foreach (s: saved_maps , {_, m - > mapset (m )})
24+ call foreach (s: saved_maps , {_, m - > mapset (m )})
1625 unlet s: saved_maps
1726endfunction
You can’t perform that action at this time.
0 commit comments