vim中的数学符号

Fir*_*row 14 math vim

有谁知道如何让vim将数学符号的html实体转换为数学字符?

例如:

≠ 变成≠

∴ 变成∴

这是一个带有符号html实体http://barzilai.org/math_sym.htm的表


更新:Solved,bignose解决了这个问题.

使用:Vim的digraphs功能.使用Unicode的字符编码,

请参阅':help digraphs'获取文档

我仍然在寻找一种等宽的Unicode字体,所以它完全呈现,但有额外的空间,它的效果很好.

为了查看数学字符,UTF-8必须是编码和显示这些字符的字体.

我在vim配置文件中添加了以下内容.

创建自定义文件:mathdoc.vim in syntax /

" set the encoding to be utf-8, requires gVim or a terminal capable of
" unicode see ':help Unicode' for details
set encoding=utf-8
" requires a font that has characters for the higher uniocode symbols
set guifont=MS\ Gothic
Run Code Online (Sandbox Code Playgroud)

我将其添加到filetype以将其设置为我自己的自定义扩展名.txtmt

au BufNewFile,BufRead *.txtmt   setf mathdoc
Run Code Online (Sandbox Code Playgroud)

但你也可以打开文件来调用它:

:set ft=mathdoc
Run Code Online (Sandbox Code Playgroud)

digraphs效果很好,因为这里指定的bignose是它的工作原理

在插入模式下:按控制键+ k,然后按:

∴是S*

≠是!=

Σ是+ Z.

≡是= 3

⇐是<=

⇒是=>

⇔是==

∀是FA

∃是TE

∋是 - )

请参阅:有关完整列表的有向图*请注意,如果您只看到半个屏幕,那么字符编码不是unicode,unicode字符覆盖多个屏幕,请输入:set encoding = utf-8切换到utf-8.

上面链接中的表格包含了查找键盘快捷键所需字符的数字,例如8756是∴

big*_*ose 22

你想要Vim称之为"有向图":阅读:help digraphs它们是如何被使用的,并:digraphs在你的Vim中列出已定义的那些.

总结:在插入模式下,按Ctrl+ K(这会导致Vim显示突出显示?,等待进一步输入),然后定义两个字符的有向图.然后Vim用您定义的结果字符替换您键入的内容.例如Ctrl+ K,!,=产生'≠'.