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?
You can start from this little script which I coded and add some improvements in order to fit your needs:
Note: to get the
^M
in the code please type ctrl+v EnterName and save the file ex:
script.vim
and call it after that by the command ":source script.vim
"Here is the example: ( 30 characters - Limit -):
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: