LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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
  Search this Thread
Old 11-11-2009, 01:02 PM   #1
blastradius
Member
 
Registered: Oct 2004
Location: Cheshire, England
Distribution: Debian Stable
Posts: 269

Rep: Reputation: 39
How do I paste into Vim


Just getting used to Vim (please don't start the Vim vs Emacs thing, I've tried both and made my choice :-) )

How do I paste into Vim if I've copied from elsewhere? this only came to light when I wanted to paste some source code from Firefox into Vim and I just can't do it.

Is there something that I am missing or isn't it possible.

Thanks

Eric
 
Old 11-11-2009, 01:09 PM   #2
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
It likely depends on the virtual terminal app you're using.

For example: I believe a default gnome-terminal configuration will paste with the Ctrl+Shift+V key combo. (Don't forget to enter editing mode and position your cursor in vim first...)
 
Old 11-11-2009, 01:12 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,808

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Always try right-clicking. I have discovered all manner of things by doing this. In Konsole, eg, there is copy and paste, plus several other things including the configuration menu.
 
Old 11-11-2009, 01:15 PM   #4
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1242Reputation: 1242Reputation: 1242Reputation: 1242Reputation: 1242Reputation: 1242Reputation: 1242Reputation: 1242Reputation: 1242
In konsole 'paste' is assigned the following keys Shiff+Ctrl+insert
 
Old 11-11-2009, 01:37 PM   #5
blastradius
Member
 
Registered: Oct 2004
Location: Cheshire, England
Distribution: Debian Stable
Posts: 269

Original Poster
Rep: Reputation: 39
Thanks for the quick replies.

ctrl + shift + v pastes into the terminal but chops off the first letter which is odd. I can paste into GVim selecting from the menu but what on earth does the keybinding "+gP mean!
 
Old 11-11-2009, 03:13 PM   #6
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Hi blastradius,

before pasting with shift+ctrl+v you'll have to enter the insert-mode in vim (press for example the i- or a-character). Otherwise the text will be inserted beginning with the first character which enters the insert mode.

Markus
 
Old 11-11-2009, 04:35 PM   #7
wit_273
Member
 
Registered: Mar 2007
Location: Nebraska
Distribution: CentOS
Posts: 82

Rep: Reputation: 15
To copy/cut paste in vim you user delete, yank, and paste. The vim wiki has instructions for doing this at http://vim.wikia.com/wiki/Copy,_cut_and_paste. The Ctrl functions used in many text editors will not always work in vi(m). But delete, yank, and paste will always work--so this is the best way to learn (and get in the habit) of doing when in vi(m).
 
Old 11-11-2009, 05:34 PM   #8
manwithaplan
Member
 
Registered: Nov 2008
Location: ~/
Distribution: Arch || Sidux
Posts: 393

Rep: Reputation: 45
I can't stand Vim ... completely crazy idea for an editor .. IMHO Sry, just needed to rant.
 
Old 11-11-2009, 07:21 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,873

Rep: Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600
You can't use the yank etc cmds if you're copying from an external src as per OP.

In FF, use highlight+Ctrl-C to copy, the move mouse to vim editor, press 'i' to go into insert mode (or <esc>i to make sure you are in right mode), then right-click to paste.
If right-click has issues, try the paste option from whatever terminal menu is avail
 
Old 11-11-2009, 09:17 PM   #10
karlochacon
Member
 
Registered: Dec 2006
Posts: 109

Rep: Reputation: 17
why nobody likes nano?
 
Old 11-11-2009, 09:58 PM   #11
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,808

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
I love nano---and my name is not "nobody"........
 
Old 11-11-2009, 10:15 PM   #12
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Also... if you are pasting into Vim from an outside source you might get odd tabbing behavior. To fix this turn on paste mode (set paste / set nopaste).

Quote:
Originally Posted by karlochacon View Post
why nobody likes nano?
While I'm sure somebody likes nano, I don't like text editors that can mangle your file with their default wrap behavior...

Last edited by jtshaw; 11-11-2009 at 10:19 PM. Reason: Added paste on/off commands...
 
Old 11-12-2009, 01:23 AM   #13
blastradius
Member
 
Registered: Oct 2004
Location: Cheshire, England
Distribution: Debian Stable
Posts: 269

Original Poster
Rep: Reputation: 39
Thank you everybody, my question is now fully answered.

For the record one of the reasons I've chosen Vim is the community out there, I posted a question at 7:02pm, got my first response at 7:09 and have just read replies which came in overnight (in the UK that is). This many people using a piece of software can't be wrong! I found I was distracted with other software (too many bells and whistles and things to fiddle with), Vim edits and it does it extremely well.

Thanks again. God knows why I didn't pick up on not being in insert mode when pasting in the terminal (probably because I had no problem pasting into Gvim), thanks to Markush for that one.
 
Old 11-12-2009, 06:48 PM   #14
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,873

Rep: Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600Reputation: 2600
If you work in the *nix world, the one editor you can guarantee to be avail on HP-UX, Solaris, Linux (any), *BSD is vi ... and vim is just Vi Improved
Most commercial servers don't have a GUI either, so you need to know a cli editor ie vi .
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
can't paste into vim JosephS Linux - Software 7 01-03-2010 04:26 AM
copy-paste in vim proNick Linux - Newbie 5 02-17-2008 07:29 PM
vim won't paste on middle click anymore slackhack Linux - General 4 07-01-2007 11:09 PM
How to copy paste into VIM ? EAD Linux - Software 15 12-12-2006 06:38 PM
Buggy copy n paste with vim in terminal Kovacs Slackware 1 09-05-2006 12:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:44 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration