Wednesday, February 15, 2012

Re: mapping insert to shift-insert

On 15/02/12 20:50, sinbad wrote:
> how can i map<inset> key to work as<Shift-Insert>
>
> i tried the following mapping
>
> nmap<insert> <S-insert>
>
> it doesn't seem to be working, is it even possible ?
>
> basically i wanna copy text from one screen session to
> other session inside a putty, without using shift-insert
> to paste. in putty, i use mouse to select a text which
> needs to be copied and i go to the target session
> i press<Shift-insert> to paste the text, using shift
> is very tedious and i want to avoid that, hence the need
> for mapping.
>
> cheers
> sibnad
>

In Visual or Select mode, you should probably use a different variant of
the :map command, as follows:

:map Normal, Visual, Select, Operator-Pending
:nmap Normal
:vmap Visual, Select
:omap Operator-Pending
:xmap Visual
:smap Select

:map! Insert/Replace, Command-Line
:imap Insert/Replace
:cmap Command-line

:lmap Language-mapping (when keymaps are active)


So, :nmap will never trigger in Visual mode. This is by design.


An alternative is to use an ordinary Vim put command to paste the text,
using either the + (plus) register (clipboard, as with Edit→Paste in GUI
programs) or the * (star) register (X-selection, as with MiddleMouse in
GUI programs). On non-X11 systems such as Windows, both of these
registers are synonymous.

Examples:
"+p paste after current cursor
"+P paste before current cursor
:put + paste linewise after current line
:.-1put + paste linewise before current line
:.+5put + paste linewise 5 lines after current line
:$put + paste linewise after last line in file
:0put + paste linewise before first line in file
:'>put + paste linewise after the latest visual selection
:6235put + paste linewise between lines 6235 and 6236
:/\c\<hello>\/put+ paste linewise after the next line
containing "hello" as a full world
(case-insensitive)
etc.
see
:help p
:help P
:help quotestar
:help quoteplus
:help :put

IMPORTANT NOTE:
===============
- A Vim executable compiled with -clipboard is never able to interact
directly with the clipboard. (The terminal might be able to inject the
contents of the clipboard transparently to Vim, by "pretending that they
have been typed-in".)
- On Unix-like systems other than Mac OS X, +x11 is required for +clipboard.


Best regards,
Tony.
--
His head smashed in, and his heart cut out,
And his liver removed, and his bowels unplugged,
And his nostrils raped, and his bottom burned off,
And his penis split ... and his ...
"Monty Python and the Holy Grail" PYTHON (MONTY)
PICTURES LTD

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: