Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Key mapping (grave accent) and encoding issue in .vimrc

Tags:

vim

encoding

I have an odd problem with mapping in Vim. I am using an Azerty keyboard.

In my .vimrc, I have the following command to quickly move between paragraphs.:

nnoremap _ {
vnoremap _ {

nnoremap è }
vnoremap è }

However, the second mapping using è is not taken into account.

After startup, if I check the mapping, I got something for :verbose map _ but nothing for :verbose map è.

Worse, if I actually type nnoremap è }in runtime, the mapping is correctly registered.

I think this is an encoding issue, but I don't manage to find a work around.

I am using Vim 7.3 on Debian Lenny.

I am using the same .vimrc on WinXP, and it works there : the only difference is that on WinXP I am using set encoding=latin1 beforehand, while on Debian, I have not changed the default encoding which is utf-8

So basically, my question becomes why it works with encoding equals to latin1 and not utf-8 Does it have something to do with è being encoded in multiple bytes in utf-8 ?

like image 331
Xavier T. Avatar asked Mar 23 '26 23:03

Xavier T.


1 Answers

Perhaps the .vimrc file encoding is not correct.

You can see it using set fileencoding, and change it using :w ++enc=utf-8 or :w ++enc=iso-8859-1.

like image 149
Niloct Avatar answered Mar 26 '26 18:03

Niloct



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!