LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-19-2005, 02:01 PM   #1
arunswarup
LQ Newbie
 
Registered: Sep 2005
Location: /bin/vi
Distribution: Fedora, Solaris 8
Posts: 20

Rep: Reputation: 1
gvim cut/copy-paste keyboard shortcuts


Hi,

suppose i want to copy some text from firefox to gvim, the copied text does not get pasted in gvim with keyboard shortcuts;
i've tried the most-likely shortcuts
Ctrl-V, Shift-Ctrl-V, Shift-Insert
none of them work

when I check the gvim 'Edit' menu, the shortcut for Copy is "+gP ... how the hell am I supposed to remember that--let alone hit 4 keys sequentially---just to Paste from the clipboard?

how do I do a keyboard mapping to Ctrl-V or something sensible

P.S. what were the developers thinking?

Last edited by arunswarup; 10-19-2005 at 02:13 PM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 10-19-2005, 02:39 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
They were thinking: we want to keep vi the cool, lean
mean editor it always was, and don't annoy the people
who were using it for 20 plus years. Instead of looking
to re-define the thing (always a bad idea, if you get onto
someone elses machine it will "misbehave" again, just
get over it and learn). You COULD conceivably try (I
don't use gvim, just plain vim in an xterm/console) using
X's mouse-way of copying and pasting. High-light in
firefox with the mouse-button1 pressed, switch to gvim,
press i, and middle click into it.


Cheers,
Tink
 
Old 10-19-2005, 03:04 PM   #3
arunswarup
LQ Newbie
 
Registered: Sep 2005
Location: /bin/vi
Distribution: Fedora, Solaris 8
Posts: 20

Original Poster
Rep: Reputation: 1
customize keyboard shortcut

ok ...

Shift-Insert works on X-term, gnome-terminal, konsole, (even in win XP) ... so, are the shortcut keys dependent on the terminal (in this case gui?)?

how do I set the shortcut key for "paste" to be Ctrl-V?

thank you for replying

edit: if they have a complicated shortcut-setup & expect me to use the mouse (i found the middle-mouse-click quite annoying & i posted in this forum), what is the point of using gvim?

Last edited by arunswarup; 10-19-2005 at 03:07 PM.
 
Old 10-19-2005, 03:15 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
I don't know - that's why I don't use it. But if you
dislike (g)vims key-setup, why don't you use kate
or some other more CUA compliant editor instead
of complaining about a screwdriver not being a
hammer?


Cheers,
Tink
 
Old 10-19-2005, 03:21 PM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
ok... SO... Ctrl+V for paste is good? Ctrl+X for cut is good? well... they're just arbitrary choices just like vi's are... but what about the generic windows hotkey for copy? Ctrl+C? you honestly think that using exactly the same key combination for "copy the selected text" and "terminate this running process immediately" is a good thing?!?!?!?! cha! DOS was using Ctrl+C to terminate programs long before Notepad and it's ilk came around...

Anywho. vi rocks, and it's not until you take the time to look at it in a little more depth that you have a chance of understanding why.

Last edited by acid_kewpie; 10-19-2005 at 03:22 PM.
 
Old 10-19-2005, 03:32 PM   #6
arunswarup
LQ Newbie
 
Registered: Sep 2005
Location: /bin/vi
Distribution: Fedora, Solaris 8
Posts: 20

Original Poster
Rep: Reputation: 1
*newbie looks at experienced unix users' posts & thinks!*

ook!

but, they could have assigned something simpler than "+gP
 
1 members found this post helpful.
Old 10-23-2005, 04:42 PM   #7
femistofel
LQ Newbie
 
Registered: Jul 2005
Distribution: fedora
Posts: 17

Rep: Reputation: 4
Quote:
Originally posted by arunswarup
*newbie looks at experienced unix users' posts & thinks!*

ook!

but, they could have assigned something simpler than "+gP
add the following to your ~/.vimrc:

Quote:
nmap <C-V> "+gP
imap <C-V> <ESC><C-V>i
vmap <C-C> "+y
and don't listen to the conservatives

this assigns Ctrl+V to paste the clipboard in normal and insert modes and Ctrl+c to copy to clipboard in "visual" mode.
 
3 members found this post helpful.
Old 09-12-2009, 07:34 AM   #8
srikanth.vittal
LQ Newbie
 
Registered: Sep 2009
Posts: 2

Rep: Reputation: 1
Thumbs up

Cool! Modifiying the .vimrc works.

Thanks
 
1 members found this post helpful.
Old 09-12-2009, 01:52 PM   #9
femistofel
LQ Newbie
 
Registered: Jul 2005
Distribution: fedora
Posts: 17

Rep: Reputation: 4
By the way, there are scripts in the standard distribution that define this and other "compatibility" niceties. If you're used to ms windows "standards" you can add

Code:
source $VIMRUNTIME/mswin.vim
to your ~/.vimrc . For mac compatibility that'd be

Code:
source $VIMRUNTIME/macmap.vim
You can find more interesting standard scripts by browsing the $VIMRUNTIME, just type:

Code:
:vi $VIMRUNTIME
 
Old 09-13-2009, 10:05 PM   #10
srikanth.vittal
LQ Newbie
 
Registered: Sep 2009
Posts: 2

Rep: Reputation: 1
Thank you so much. I am settling on mswin.vim.
 
Old 06-01-2012, 07:34 AM   #11
joar
LQ Newbie
 
Registered: Feb 2011
Posts: 2

Rep: Reputation: 0
thnx, though I found that:
nmap <C-V> "+gP
imap <C-V> <ESC><C-V>a
vmap <C-C> "+y

using a (append) instead of i (insert) put my cursor behind what I've pasted worked better for me(even adding a space after a) .
 
Old 03-08-2014, 10:35 PM   #12
ryanpcmcquen
Member
 
Registered: Apr 2013
Distribution: DistroWanderer
Posts: 381

Rep: Reputation: Disabled
'<Ctrl - R> +' will paste the X11 buffer. You can just hold Ctrl and Shift then hit 'R' and '+'.
 
1 members found this post helpful.
Old 07-21-2014, 09:38 PM   #13
sugatang itlog
LQ Newbie
 
Registered: Jul 2014
Posts: 1

Rep: Reputation: Disabled
@ femistofel, YOU ROCK!

checking the contents of the VIMRUNTIME, so I could add some vim and gvim kung fu. Hehehe!
 
Old 06-29-2016, 09:09 AM   #14
coupure
LQ Newbie
 
Registered: Jun 2016
Posts: 1

Rep: Reputation: Disabled
modify the .vimrc workd fine

Thanks. I've always desiring to make the paste shortcut "ctrl+v" work since several months. I managed to get the "ctrl+v" work by modifying the file .vimrc.
ps: it is important to stick to the question asked instead of saying some bullshit (like acid_kewpie)
 
Old 03-05-2022, 12:11 PM   #15
rjlabs
LQ Newbie
 
Registered: Mar 2022
Posts: 1

Rep: Reputation: 0
Wink

femistofel post was excellent! Have a look at the scripts - very interesting and just what I needed. Wonder why these are not part of the standard gVim install as suggested / endorsed options? vi is as old as the 80 column IBM punch card and 24 line by 80 character monochrome phosphorus dot CRTs (...in amber if you were really living large!) While still retaining excellent "line oriented" features Vi needs to better integrate the technologies that came after the 70s without selling out its original (high speed/hands on) design philosophy - multiple instances of the same and different programs, whole pages of text, paragraphs (indenting, comment out, etc), easier help maneuvering at high speed inside long lines, mouse/touchpad events, user modifiable quick access tool bar with easily programmed hot keys, gestures, modern local/on-line help system, etc. Above scripts are a great start but more evolution eventually needs to occur.
 
  


Reply



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
copy/paste/cut keyboard shortcuts stimpsonjcat Linux - Newbie 4 05-23-2005 06:49 PM
please help with cut and paste into .c file henry_huckem Programming 7 01-28-2005 05:37 AM
mozilla cut/copy and paste problem gw1500se Mandriva 5 04-27-2004 08:35 PM
cut and paste c0c0deuz Linux - Newbie 6 11-01-2001 12:38 PM
cut, copy and paste loganwva Linux - General 1 10-11-2001 01:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:58 AM.

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