From f6ccb1ba2b34bb638782873f92e60e52c2d8e094 Mon Sep 17 00:00:00 2001 From: Cameron Wong Date: Mon, 27 Oct 2025 15:53:17 -0400 Subject: [PATCH 1/2] mint cornelis#unbind_input Signed-off-by: Cameron Wong --- autoload/cornelis.vim | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/autoload/cornelis.vim b/autoload/cornelis.vim index cd04b22..3a9f6b0 100644 --- a/autoload/cornelis.vim +++ b/autoload/cornelis.vim @@ -35,3 +35,24 @@ function! cornelis#bind_input(key, result) endif endfunction +function! cornelis#unbind_input(key) abort + let l:cornelis_agda_prefix = get(g:, 'cornelis_agda_prefix', '') + let l:lhs = l:cornelis_agda_prefix . substitute(a:key, '|', '', 'g') + + execute 'silent! iunmap ' . l:lhs + execute 'silent! cunmap ' . l:lhs + + if exists('g:agda_input') && type(g:agda_input) == type({}) + let l:first = a:key[0:0] + let l:rest = (len(a:key) > 1) ? a:key[1:] : "\" + + if has_key(g:agda_input, l:first) + if has_key(g:agda_input[l:first], l:rest) + call remove(g:agda_input[l:first], l:rest) + endif + if empty(g:agda_input[l:first]) + call remove(g:agda_input, l:first) + endif + endif + endif +endfunction From e01cad898a879fa74eeaabec111b7c395888a308 Mon Sep 17 00:00:00 2001 From: Cameron Wong Date: Mon, 27 Oct 2025 15:56:07 -0400 Subject: [PATCH 2/2] documentation Signed-off-by: Cameron Wong --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index f2f8b5a..3b16aa8 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,10 @@ call cornelis#bind_input("nat", "ℕ") will add `nat` as an input remapping for `ℕ`. +The inverse of `cornelis#bind_input("foo", "...")` is `cornelis#unbind_input("foo")`. +Note that this cannot and will not attempt to undo any custom agda-input +management, such as through `g:cornelis_bind_input_hook` (see below). + #### Custom Hooks