LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-27-2005, 04:32 AM   #1
ilnli
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413

Rep: Reputation: 32
auto indentation


is there any script or program available to which we only give html or php file and that will automatically indent the code?
 
Old 03-27-2005, 05:51 AM   #2
mschutte
Member
 
Registered: Jan 2005
Location: Innsbruck, Austria
Distribution: Debian GNU/Linux Lenny
Posts: 68

Rep: Reputation: 15
I don't know if you like the type of its indentation, but try the editor Vim! It is an improved version of the old editor vi, and it supports automatic indentation. If you want to indent an existing file, open it:
$ vim filename
Then type (including the colon):
:setf php
-- or --
:setf html
and do the job with 'gg=GZZ' (without colon and without quotes). This will indent the file, save and exit.

Hope I could help!
 
Old 03-27-2005, 01:17 PM   #3
ilnli
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413

Original Poster
Rep: Reputation: 32
thanx mschutte you have shown me a new feature of vi.
I think you are an expert of vi. tell me other tips like this one.

but the think i was searching for is

Tidy
 
Old 03-27-2005, 07:14 PM   #4
thtr2k
Member
 
Registered: Mar 2005
Location: Australia
Posts: 71

Rep: Reputation: 15
edit a file .vimrc from your home directory.

Type:
vi .vimrc
Insert these lines in:
:set wrapmargin=2
:set textwidth=70
:set shiftwidth=3
:set tabstop=3

cheers

Last edited by thtr2k; 03-27-2005 at 07:19 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Backspace changing indentation OpenOffice 2 tobim Linux - Software 0 11-18-2005 02:51 PM
emacs' html indentation prell Linux - Software 1 05-26-2005 07:21 PM
indentation character in vim rhoekstra Linux - General 0 02-17-2005 07:41 AM
improving indentation in Kate JustinHoMi Linux - Software 4 02-12-2005 01:27 AM
Kate Automatic Indentation Quirk cuboidz Linux - Software 0 03-23-2004 01:58 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration