On 27/05/09 06:17, Mahurshi Akilla wrote:
>
> Under my current linux xterm settings, in vim, shit+insert generally
> helps paste things from the clipboard, whether i am in escape mode or
> insert mode.
>
> However, pressing shift+insert only pastes "<S-Insert>" in gvim.  Is
> there a way to change this behavior and have it actually print the
> contents of the clipboard?

The clipboard (the one which you access with Edit => Cut, Edit => Copy 
or Edit => Paste) is known in Vim as the "plus" register (not to be 
confused with the "star" register, which is the same under MS-Windows 
but not under X11).

Any register can be accessed in a number of ways, and not only through 
the menus; if you don't specify a register, you get the "default" or 
"unnamed" register, which is actually named register "double-quote".

In Normal mode:

        "+P
put the clipboard before the cursor

        "+p
put the cursor after the cursor

        "+yy
yank [count] lines (default: the current line) into the clipboard

        "+y{motion}
        "+y{object}
        {Visual}"+y
yank the text moved over, or the text object, or the Visual selection, 
into the clipboard

        "+dd
        "+d{motion}
        "+d{object}
        {Visual}"+d
the same, but delete instead of yanking

        :[range]put +
put the clipboard after the [range] (default: current line). Use 0 
(zero) as the range to put before the first line, or $ (dollar) for 
after the last line.

        :[range]yank +
yank the [range] (default: current line) into the clipboard

        :[range]delete +
delete into the clipboard

The ex-commands :put, :yank and :delete can be abbreviated to :pu :y or 
:d respectively, or to anything in-between (but :p is :print, not :put).

        :let @+ = <expression>
        :let <variable> = @+
You can also use @+ in expressions and ":let" statements, just like any 
String variable. It means the clipboard.

        :redir @+
        " (do something)
        :redir END
capture in the clipboard whatever the "do something" command(s) will 
display at the bottom of the screen. For instance, by using :version as 
the "do something" command, capture the details of your present Vim 
version for pasting into an email (such as a bug report).


All this was for Normal mode. Now, in Insert (or Command-line) mode, you 
can insert the contents of the clipboard at the cursor by hitting Ctrl-R 
followed by +


All these work for other registers too, for instance the registers a to 
z (using a letter instead of +) which are only used when you explicitly 
tell Vim to use them.


Of course, unlike other registers, the clipboard is only available if 
you are using a Vim version compiled with +clipboard, either in GUI mode 
or in a terminal which has access to the clipboard (such as an xterm or 
the Windows console, but not the text-only Linux console accessed by 
Ctrl-Alt-F1 to Ctrl-Alt-F6 [Go back to X with Ctrl-Alt-F7]).

See
     :help copy-move


Best regards,
Tony.
-- 
Slang is language that takes off its coat, spits on its hands, and goes
to work.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to