Skip to content

Commit 92f4f19

Browse files
CT0754e554c4c
authored andcommitted
mint cornelis#unbind_input
Signed-off-by: Cameron Wong <[email protected]>
1 parent 3764113 commit 92f4f19

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

autoload/cornelis.vim

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,24 @@ function! cornelis#bind_input(key, result)
3535
endif
3636
endfunction
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

0 commit comments

Comments
 (0)