用于快速键入'->'&'<-';在文本编辑器(vim)中


Common keyboard shortcut/binding/template for quickly typing '->' & '<-' in texteditor (vim)

在文本编辑器中键入'->'有哪些常见的键盘快捷键/绑定?如果这很重要的话,选择的文本编辑器是vim。

这是从哪里来的:我正在学习Haskell并键入'->'和'<-'对我来说似乎很烦人,我想知道是否有经验丰富的用户在编辑器中使用的常见模板/键绑定/快捷方式?

我想使用PHP的人在这里也会有所帮助。

如果使用Vim,您可以尝试定义一些更容易键入的缩写,比如(在命令模式下):

:ia -v ->

之后,在插入模式下键入的任何-v都将自动转换为->

参见

:h abbreviations

如果在任何时候你真的想键入-v,手册上写着:

To avoid the abbreviation in insert mode: Type part of
the abbreviation, exit insert mode with <Esc>, re-enter
insert mode with "a" and type the rest.  Or type CTRL-V
before the character after the abbreviation.

最好将这些缩写仅限于haskell文件,方法是在.virc文件中放入这样的内容:

autocmd FileType haskell ia -v ->