LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 07-21-2006, 03:09 AM   #1
EAD
Member
 
Registered: Mar 2006
Distribution: ARCH linux
Posts: 137

Rep: Reputation: 15
Question How to copy paste into VIM ?


Hi.
Some times I have some info from the web or somehere else I want to copy paste into my VIM editror, When I am doing the way I know that is select with the mouse, then copy and i in VIM and shift+insert, It is al not indent at all.
I get something like
The big fox
jump over{
gfgdf
fg
}

well you got the point, so what can I do? I am using VIM 7 btw.

 
Old 07-21-2006, 03:37 AM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Press i for insert (or a for append), and then press "shift-insert".
 
Old 07-21-2006, 03:55 AM   #3
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,242
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
press v to start the selection of a block. use the arrow keys to allocate the selection. then press y to set copy or press x to set cut. press p to paste.
 
Old 07-21-2006, 04:03 AM   #4
prozac
Member
 
Registered: Oct 2005
Location: Australia
Distribution: slackware 12.1
Posts: 753

Rep: Reputation: 32
if you have 3 button mouse, here is another idea. just highlight any text you would like to paste, fire up vi go into insert mode and just middle_click (the wheel). mind you it only works under X though and I have only tested it with konsole.
 
Old 07-21-2006, 04:13 AM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,950
Blog Entries: 11

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
Quote:
Originally Posted by EAD
Hi.
Some times I have some info from the web or somehere else I want to copy paste into my VIM editror, When I am doing the way I know that is select with the mouse, then copy and i in VIM and shift+insert, It is al not indent at all.
I get something like
The big fox
jump over{
gfgdf
fg
}

well you got the point, so what can I do? I am using VIM 7 btw.

:confused:
My understanding is that vim uses the extension of a file
to do indentation proper. To me that suggests that you're
not using vim like so:
vim my_source.c
and then copy & paste, but rather just fire up vim and paste
into it, which kind of deprives it of its means to tell what indentation
model it's meant to be using?


Cheers,
Tink
 
Old 07-21-2006, 04:28 AM   #6
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,242
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
just in case you're using konsole, the moment you paste a text to vi (using the mouse of course), it's just the same as typing all the characters you copied (based on my observation). so you must press i or anything that will set vi to edit mode before pasting the values.

Edit: i tested copying a c code then pasting it to vi and i got no prob . my vim version is 6.3 2004 june

Last edited by konsolebox; 07-21-2006 at 04:31 AM.
 
Old 07-21-2006, 04:54 AM   #7
sailu_mvn
Member
 
Registered: Sep 2004
Location: Hyderabad
Distribution: FEDORA,REDHAT,HOST
Posts: 440
Blog Entries: 1

Rep: Reputation: 30
use yy to copy and p to paste .
Dont press any insert
Its the easiest way
 
Old 07-21-2006, 04:58 AM   #8
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,242
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
oh yes i remember. that's when you duplicate lines. you can also cut and paste lines using dd to cut and p paste.
 
Old 07-21-2006, 09:47 AM   #9
EAD
Member
 
Registered: Mar 2006
Distribution: ARCH linux
Posts: 137

Original Poster
Rep: Reputation: 15
you guys didnt under stand!!!
I meant, that I now all the P and yy and i and so on.

I want to take a full text from the www, and like when putting it on a notepad and everything works nice, excat copy, just like it I want it to copy to vim.
Is it possible? and if so . how?
 
Old 07-21-2006, 10:19 AM   #10
jayemef
Member
 
Registered: Aug 2005
Location: Juniata College, PA
Distribution: Ubuntu, Slackware
Posts: 67

Rep: Reputation: 15
Sometimes, depending on how Vi is configured (from .vimrc or globally), particularly with any sort of smart indentation, copy and paste can get kinda funky. This is where the :set paste command comes in. While in command mode, just press :set paste, do your pasting as you normally would, and then press Esc to exit. I've had a lot of success with this method.
 
Old 07-22-2006, 11:39 AM   #11
EAD
Member
 
Registered: Mar 2006
Distribution: ARCH linux
Posts: 137

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jayemef
Sometimes, depending on how Vi is configured (from .vimrc or globally), particularly with any sort of smart indentation, copy and paste can get kinda funky. This is where the :set paste command comes in. While in command mode, just press :set paste, do your pasting as you normally would, and then press Esc to exit. I've had a lot of success with this method.
Will it work if I need to paste from something outside VIM ? like www ?
 
Old 07-22-2006, 12:21 PM   #12
jayemef
Member
 
Registered: Aug 2005
Location: Juniata College, PA
Distribution: Ubuntu, Slackware
Posts: 67

Rep: Reputation: 15
Yes, that is what it's for. Vi, as you and others already stated, has commands for copy/pasting lines within the same document.
 
Old 09-05-2006, 12:14 AM   #13
Kovacs
Member
 
Registered: Jul 2003
Distribution: FreeBSD 8.2 RELEASE
Posts: 607

Rep: Reputation: 30
Select the text from your browser, enter insert mode in vim and then hold down shift and middle click to paste the text into vim in your terminal.
 
Old 09-05-2006, 12:22 AM   #14
jayakrishnan
Member
 
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 991

Rep: Reputation: 30
shift+insert is the easiest option
 
Old 12-12-2006, 07:56 AM   #15
gulch
LQ Newbie
 
Registered: Dec 2006
Posts: 3

Rep: Reputation: 0
Quote:
Originally Posted by jayakrishnan
shift+insert is the easiest option
thanks, I think it is the best answer
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
cygwin vim copy/paste problem takahaya Linux - Software 2 03-31-2006 01:16 AM
What is with copy and paste? General General 16 12-23-2005 06:37 PM
copy/paste help abk4523 Linux - Newbie 4 05-31-2005 06:29 AM
Copy Paste zaicheke Linux - Software 8 04-09-2005 04:45 AM
how to copy and paste acd copy cd paschim Linux - General 2 04-05-2004 09:25 AM


All times are GMT -5. The time now is 04:26 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration