File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -35,3 +35,24 @@ function! cornelis#bind_input(key, result)
3535 endif
3636endfunction
3737
38+ function ! cornelis#unbind_input (key ) abort
39+ let l: cornelis_agda_prefix = get (g: , ' cornelis_agda_prefix' , ' <localleader>' )
40+ let l: lhs = l: cornelis_agda_prefix . substitute (a: key , ' |' , ' <bar>' , ' g' )
41+
42+ execute ' silent! iunmap <buffer> ' . l: lhs
43+ execute ' silent! cunmap <buffer> ' . l: lhs
44+
45+ if exists (' g:agda_input' ) && type (g: agda_input ) == type ({})
46+ let l: first = a: key [0 :0 ]
47+ let l: rest = (len (a: key ) > 1 ) ? a: key [1 :] : " \<CR> "
48+
49+ if has_key (g: agda_input , l: first )
50+ if has_key (g: agda_input [l: first ], l: rest )
51+ call remove (g: agda_input [l: first ], l: rest )
52+ endif
53+ if empty (g: agda_input [l: first ])
54+ call remove (g: agda_input , l: first )
55+ endif
56+ endif
57+ endif
58+ endfunction
You can’t perform that action at this time.
0 commit comments