Hi,
I use VI to edit C code, but most (>90%) chance it breaks lines when I input characters. Which config file do I have to change or it is a bug? This is a sample of my code. I have no problem in RedHat7.3 /* * $Id: helloworld.c,v 1.1 2005/06/23 19:50:50 gavinl Exp $ * vi: set cindent sw=4 ts=4 tw=4 :syntax on : */ #include <stdio.h> #include <string.h> int main(int argc, char *argv) { printf("hello world!\n"); for (i=0;i<10;i++) { printf("i=%d\n", i); return 0; } return 0; }
On Wed, Oct 26, 2005 at 09:17:41AM -0400, Gavin Li wrote:
Hi,
I use VI to edit C code, but most (>90%) chance it breaks lines when I input characters. Which config file do I have to change or it is a bug? This is a sample of my code. I have no problem in RedHat7.3 /*
- $Id: helloworld.c,v 1.1 2005/06/23 19:50:50 gavinl Exp $
- vi: set cindent sw=4 ts=4 tw=4 :syntax on :
*/ #include <stdio.h> #include <string.h> int main(int argc, char *argv) { printf("hello world!\n"); for (i=0;i<10;i++) { printf("i=%d\n", i); return 0; } return 0; }
I'd say it's the tw=4 in the header of the file that's causing you the problem. It sets the text width to 4 so the lines won't be very long :-)
Did you pick the header up from elsewhere or did you construct it yourself ?
Kelly