6

The answer is actually not as complicated as you might think. A trick that I have found very useful in situations similar to this is to remove the <cr> from the end of your mapping and see what comes up. If I do that and run 30<C-x>b, this pops up in the command line: :.,.+29call MyFunction(30) This is because it's basically like you typed 30:...


2

From :h insertcharpre: It is not allowed to change the text |textlock|. You need to delay the change with a one-shot autocmd, for example until the next TextChangedI is fired: fu! Test() abort au TextChangedI * ++once call setline(1, getline('.')) endfu augroup test au! au InsertCharPre * call Test() augroup END The ++once flag is provided ...


Only top voted, non community-wiki answers of a minimum length are eligible