matchit.zip icon indicating copy to clipboard operation
matchit.zip copied to clipboard

Avoid using :normal since it can conflict with :langmap

Open benjifisher opened this issue 9 years ago • 1 comments

There are several places in the script that use :normal, such as

    normal! H

This can break if the user has set the 'langmap' option, for example

:set langmap=HI;IH

See neovim/neovim#3271 for a real-world example of this problem.

We should try to remove all uses of :normal in the script. It is used about 11 times.

For example, it should be easy to replace :normal in these lines, which move the cursor around and restore the screen, with the winsaveview() and winrestview() functions, which were added to vim after matchit was first written.

benjifisher avatar Sep 01 '15 02:09 benjifisher

Seems like the real bug is with langmap (since vim times before neovim). The langmap feature should be able to swap keys as if it were happening outside of (neo)vim and all code written (like normal! H) should just work with the new keys (maps and noremaps should work as well). The langmap feature should behave as if the operating system had remapped keys and (neo)vim was obvlious to it.

cc @fdinoff

trusktr avatar Sep 10 '15 21:09 trusktr