 | | From: | Mitzfar at hotmail.com | | Subject: | How to make vim AUTO newline when pasting text more than textwidth. | | Date: | 2 Jan 2005 17:34:41 -0800 |
|
|
 | Hi,
When I want to copy paste text from the web(by selecting it, and pressing middle mouse button) to vim, the text gets displayed as 1 line. How can I make it break up to fit the screen on several lines ?
Thanks.
PS : After searching for hours, I posted this question, so you can probably guess it will involve more than none set command only....
|
|
 | | From: | Sven Guckes | | Subject: | Re: How to make vim AUTO newline when pasting text more than textwidth. | | Date: | 3 Jan 2005 12:18:07 GMT |
|
|
 | * [2005-01-03]: > When I want to copy paste text from the web (by > selecting it, and pressing middle mouse button) to > vim, the text gets displayed as 1 line. How can I > make it break up to fit the screen on several lines?
":set nopaste tw=70" - or reformat the text after pasting with the gq command.
Sven
|
|
 | | From: | Joe Morris | | Subject: | Re: How to make vim AUTO newline when pasting text more than textwidth. | | Date: | Tue, 4 Jan 2005 20:29:41 +0000 (UTC) |
|
|
 | Not so long ago, Sven Guckes wrote: > * [2005-01-03]: > > When I want to copy paste text from the web (by > > selecting it, and pressing middle mouse button) to > > vim, the text gets displayed as 1 line. How can I > > make it break up to fit the screen on several lines?
> ":set nopaste tw=70" - or reformat the > text after pasting with the gq command.
Too cool. Never seen that one. Duly added to vimrc Now at a mere 18 lines (finally removed all my old C programming stuff!)
-- Joe Morris Live music in Atlanta jolomo@gmail.com http://jolomo.net/atlanta/shows.html
|
|
 | | From: | Felixk Karpfen | | Subject: | Re: How to make vim AUTO newline when pasting text more than textwidth. | | Date: | 7 Jan 2005 20:29:34 GMT |
|
|
 | * Sven Guckes [2005-01-03]: > * [2005-01-03]: >> When I want to copy paste text from the web (by >> selecting it, and pressing middle mouse button) to >> vim, the text gets displayed as 1 line. How can I >> make it break up to fit the screen on several lines? > > ":set nopaste tw=70" > A bit too cryptic for me. And the helpfile does not help at this address.
":h paste" says that "paste" is off by default -VIM - Vi IMproved 6.3 (2004 June 7, compiled Jul 11 2004 23:47:38)
It also says that "gvim" usually does the right thing when asked to paste.
Felix Karpfen -- Felix Karpfen Public Key 72FDF9DF (DH/DSA)
|
|
 | | From: | Sven Guckes | | Subject: | Re: How to make vim AUTO newline when pasting text more than textwidth. | | Date: | 8 Jan 2005 15:13:58 GMT |
|
|
 | * Felixk Karpfen [2005-01-07]: > * Sven Guckes [2005-01-03]: >> * [2005-01-03]: >>> When I want to copy paste text from the web (by >>> selecting it, and pressing middle mouse button) to >>> vim, the text gets displayed as 1 line. How can I >>> make it break up to fit the screen on several lines? >> >> ":set nopaste tw=70" > > A bit too cryptic for me.
"nopaste" turns off trhe triggers for expansion of abbreviations and mappings and also breaking of lines.
"tw=70" sets the textwidth to some value (70 is just an example), so that the pasted text will be broken after words end after that width.
> ":h paste" says .. It also says that "gvim" > usually does the right thing when asked to paste.
"usually", eh?
Sven
|
|
 | | From: | Leonardo B. Oliveira | | Subject: | Re: How to make vim AUTO newline when pasting text more than textwidth. | | Date: | Tue, 4 Jan 2005 16:11:06 -0200 |
|
|
 | and what about pressing shift+j? i.e., sometimes we would like to gathering two lines
For example:
lllllll lllllllll lllllllll lllllllllll jjjjjjj jjjjjjjjj jjjjjjjjj jjjjjjjjjjj
after pressing "J", we have:
lllllll lllllllll lllllllll lllllllllll jjjjjjj jjjjjjjjj jjjjjjjjj jjjjjjj= jjjj
but, in fact, i would like they fit textwidth.like this
lllllll lllllllll lllllllll lllllllllll jjjjjjj jjjjjjjjj jjjjjjjjj jjjjjjjjjjj
Of course, i can use gq, but i would like this automatically.
thx in advance
Leonardo
=09"A gente s=F3 sabe bem aquilo que n=E3o entende". =09=09=09=09 Guimar=E3es Rosa
On Mon, 3 Jan 2005, Sven Guckes wrote:
> * [2005-01-03]: > > When I want to copy paste text from the web (by > > selecting it, and pressing middle mouse button) to > > vim, the text gets displayed as 1 line. How can I > > make it break up to fit the screen on several lines? >=20 > ":set nopaste tw=3D70" - or reformat the > text after pasting with the gq command. >=20 > Sven >=20
|
|
 | | From: | Gary Johnson | | Subject: | Re: How to make vim AUTO newline when pasting text more than textwidth. | | Date: | Tue, 4 Jan 2005 20:20:50 +0000 (UTC) |
|
|
 | Leonardo B. Oliveira wrote: > > and what about pressing shift+j? i.e., sometimes > we would like to gathering two lines > > For example: > > lllllll lllllllll lllllllll lllllllllll > jjjjjjj jjjjjjjjj jjjjjjjjj jjjjjjjjjjj > > after pressing "J", we have: > > lllllll lllllllll lllllllll lllllllllll jjjjjjj jjjjjjjjj jjjjjjjjj jjjjjjjjjjj > > > but, in fact, i would like they fit textwidth.like > this > > lllllll lllllllll lllllllll lllllllllll jjjjjjj > jjjjjjjjj jjjjjjjjj jjjjjjjjjjj > > Of course, i can use gq, but i would like this > automatically.
Instead of typing 'J', type
gqj
Or, if you insist on using 'J',
nmap J gqj
HTH, Gary
|
|
 | | From: | Mitzfar at hotmail.com | | Subject: | Re: How to make vim AUTO newline when pasting text more than textwidth. | | Date: | 4 Jan 2005 22:40:01 -0800 |
|
|
 | Hi,
Thank you all for your contributions in making the copy paste thing simpler. Especially because you have proved me wrong, I really thought that no oneliner or standard command would exist.
However, things are not yet working as it should. When I press + middleB it just gets printed in 1 LOOOOOOOONG line. If I do gq or gqj nothing really happens.
Then at last I tried the command :set nopaste tw=70. When I do + middleB, I get the C++ program printed on more lines. However, very strangely, when I go out of insert mode the text disappears with an E61 Nested * . I have to state that I am using a .vimrc devoted to C++ .
|
|
 | | From: | Sven Guckes | | Subject: | Re: How to make vim AUTO newline when pasting text more than textwidth. | | Date: | 5 Jan 2005 09:39:16 GMT |
|
|
 | * Mitzfar@hotmail.com [2005-01-05]: > When I press + middleB it just gets printed in 1 > LOOOOOOOONG line. If I do gq or gqj nothing really happens.
understanding how it works may help.
> Then at last I tried the command :set nopaste tw=70. > When I do + middleB, I get the > C++ program printed on more lines.
duh
> However, very strangely, when I go out of insert mode > the text disappears with an E61 Nested * .
*this* seems weird.
> I have to state that I am using a .vimrc devoted to C++ .
here we go again.. version number, setup, reproducible example..
Sven
|
|
 | | From: | Gary Johnson | | Subject: | Re: How to make vim AUTO newline when pasting text more than textwidth. | | Date: | Mon, 3 Jan 2005 08:26:58 +0000 (UTC) |
|
|
 | Mitzfar@hotmail.com wrote: > Hi, > > When I want to copy paste text from the web(by selecting it, and > pressing middle > mouse button) to vim, the text gets displayed as 1 line. > How can I make it break up to fit the screen on several lines ?
This probably depends on how you have vim and your terminal configured, but I think that holding the shift key down while you press the middle mouse button will do what you want. Vim must be in insert mode at the time. This will make the contents of the cut buffer appear to vim as keystrokes from the keyboard instead of as a paste operation.
HTH, Gary
|
|