문제

What’s the difference between single (') and double (") quotes in Vim? Does it make speed differences? Is it better to use one or another when running functions inside it? Does it matter at all?

I’m interested specifically in their use in the .vimrc file.

I’m asking because I find people use both in the same thing, and I’m wondering what are the differences. I tried to Google this, but wasn’t able to find anything.

도움이 되었습니까?

해결책

Double quotes allow for interpolation whereas single quotes do not.

For example, using double quotes :echo "foo\nbar" will output foo and bar on separate lines whereas :echo 'foo\nbar' will not interpret \n as a line break and will output foo\nbar literally.

For more info on different types of quotes type :h 41.2 for the help file and read the part near the end of the section with the heading STRING VARIABLES AND CONSTANTS.

This said, don't confuse quotes for strings with the double quote at the beginning of a line comment. Single quotes never start line comments, only double quotes do.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top