Kim Schulz <[EMAIL PROTECTED]> 写于 2006-11-13 04:29:53: > I am currently looking into different tricks for formatting text, > code, etc. in Vim. > I guess most users know the format-paragraph command gqq or the > reindent entire code 1G=G > But are there any other neat tricks - which ones are your favorites? > --
Hi, I use GNU indent some time, it should come with most Linux distribution (or you could just install the 'indent' package) and act as a filter. In Windows you could found it in Cygwin. so the command should be :%!indent, or you could just select a paragraph with the visual mode and !indent. GNU indent is fully customizable (write you own rc in ~/.indent.pro), it can reformat the long paragraphs and add/remove spaces between tokens. Develop your own .indent.pro file and it may save huge time in the future for you. The only issue for GNU indent: it supports only Unix text file, so you should :set ff=unix before calling the GNU indent from within Vim. -- Sincerely, Pan, Shi Zhu. ext: 2606
