逃避.vimrc中的双引号

时间:2010-08-19 11:03:32

标签: vim

我想添加这个映射:

map <C-K> "_dd

如何逃避该双引号,以免被解释为评论?

2 个答案:

答案 0 :(得分:6)

我觉得你没事。

从手册:

                                                        *:quote*
'"' at the start of a line causes the whole line to be ignored.  '"'
after a command causes the rest of the line to be ignored.  This can be used
to add comments.  Example: >
        :set ai         "set 'autoindent' option
It is not possible to add a comment to a shell command ":!cmd" or to the
":map" command and friends, because they see the '"' as part of their
argument.

注意命令之后如何说 - 不幸的是,很难说出命令结尾的确切含义。有些命令(:edit)只接受一个参数,而其他命令(:map:help)可以使用该行的所有内容。

换句话说,在"之后使用:map可以在没有任何特殊处理的情况下正常工作,我会坚持这样做作为指导。如果您发现它将"视为评论的开头,请使用反斜杠:\"

答案 1 :(得分:0)

只是一个猜测。问题可能不在于双引号的映射,而是&lt; C-K&gt;的事实。在其他地方被noremap。运行命令:map并查看是否&lt; C-K&gt;映射到其他地方?如果它不能重新映射,它将有一个星号。

我知道minibufexplor.vim使用&lt; C-K&gt;这可能是你的问题?

希望这有帮助。

相关问题