Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 08-09-2006, 03:32 PM   #1
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

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

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


Last edited by Tinkster; 08-10-2006 at 01:59 AM.
Old 08-10-2006, 08:35 AM   #3
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-
#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.


code, programming, vim

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:41 PM.

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