Home  |  Forums  |  914 Info  |  Blogs
 
914World.com - The fastest growing online 914 community!
 
Porsche, and the Porsche crest are registered trademarks of Dr. Ing. h.c. F. Porsche AG. This site is not affiliated with Porsche in any way.
Its only purpose is to provide an online forum for car enthusiasts. All other trademarks are property of their respective owners.
 

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> OT: vim commands...., Already googled it...
bd1308
post Aug 16 2005, 09:58 PM
Post #1


Sir Post-a-lot
*****

Group: Members
Posts: 8,020
Joined: 24-January 05
From: Louisville,KY
Member No.: 3,501



I googled it and came up with information, but none of it could prove to be useful.

if i write something long, like a story or something and I want to edit a word in the middle, is there any way to skip line by line through the wrapped "line" in vim? or do I just have to use the right arrow key for ten days to go through each letter until i get the right one?
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Dr. Roger
post Aug 16 2005, 11:03 PM
Post #2


A bat out of hell.
****

Group: Members
Posts: 3,944
Joined: 31-January 05
From: Hercules, California
Member No.: 3,533
Region Association: Northern California



In command mode....

:1, $s/word/anotherword/g will replace word with anotherword throughout the file.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
mightyohm
post Aug 17 2005, 12:07 AM
Post #3


Advanced Member
****

Group: Benefactors
Posts: 2,277
Joined: 16-January 03
From: Seattle, WA
Member No.: 162
Region Association: Pacific Northwest



hit enter every once in a while instead of entering huge wrapped lines, vim wasn't intended to be a word processor (in that sense)
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
bd1308
post Aug 17 2005, 05:12 AM
Post #4


Sir Post-a-lot
*****

Group: Members
Posts: 8,020
Joined: 24-January 05
From: Louisville,KY
Member No.: 3,501



thanks guys. It's a shame though, because vim WAS meant to be way more than just a small editor for files.

mutt uses it.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
Gint
post Aug 17 2005, 05:38 AM
Post #5


Mike Ginter
***************

Group: Admin
Posts: 16,075
Joined: 26-December 02
From: Denver CO.
Member No.: 20
Region Association: Rocky Mountains



Look at the man page and other reference material for vi. vim uses similar commands.

Use "/" and then enter your search term or string. Then use "n" to go to the next of your search terms throughout the file. Then you can use standard vi like replace commands.

Roger came very cose. ":1" will take you to line 1, a different number will take you to that line. "Cntrl-g" will show you what line your actually on of how many lines in the file BTW. Use ":" to enter command mode if not already there. Then, %s/wordtoreplace/newword vim doesn't seem to require the "g" and the end to make the change global as vi does. So if you only want to change one word, you'll have to use the first method I listed (or one of many other's) or otherwise figure that out on your own.

Jeff's advice is good also. I always use manual line breaks with vi in a long file. It's only a text editor. It wasn't intended for desktop publishing.

Buy a book! Find a good tech forum. You can usually search and find answers to these types f questions on a good firum for the subject matter.
User is online!Profile CardPM
Go to the top of the page
+Quote Post
bd1308
post Aug 17 2005, 05:50 AM
Post #6


Sir Post-a-lot
*****

Group: Members
Posts: 8,020
Joined: 24-January 05
From: Louisville,KY
Member No.: 3,501



thanks guys.


(IMG:http://www.914world.com/bbs2/html/emoticons/smile.gif)
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
mightyohm
post Aug 17 2005, 10:07 AM
Post #7


Advanced Member
****

Group: Benefactors
Posts: 2,277
Joined: 16-January 03
From: Seattle, WA
Member No.: 162
Region Association: Pacific Northwest



vim also has very, very extensive online help.

i used to use it every day a few years ago, now I stumble around in it like everyone else, but at least I am not terrified every time some unix app pops me into vi like i used to be.

(IMG:http://www.914world.com/bbs2/html/emoticons/biggrin.gif)

PS: If you are used to Word, you are expecting that text will be automatically formatted to fit the page when you keep typing (without making your own line breaks). vim takes a simpler approach and lets you define the line breaks. I am guessing this is because in some programming languages line breaks define instructions and you wouldn't want the text editor to decide on the line structure for you.

vim is extremely powerful and hands down my favorite editor for coding, it is very fast and very coder-friendly. To tell you the truth, you can probably enable a feature to give it Word style line wraps/autoformatting. The preferences options are a mile long. Some versions also have a syntax highlighting feature for various programming languages, which is VERY cool. Check it out.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 17th May 2024 - 07:52 PM