开发者

Escape a double-quote in .vimrc

I'd want to add this mapping:

map <C-K> 开发者_JS百科"_dd

How do I escape that double quote so it won't be interpreted as a comment?


I think you’ll be fine.

From the manual:

                                                        *: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.

Notice how it says after a command — unfortunately, it can be difficult to tell what exactly is meant by the end of the command. Some commands (:edit) take only one argument, while others (:map, :help), can consume everything on the line.

In other words, using " after a :map should work fine without any special treatment, and I would stick to that as a guideline. If you find that it treats the " as the beginning of a comment, just use a backslash: \".


Just a guess. The issue is probably not with the mapping of a double-quote but the fact that <C-K> is noremapped somewhere else. Run the command :map and see if <C-K> is mapped elsewhere? If it cannot be remapped it will have an asterix.

I know minibufexplor.vim uses <C-K> so that could be your problem?

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜