The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
TO break a line aajan Shell Programming and Scripting 7 08-28-2007 04:12 AM
Sed Help (Using expression - line break) Janus Shell Programming and Scripting 2 02-16-2007 08:50 PM
Remove Line Break Rock Shell Programming and Scripting 5 02-06-2007 09:54 AM
Trim whitespace and add line break moose1 Shell Programming and Scripting 7 01-22-2007 01:53 PM
how to insert line break + string in vi (search & replace ) umen Shell Programming and Scripting 1 06-08-2006 11:42 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-06-2007
Skogsmulle Skogsmulle is offline
Registered User
  
 

Join Date: Jul 2007
Location: Karlshamn, Sweden
Posts: 2
Insert line break in vi's command mode

Hi,

When working in vi, the CTRL+j command for merging lines is very convenient. Is there an equivalent for splitting them (inserting a line break)? I often find myself pressing "i" + "return" + "esc", which I find a bit lengthy.

Thanks in advance!
  #2 (permalink)  
Old 07-06-2007
Shell_Life's Avatar
Shell_Life Shell_Life is offline
Registered User
  
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
There are several ways you can split a line in 'vi'.
It will also depend on your criteria:
1) If you want to split lines without a defined logic that you can use
a regular expression, the only way is "i+return+esc" then for the next
times, "." (period).

2) If you can use a logic where a regular expression can define it:
:%s/\(RegExp\)/\1^M/

Where:
RegExp: Regular Expression.
^M: ctl-M (entered as ctl-V+ctl-M)
  #3 (permalink)  
Old 07-06-2007
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
... or you can define a 'keymap' in ~/.exrc to map say 'F8' to '"i" + "return" + "esc"'
  #4 (permalink)  
Old 07-06-2007
Skogsmulle Skogsmulle is offline
Registered User
  
 

Join Date: Jul 2007
Location: Karlshamn, Sweden
Posts: 2
Thank you for your swift replies. I think I'll go and define myself a keymap then
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:03 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0