LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-02-2006, 10:57 AM   #1
dlublink
Member
 
Registered: Oct 2004
Location: Canada
Distribution: Ubuntu
Posts: 330

Rep: Reputation: 30
Vim re indent?


Hello,

I am using Vim to edit some PHP source code and enjoy the auto indentation features of vim. I was wondering, is there a command I can type to reindent a particular section of code or an entire file?

Thanks,

David
 
Old 10-02-2006, 12:07 PM   #2
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
http://truth.sk/vim/vimbook-OPL.pdf a good tutorial on how to use vim. Basically what you will want to do is highlight the selected amount of lines then use the set width property.
 
Old 10-02-2006, 01:11 PM   #3
dlublink
Member
 
Registered: Oct 2004
Location: Canada
Distribution: Ubuntu
Posts: 330

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by jstephens84
http://truth.sk/vim/vimbook-OPL.pdf a good tutorial on how to use vim. Basically what you will want to do is highlight the selected amount of lines then use the set width property.
I didn't find the width property spoken of. I found tab-width, textwidth but not the one you mentioned.

Highlighting and setting one of the above mentioned properties does nothing.

David
 
Old 10-02-2006, 01:37 PM   #4
dlublink
Member
 
Registered: Oct 2004
Location: Canada
Distribution: Ubuntu
Posts: 330

Original Poster
Rep: Reputation: 30
Hey,

I found what I was looking for. In command mode, one should type ==

== reindents the line.

If you highlight a section and hit == it will reindent it.

You can also do Number == to do a certain number of lines.

David
 
  


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
indent phoenix7 Linux - Software 6 08-30-2005 12:14 PM
A more sensible editor with indent Haraldsh Linux - Software 2 11-12-2004 06:49 AM
no indent jesus_edu Linux - Newbie 0 04-13-2004 10:45 AM
indent issues clockworks Linux - Software 0 02-09-2004 09:51 AM
indent chrismiceli Linux - General 1 05-12-2003 07:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:38 PM.

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