LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   is it possible to do this in VIM with line wrap on? (https://www.linuxquestions.org/questions/linux-software-2/is-it-possible-to-do-this-in-vim-with-line-wrap-on-436623/)

hedpe 04-19-2006 12:19 AM

is it possible to do this in VIM with line wrap on?
 
Hi,

I was wondering if it is possible, in VIM, if line wrap is on, that when you move the cursor it treats it as multiple lines.

What I mean is, say line wrap is on and I have the following typed in as a single line:
Code:

I hear Gentoo is a really cool distribution
and that many people should use it because
they would be really happy.

Lets say that my cursor is at the very end of the sentence. If I hit the up arrow, my cursor would go above "I hear Gentoo..."

What I would like it to do is to go between the u and the l of "should"

Is this possible with some key combination?

Thanks!
George

rhoekstra 04-19-2006 12:52 AM

Not to my knowledge.

What you COULD do is turn 'textwidth' on a certain column number, like '80'.
Code:

:set textwidth=80
This will introduce line breaks at the column you specify, causing one line be seperated in multiple lines, which will be convenient to type a whole story, not to worry about the text width (it wraps whole words).

If it is important that the line not be broken into multiple lines, you won't be able to achieve what you describe, I'm afraid.. if so, I'd be curious how... :)

Hope this helps in 'any' way..

hedpe 04-19-2006 01:24 AM

well it turns out some people in #vim on freenode have been helping me, you can actually use gj and gk to do what i want, however you cannot be in insert mode.

Therefore they're trying to help me bind something like ctrl+up or ctrl+down to gj and gk to do what i want

hope this helps you too :)

dive 04-19-2006 08:59 AM

Try starting it up with vim +':set textwidth=80' +':set wrap' then you can do exactly that. Also you don't need to remap keys.

hedpe 04-19-2006 12:09 PM

Quote:

Originally Posted by dive
Try starting it up with vim +':set textwidth=80' +':set wrap' then you can do exactly that. Also you don't need to remap keys.

that didn't work for me :\ it still skips lines

dive 04-19-2006 06:19 PM

Hmm. Maybe something in .vimrc is stopping it? I use that command in Mutt to edit emails and it works a charm.

Just tried it without a .vimrc and it still works. Maybe vim version?

vim --version
VIM - Vi IMproved 6.4 (2005 Oct 15, compiled Apr 16 2006 21:02:13)


All times are GMT -5. The time now is 03:19 PM.