I tend to enable auto-wrap :
:set textwidth=80
:set formatoptions+=wt
But I don't want to wrap when I input a long string in quotes when I coding with C or javascript, because it will be error; Can I configure my vim auto-wrap exclude quotes? or auto typing '\' before wrapping this line?
Your settings are wrapping the lines by adding carriage return and which cause problem while compiling.
Instead you can use the
wrap
option which is a virtual wrap and doesn't affect the lines: