.vimrc 中的键映射(重音)和编码问题

发布于 2025-01-03 19:34:33 字数 678 浏览 2 评论 0原文

我在 Vim 中映射时遇到了一个奇怪的问题。我使用的是 Azerty 键盘。

在我的 .vimrc 中,我有以下命令可以在段落之间快速移动:

nnoremap _ {
vnoremap _ {

nnoremap è }
vnoremap è }

但是,不考虑使用 è 的第二个映射。

启动后,如果我检查映射,我会得到 :verbose map _ 的信息,但没有 :verbose map è 的信息。

更糟糕的是,如果我实际上在运行时输入 nnoremap è },映射就会正确注册。

我认为这是一个编码问题,但我找不到解决方法。

我在 Debian Lenny 上使用 Vim 7.3。

我在 WinXP 上使用相同的 .vimrc,它在那里工作:唯一的区别是在 WinXP 上我事先使用 set encoding=latin1 ,而在 Debian 上,我没有更改默认编码是 utf-8

所以基本上,我的问题是为什么它的编码等于 latin1 而不是 utf-8 它有什么关系吗和è 被编码为 utf-8 中的多个字节?

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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

醉殇 2025-01-10 19:34:33

也许 .vimrc 文件编码不正确。

您可以使用 set fileencoding 查看它,并使用 :w ++enc=utf-8:w ++enc=iso-8859-1 更改它

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文