Main Page | Report this Page
Computers Forum Index  »  Computer - Editors  »  [vim] prettify...
Page 1 of 1    

[vim] prettify...

Author Message
Martin Trautmann...
Posted: Wed Aug 26, 2009 12:31 pm
Guest
Hi all,

does vim include any prettify functions? The syntax highlighting does
know the key words. The bracket operation does know about begin and end
of levels.

Thus a prettify would be very nice which would fix a broken indention, a
mix of tabs and spaces etc.

Otherwise: are there any recommendations e.g. for an external perl
script which would be called from within vim?

It should offer a good default setup, while I would prefer to improve
the setup for my needs, e.g. for verilog .v


task abc;
input x; // my comment
register y; // another comment
begin
if (x == 1)
do_nothing;
end else
y = 1;
end
end
endtask // abc
 
Martin Trautmann...
Posted: Wed Aug 26, 2009 4:52 pm
Guest
On 26 Aug 2009 15:35:41 GMT, Gary Johnson wrote:
Quote:
Martin Trautmann <t-use at (no spam) gmx.net> wrote:
Hi all,

does vim include any prettify functions? The syntax highlighting does
know the key words. The bracket operation does know about begin and end
of levels.

Thus a prettify would be very nice which would fix a broken indention, a
mix of tabs and spaces etc.

Broken indentation can be fixed with the = command. See

:help =
:help 30.3

Thanks, I did not know "equalprg" yet.

Quote:
A mix of tabs and spaces can be changed to all spaces with

:set expandtab
:retab

That's appropriate to work on reasonable tab/space mixed to have one or
the other.

Quote:
If instead you execute these:

:set noexpandtab
:retab

vim will replace sequences of tabs and/or spaces at the start of lines with
the fewest tabs and spaces that will result in the same indentation.
See

:help expandtab
:help retab

Yes, I know those.

Quote:
However, vim has no built-in way to prettify code by moving elements
(e.g., braces) from one line to another.

I need something for files where a dozen of people have been working on,
with different shiftwidth options such as 2, 3, 4 or 8. Some working
with vi or vim, some with emacs, some with notepad++, some with notepad
or maybe even worse. That is: the files are a complete mess.

Thus I'd like to clean up whatever I touch.

- Martin
 
Gary Johnson...
Posted: Wed Aug 26, 2009 7:35 pm
Guest
Martin Trautmann <t-use at (no spam) gmx.net> wrote:
Quote:
Hi all,

does vim include any prettify functions? The syntax highlighting does
know the key words. The bracket operation does know about begin and end
of levels.

Thus a prettify would be very nice which would fix a broken indention, a
mix of tabs and spaces etc.

Broken indentation can be fixed with the = command. See

:help =
:help 30.3

A mix of tabs and spaces can be changed to all spaces with

:set expandtab
:retab

If instead you execute these:

:set noexpandtab
:retab

vim will replace sequences of tabs and/or spaces at the start of lines with
the fewest tabs and spaces that will result in the same indentation.
See

:help expandtab
:help retab

However, vim has no built-in way to prettify code by moving elements
(e.g., braces) from one line to another.

--
Gary Johnson
 
 
Page 1 of 1    
All times are GMT
The time now is Sun Nov 29, 2009 1:45 am