LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   vim align c file (https://www.linuxquestions.org/questions/linux-newbie-8/vim-align-c-file-758286/)

saurin 09-28-2009 01:20 PM

vim align c file
 
I want to align c file which is randomly written.
I use the command gg=G, which align the entire c
file but unable to adjust within 80 colums.
i set the textwidth 80 using following command
:set textwidth=80
but unable to align file vertically.

Would somebody please help me to find the solution

nuwen52 09-28-2009 02:42 PM

I'm not sure what you are looking for, but a program that might help is called "indent". There is a -l option which sets the maximum line length. This program is designed to correctly indent (format) programs written in C to make them more readable. Try "man indent" for more details.

chrism01 09-28-2009 06:14 PM

You may want the wrap and wrapmargin options http://www.ph.unimelb.edu.au/~ssk/vim/options.html

cola 01-03-2010 04:35 AM

Quote:

Originally Posted by saurin (Post 3699676)
I want to align c file which is randomly written.
I use the command gg=G, which align the entire c
file but unable to adjust within 80 colums.
i set the textwidth 80 using following command
:set textwidth=80
but unable to align file vertically.

Would somebody please help me to find the solution

Code:

:set indent plugin on
:set textwidth=80

Now
Code:

gg=G

whk 01-03-2010 03:42 PM

:set paste
before you copy/paste anything
:set nopaste
to end it
hths


All times are GMT -5. The time now is 09:10 AM.