-   Linux - Newbie (
-   -   Moving around in vi (

dismas 12-08-2006 01:59 AM

Moving around in vi
I'm trying to write a collection of stories in vi so that at the same time as I'm writing, I can also learn vi. I realize that vi isn't really meant for this sort of thing.

Although, if a sentence runs over onto the next line, vi looks at this as a single line. So if I move up and down in the document, I move from one paragraph to the next instead of what is visually the next line up on the screen. Is there a way around this?

Also, if the answer is to just put in a hard return near the end of each line on the screen, is there an easy way to take out all those hard returns when I'm satisfied that I know vi and move the document into an actual word processor?

jerril 12-08-2006 02:29 AM

Hi Dismas;

I've never found an easy way to move line to line in that way. In vim 7.0, ctrl+left/right arrow will move the cursor one word either way. You can also use escape and use the "(" and ")" to move from sentence to sentence, then resume editing. That is actually the best way to use a modal text editor.

There are many ways to join lines after you have split them. The "J" command is used to join lines. However I rarely do this. I usually keep my lines pretty formatted using the external formatter: "!}fmt" from inside a paragraph will clean it up.

I use txt2tags for markup, the broken lines are joined together in it's processor. Paragraphs are always separated by at least one blank line.

I use text files for almost everything and Vim is my editor, I don't think I'd ever want to use anything else for any kind of writing.

Vi is a daunting editor to learn, but it is well worth the effort.

Good Luck


anamericanjoe 12-08-2006 02:41 AM

You can use the w command to move forward one word and the b command to move back one word. You can also use the $ command to move you to the end of the line and 0 to move you to the beginning of a line.

Broder 12-08-2006 03:26 AM

Another handy feature is esc :set list This will show you where the line breaks are, :set nolist to undo.

All times are GMT -5. The time now is 11:52 PM.