[sf-lug] X11 copy/paste & reading into vim/vi/nvi & gpm (was: simple gui editor that will accept a paste)
Michael.Paoli at cal.berkeley.edu
Sun Feb 10 11:59:16 PST 2008
The X11 defaults for copy/paste are:
copy: click and drag mouse button 1 (depress button, move mouse, release
paste: depress and release mouse button 2
In X11 there are 3 standard mouse buttons, mouse buttons 1, 2, and 3.
By default they are respectively left, middle, and right.
For systems with only 2 buttons, XFree86/Xorg X servers (and many other
X servers) can be configured to emulate the missing mouse button 2
(typically by a near simultaneous depression of mouse buttons 1 and 3).
Note that configurations can also be changed from the defaults (e.g. to
mimic copy/paste behavior of some other operating system conventions).
So, one could copy as noted above, change focus to an xterm or similar
window with your vim/nvi/vi session in it with the editor in insert/append
mode, and paste as noted above.
One can also read into vim/nvi/vi from a file, e.g. from command mode:
:r !cat file
though the above may change the editor's idea of the current file name (and
by default the file it writes to). One can also prefix the ex r command
to specify where to insert what's read in, e.g.:
:$r - put it at the end
:0r - put it at the beginning
:.r - after the current line (this is the default)
:40r - after line 40
:-r - before the current line
... essentially the r can be preceded by (most?) any valid ex(1) line
specification (ex(1) and vi(1) are different modes of the same program.
When one issues : from command mode in vi(1), one is then essentially
issuing ex(1) commands. In vi(1), from command mode, Q will take one to
ex(1) mode, and from ex(1) mode, the command vi will take one to vi(1)
Note also that on Linux text virtual consoles, with gpm, the gpm copy/paste
behavior is quite similar to the X11 copy/paste behavior - at least by
default. E.g. one could be in lynx and copy from there using the mouse - in
text mode - then open up vim/nvi/vi, enter insert/append mode, and paste
into vim/nvi/vi - no GUI required :-)
> Date: Thu, 7 Feb 2008 19:45:17 -0800 (PST)
> From: Alex Kleider <a_kleider at yahoo.com>
> Subject: Re: [sf-lug] simple gui editor that will accept a paste
> To: a_kleider at yahoo.com, Linux userGroup <sf-lug at linuxmafia.com>
> Message-ID: <700978.5043.qm at web36609.mail.mud.yahoo.com>
> Content-Type: text/plain; charset=iso-8859-1
> --- Alex Kleider <a_kleider at yahoo.com> wrote:
> Debian etch and I'm using Fluxbox.
> > Can anyone suggest a GUI editor that will give me the functionality
> > of
> > pasting text into it?
> follow up on my own question:
> it needn't be a gui editor; is there a way that vim can pull something
> in from a previously performed copy action? That copied text must be in
> the system somewhere: in memory, in a temporary file?
More information about the sf-lug