New answers tagged

0

This should work to clear all Insert-mode mappings starting with space: let l:map = mapcheck(' ', 'i') while !empty(l:map) execute 'iunmap' l:map let l:map = mapcheck(' ', 'i') endwhile Unfortunately, there is no way to restrict mapcheck to buffer-local mappings only; however, the ugly loop does let us sidestep parsing command output, which may be ...


3

You can try to analyze the result of split(execute('imap <buffer> <space>'), "\n") From there, keep only the second field (IIRC). => ->map({k,v -> split(v)[1]}), and generate the clearing commands, => prefer ->map({k,v -> 'iunmap <buffer> '.split(v)[1]}) And finally ->execute(). TL;DR :call execute('imap <...


2

If your insert mode mappings are filetype specific then .vim/after/plugin/map.vim and autocmd VimEnter * imapclear would not work as they are executed before fitetype creates them. Also imapclear deletes all insert mode mappings including default ones. You can try to apply imapclear <buffer> on bufread/filetype event though: using after/ftplugin create ...


Top 50 recent answers are included