LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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, 04:32 PM   #1
websinger
Member
 
Registered: Jul 2003
Location: Virginia
Distribution: Debian -sid
Posts: 34

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 04:33 PM.
 
Old 08-10-2006, 02:57 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,004
Blog Entries: 11

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
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 02:59 AM.
 
Old 08-10-2006, 09:35 AM   #3
websinger
Member
 
Registered: Jul 2003
Location: Virginia
Distribution: Debian -sid
Posts: 34

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 11:11 AM.
 
  


Reply

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


All times are GMT -5. The time now is 08:12 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration