Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use single or double quotes in my .vimrc file?

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.

like image 802
greduan Avatar asked Nov 17 '12 22:11

greduan


1 Answers

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.

like image 136
Eric Mathison Avatar answered Sep 29 '22 10:09

Eric Mathison