缩写扩展过程中,Vim停止注释继续

问题描述 投票:0回答:1

如果您的Vim设置在'formatoptions'中包含'r'(默认值),它将在插入模式下按[Enter]后自动插入当前注释首标,但这对于在其中扩展为单行注释的缩写来说是不希望的。没有单独的单行/多行注释字符的语言。

键入缩写字符后,按[Enter]时如何停止获取?

# ========
#
vim abbreviation
1个回答
0
投票
这是我所做的:

" Eat one character matching the given regex from the input stream, e.g. at " the end of an abbr expansion. (From :help abbreviations) func Eatchar(pat) let c = nr2char(getchar(0)) return (c =~ a:pat) ? '' : c endfunc set pastetoggle=<F12> iabbr <silent> sep # ========<F12><CR><F12><C-R>=Eatchar('\r')<CR>

此操作将用户的[Enter]按键替换为已生成的按键,并由已生成的按键包围,这些按键可在粘贴之前和之后将其关闭。最后的<C-R>完成<C-R>=序列。
© www.soinside.com 2019 - 2024. All rights reserved.