LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 08-09-2006, 03:32 PM   #1
websinger
Member
 
Registered: Jul 2003
Location: Virginia
Distribution: LMDE-2 3.11.2amd64
Posts: 35

Rep: Reputation: 15
vim c-formating unformated text


Is there a vim editor command that whould take
highlighted (but unformatted ) c code and
format it, inserting indents and line feeds
the documentation I looked at seems to be able to
set it up to do that on input but how about existing
text.

Last edited by websinger; 08-09-2006 at 03:33 PM.
 
Old 08-10-2006, 01:57 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
5 seconds on google ...

http://www.vim.org/htmldoc/indent.html
http://www.vim.org/tips/tip.php?tip_id=83


Cheers,
Tink

Last edited by Tinkster; 08-10-2006 at 01:59 AM.
 
Old 08-10-2006, 08:35 AM   #3
websinger
Member
 
Registered: Jul 2003
Location: Virginia
Distribution: LMDE-2 3.11.2amd64
Posts: 35

Original Poster
Rep: Reputation: 15
Thumbs up re vim indent

No, I saw those before I posted, they just didn't do what I was asking. This is what I am wondering about

1. hilighted existing unformated text
a. no line feeds
b. no indentation ( tabs or spaces )
c. block of text hilighted in visual mode

2. an editor directive ':somthing' that will
reformat the highlighted block of text c indentqation style.

somthing like-
Code:
#include <stdio.h> #include <stdlib.h> int main(){ printf(" %s \n","hello World"); return 0; }

Last edited by websinger; 09-08-2006 at 10:11 AM.
 
  


Reply

Tags
code, programming, vim



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
vim text wrap problem darknails Linux - Software 1 12-06-2005 06:54 AM
formating text thru awk slack66 Linux - Newbie 4 11-28-2005 11:20 AM
Text Reflow in Vim k4zau Linux - Software 4 02-29-2004 10:32 AM
Different editors -- messing up text formating bretzeltux Programming 4 02-16-2004 02:59 PM
command line text formating anyone? DavidPhillips Linux - General 2 11-25-2001 06:26 PM

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

All times are GMT -5. The time now is 07:20 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