Is there a way I can set the Win version of 'vim' to automatically copy
mouse-selected text into my copy buffer -- I'm always selecting in vim,
then going 'somewhere' to paste it, only to forget I had to bring up some
subsidiary menu to tell vim to copy my selection into the copy buffer
(conveniences of X-windows features are sorely missed....)
Is there a setting for this?
Thanks!
-linda
:help 'guioptions'
:help 'clipboard'
Best regards,
Tony.
--
"The society which scorns excellence in plumbing as a humble activity
and tolerates shoddiness in philosophy because it is an exalted
activity will have neither good plumbing nor good philosophy ...
neither its pipes nor its theories will hold water."
> :help 'guioptions'
> :help 'clipboard'
> Tony.
-----
Awesome! Exactly what I was searching for!
Thanks!
It says to use:
"*dd
...ok, just tried that..got it to work (guess it doesn't work real well
at the ':' (colon) prompt.
...so, '*' (asterisk or star) -- is that the name of the ...
the whole register is named:
"*
double-quote-star?
Waaa....how did ... this is sort of a "discursion" ... :-)
Please please...in 'perl' documentation, even though there are
multiple peculiar variable names, they do at least, all start with
the dollar sign, but more importantly -- how is one to remember
them? In perl, at least in the documentation, "they" (the ever present
"them") at least try to come up with some mnemonic or "pseudo-rationale"
for why a var is named what it is or how to possibly remember it,
like:
$_ - Mnemonic: underline is understood in certain operations.
$& - Mnemonic: like "&" in some editors
$<digit> - Mnemonic: like \<digit> (in replace strings)
$` - Mnemonic: it's the quote that sometimes precedes whatever
is being quoted...vs.
$' - Mnemonic: is often used as the quote-mark after the quote-text
(both ` and ' refer to parts before a matched string and after,
respectively....
etc. etc....blah blah...
---
The point is not to go over each mnemonic, but to illustrate
the idea, (however `lame' the actual mnemonic may be) of trying to
come up with something that maybe gives an idea of how the variable
got its name (or how its `name' was later justified :-))
BTW - I use comparisons to perl because of perl and vi's shared
parentage -- they both were derived from the early unix toolset.
The same isn't true, for 'emacs', for example, while appears to
have evolved out of lisp -- specifically lisp as used at MIT.
-------but , un-discursing, ....
I've seen the "<string> syntax before (like when I've tried to
manually do 'Cut|Copy' & Paste...) ... I've just not had
success memorizing the "(DQ) commands -- in fact, when I first
encountered them, I thought it was a bug the documentation I had --
that it was a mis-transliteration of some "META" character
that wasn't properly displayed on my system....but I've
slowly begun to realize it's supposed to be the start of
some character sequences -- that it is, itself, a literal -- and
not a "literal" (i.e. using the DQ as a way to quote the real
literal...). I've found that "more than a tiny bit" confusing...but
it may just be that that DQ's are usually used for quoting or
making something literal and not as a lead-in to a string.
C'est la vie....
:-)
First, vi was born before all programs started acting the same, in fact
before clipboards even existed, so vi and Vim had to make up their
standards as they went along. Let's see how this applied to the
clipboard when it arrived.
In Vim, the cursor is one of several "registers" which can be used to
store the data "deleted" or "yanked" from the current file, so that it
can be "put" elsewhere later. Ordinary registers are register a thru
register z; there are also "special" registers such as register plus
(the clipboard), register slash (the latest search pattern), and so forth.
Like most registers, the clipboard (or the latest search pattern, and so
forth) can also be used as a variable. In Vim, most variables have just
a name: foo, bar, i, j, k, l, linenumber, ForgetMeNot, ... The
registers have names of a certain form; in fact, their names consist of
one specific character defining which registar you mean, sometimes
prefixed by a " (double quote) or @ (at sign) depending where you are
using it. Let's see:
The normal-mode commands d (delete), y (yank), p and P (put), use by
default the register-quote unless you specify something else by
prefixing a quote plus a one-letter register name: for the clipboard, "+
(on all platforms) or "* (on non-Unix systems). Why prefix it with a
quote? I can only guess; but I notice that in Vim scripts an unpaired
double quote signals a comment, and I suppose that "it was felt" that
when typing normal-mode commands at the keyboard, you wouldn't need to
comment. It can be very hard, at times, to find a "free" (not yet
assigned) key for a new function in Vim.
The Ex-commands :d[elete], :y[ank] and :pu[t] also use register-quote by
default, but here, if you want a different register, you specify its
single-letter name, naked, after the command name: for instance,
:%y+
will yank the whole contents of the current edit buffer into the
clipboard, and
:$put +
will append the clipboard after the last line of the current edit
buffer. In ex-commands in general, you couldn't use a quote-prefix since
that was already taken (for comments), but the only argument of these
three commands is the name of the register on which they act, so the
"naked" register letter (for registers a to z) or special character (+
for the clipboard, * for the X11 selection, or again the non-X11
clipboard, / for the latest search pattern, etc.) was good enough.
Finally, the clipboard, like most registers, can be used as a variable
name in an expression or on the left-hand side of a ":let <variable> =
<expression>" command, by prefixing its name with an at-sign: for example,
:let @+ = "Mary had a little lamb.\n"
places the sentence "Mary had a little lamb.", followed by a line-feed
character, into the clipboard;
:if @+ =~? '\<help\>'
checks the clipboard for the presence of the word "help" in any case but
as a word (not as "helped" or "whelp";
:echo "The clipboard is now «" . @+ . "»"
echoes the clipboard with a descriptive text, etc.
This @+ (or @*) name can also be used in some cases where a register can
be used but not a variable, for instance
:redir @+
:version
:redir END
would copy the whole output of the ":version" command to the clipboard
(maybe for pasting into an email) -- the same :redir command cannot
redirect to just any variable, but, when used as for instance
:redir! > ~/version.txt
it can redirect to a file. I suppose the at-sign was another key which
happened to be "free" at the time: in this case, using a quote would
have conflicted with the use of the quote to herald a string, while in
Normal mode, the at-sign also references a register but not as a prefix
to another Normal-mode command: @a executes the contents of register a
as a "keyboard macro". This particular use doesn't very conveniently
apply to the clipboard, but after all, Vim was first developed on
text-only systems which didn't even have a clipboard (just like the
MS-Dos systems where I first met Intel 8086 processors also had no
clipboard). The first Unix systems didn't even have a display screen but
a teletypewriter instead (that was before Vim, and, I think, even before
vi came around).
The one letter (or character) is the "actual" name of the register; the
prefixing " or @, when present, indicates that we mean a register and
not something else; and finally, the fact that on non-Unix systems, the
clipboard can be accessed as "register plus" or "register star", i.e.,
two different names and not just one, derives from the fact that X11
servers, as used on Unix, place two similar but slightly different kinds
of data created by one program at the disposition of other programs: One
of them, the "clipboard" (register plus in Vim) is used for Edit->Copy,
Edit->Cut and Edit->Paste, and their respective shortcuts which in many
programs (but normally not Vim) are Ctrl+C, Ctrl+X and Ctrl+V. The other
one, the "selection", contains anything that you have "selected" in
almost any program (but usually not Vim), and a middle-click anywhere
will paste the latest selection.
Aliases exist in the computer world: when I invoke the "view" program,
vim is called, but it knows under what name it was called and acts
slightly differently -- in this case, it treats every file mentioned on
the command-line as readonly. In Vim, when I invoke register plus or
register star, on X11 systems these are similar but slightly different;
the difference is lost on non-X11 systems such as Windows.
HTH,
Tony.
--
Fornication, n.:
Term used by people who don't have anybody to screw with.
> double-quote-star?
>
> Waaa....how did ... this is sort of a "discursion" ... :-)
>
> Please please...in 'perl' documentation, even though there are
> multiple peculiar variable names, they do at least, all start with
> the dollar sign, but more importantly -- how is one to remember
> them? In perl, at least in the documentation, "they" (the ever present
> "them") at least try to come up with some mnemonic or "pseudo-rationale"
> for why a var is named what it is or how to possibly remember it,
>
> like:
> $_ - Mnemonic: underline is understood in certain operations.
> $& - Mnemonic: like "&" in some editors
> $<digit> - Mnemonic: like \<digit> (in replace strings)
> $` - Mnemonic: it's the quote that sometimes precedes whatever
> is being quoted...vs.
> $' - Mnemonic: is often used as the quote-mark after the quote-text
> (both ` and ' refer to parts before a matched string and after,
> respectively....
> etc. etc....blah blah...
> ---
> The point is not to go over each mnemonic, but to illustrate
> the idea, (however `lame' the actual mnemonic may be) of trying to
> come up with something that maybe gives an idea of how the variable
> got its name (or how its `name' was later justified :-))
The Vim registers are almost mnemonic, although as far as I know
there's nothing mnemonic about " as it was chosen entirely because
it was available.
"- The small delete register contains text from a single line, and
its name is a small line.
"_ The black hole register acts as a sink that discards everything
stored in it; its name is a line that has sunk to the bottom of
the character cell.
". The last inserted text register contains the text that would be
inserted if you repeated the insert command with .
"% and "# contain the names of the current and alternate files: the
files you'd load if you typed :n % or :n # on the command line.
": The command line register contains the last command that began
with a colon.
"= The expression register; in most sensible languages you assign
an expression to a variable with =.
"/ The last search register: searches are performed with /.
"+ The clipboard register: use this register if you want to add text
from the clipboard to your buffer, or add text from the buffer to
another application.
[Serious lameness from this point on]
"* The selection register: this allows selected text to go forth and
multiply.
"~ The drop register: ~ is representative of the kind of character
that fills up your screen if you're using a modem and the line
drops, or if you drop something on your modem.
(My favourite of the Perl mnemonics is $| (set to true it causes a
file handle to be unbuffered), for when you want your pipes to be
piping hot. "use English" is no fun at all.)
--
Matthew Winn
> although as far as I know
> there's nothing mnemonic about " as it was chosen entirely because
> it was available.
---
Yeah...it's a pain too since it takes 2 fingers...it's an
oddity "@" sometimes to prefix vars, other times """ (no confusion there).
Hmmm....consistency for hobgoblins?...eh...partial quotes are so useful.
...good mnemonics elided...
> [Serious lameness from this point on]
---
Wow, a serious built-in Mp3 Encoder?...all in vim macros...
what a perverse idea, but ...um:
> "* The selection register: this allows selected text to go forth and
> multiply.
---yeah
> "~ The drop register: ~ is representative of the kind of character
> that fills up your screen if you're using a modem and the line
> drops, or if you drop something on your modem.
---
modems...I remember those! remember the acoustic ones that you put
in a cradle?....something comforting about hearing the modems handshake
and connect....ahh...connected....
> (My favourite of the Perl mnemonics is $| (set to true it causes a
> file handle to be unbuffered), for when you want your pipes to be
> piping hot. "use English" is no fun at all.)
---
Yeah...you can tell someone had some fun...and of course
it is the stereotypical 'grammar' teacher, correcting you
on English, that tells us to 'use English'...:-)