Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #267014 > unrolled thread
| Started by | David Christensen <dpchrist@holgerdanske.com> |
|---|---|
| First post | 2024-02-06 00:20 +0100 |
| Last post | 2024-02-07 07:40 +0100 |
| Articles | 20 on this page of 42 — 12 participants |
Back to article view | Back to linux.debian.user
Copy from Firefox and paste into Terminal with Vim David Christensen <dpchrist@holgerdanske.com> - 2024-02-06 00:20 +0100
Re: Copy from Firefox and paste into Terminal with Vim Bret Busby <bret@busby.net> - 2024-02-06 00:50 +0100
Re: Copy from Firefox and paste into Terminal with Vim David Christensen <dpchrist@holgerdanske.com> - 2024-02-06 01:30 +0100
Re: Copy from Firefox and paste into Terminal with Vim Dan Ritter <dsr@randomstring.org> - 2024-02-06 02:10 +0100
Re: Copy from Firefox and paste into Terminal with Vim David Christensen <dpchrist@holgerdanske.com> - 2024-02-06 08:10 +0100
Re: Copy from Firefox and paste into Terminal with Vim Dan Ritter <dsr@randomstring.org> - 2024-02-06 12:40 +0100
Re: Copy from Firefox and paste into Terminal with Vim Greg Wooledge <greg@wooledge.org> - 2024-02-06 13:50 +0100
Re: Copy from Firefox and paste into Terminal with Vim David Christensen <dpchrist@holgerdanske.com> - 2024-02-07 08:10 +0100
Re: Copy from Firefox and paste into Terminal with Vim Greg Wooledge <greg@wooledge.org> - 2024-02-07 13:30 +0100
Re: Copy from Firefox and paste into Terminal with Vim Max Nikulin <manikulin@gmail.com> - 2024-02-07 13:50 +0100
Re: Copy from Firefox and paste into Terminal with Vim Max Nikulin <manikulin@gmail.com> - 2024-02-06 04:10 +0100
Re: Copy from Firefox and paste into Terminal with Vim David Christensen <dpchrist@holgerdanske.com> - 2024-02-06 07:30 +0100
Re: Copy from Firefox and paste into Terminal with Vim Greg Wooledge <greg@wooledge.org> - 2024-02-06 13:30 +0100
Re: Copy from Firefox and paste into Terminal with Vim Max Nikulin <manikulin@gmail.com> - 2024-02-06 15:40 +0100
Re: Copy from Firefox and paste into Terminal with Vim Greg Wooledge <greg@wooledge.org> - 2024-02-06 16:00 +0100
Re: Copy from Firefox and paste into Terminal with Vim Max Nikulin <manikulin@gmail.com> - 2024-02-06 18:10 +0100
Re: Copy from Firefox and paste into Terminal with Vim Nicolas George <george@nsup.org> - 2024-02-06 18:40 +0100
xterm PRIMARY and CLIPBOARD selection [was: Re: Copy from Firefox and paste into Terminal with Vim] Max Nikulin <manikulin@gmail.com> - 2024-02-07 04:30 +0100
Re: xterm PRIMARY and CLIPBOARD selection [was: Re: Copy from Firefox and paste into Terminal with Vim] Nicolas George <george@nsup.org> - 2024-02-07 13:30 +0100
Re: xterm PRIMARY and CLIPBOARD selection [was: Re: Copy from Firefox and paste into Terminal with Vim] Stefan Monnier <monnier@iro.umontreal.ca> - 2024-02-07 14:20 +0100
Re: xterm PRIMARY and CLIPBOARD selection [was: Re: Copy from Firefox and paste into Terminal with Vim] debian-user@howorth.org.uk - 2024-02-07 21:20 +0100
Re: xterm PRIMARY and CLIPBOARD selection [was: Re: Copy from Firefox and paste into Terminal with Vim] Max Nikulin <manikulin@gmail.com> - 2024-02-07 18:10 +0100
C-Ins vs. C-c [was: xterm PRIMARY and CLIPBOARD selection] Firefox and paste into Terminal with Vim] <tomas@tuxteam.de> - 2024-02-07 19:50 +0100
Re: Copy from Firefox and paste into Terminal with Vim debian-user@howorth.org.uk - 2024-02-06 16:40 +0100
Re: Copy from Firefox and paste into Terminal with Vim Greg Wooledge <greg@wooledge.org> - 2024-02-06 17:10 +0100
Re: Copy from Firefox and paste into Terminal with Vim David Christensen <dpchrist@holgerdanske.com> - 2024-02-07 08:30 +0100
Re: Copy from Firefox and paste into Terminal with Vim Max Nikulin <manikulin@gmail.com> - 2024-02-06 15:30 +0100
Re: Copy from Firefox and paste into Terminal with Vim David Christensen <dpchrist@holgerdanske.com> - 2024-02-07 09:30 +0100
Re: Copy from Firefox and paste into Terminal with Vim <tomas@tuxteam.de> - 2024-02-06 06:50 +0100
Re: Copy from Firefox and paste into Terminal with Vim David Christensen <dpchrist@holgerdanske.com> - 2024-02-06 08:10 +0100
Re: Copy from Firefox and paste into Terminal with Vim <tomas@tuxteam.de> - 2024-02-06 09:00 +0100
Re: Copy from Firefox and paste into Terminal with Vim Klaus Singvogel <deb-user-ml@singvogel.net> - 2024-02-06 09:20 +0100
Re: Copy from Firefox and paste into Terminal with Vim David Christensen <dpchrist@holgerdanske.com> - 2024-02-07 08:30 +0100
Re: Copy from Firefox and paste into Terminal with Vim John Hasler <john@sugarbit.com> - 2024-02-06 14:50 +0100
Re: Copy from Firefox and paste into Terminal with Vim David Christensen <dpchrist@holgerdanske.com> - 2024-02-07 08:50 +0100
Re: Copy from Firefox and paste into Terminal with Vim Ralph Aichinger <ra@h5.or.at> - 2024-02-06 13:00 +0100
Re: Copy from Firefox and paste into Terminal with Vim Max Nikulin <manikulin@gmail.com> - 2024-02-06 15:40 +0100
Re: Copy from Firefox and paste into Terminal with Vim <tomas@tuxteam.de> - 2024-02-06 15:40 +0100
Re: Copy from Firefox and paste into Terminal with Vim Ralph Aichinger <ra@h5.or.at> - 2024-02-06 19:00 +0100
Re: Copy from Firefox and paste into Terminal with Vim Max Nikulin <manikulin@gmail.com> - 2024-02-07 04:30 +0100
Re: Copy from Firefox and paste into Terminal with Vim David Christensen <dpchrist@holgerdanske.com> - 2024-02-07 08:40 +0100
Re: Copy from Firefox and paste into Terminal with Vim David Christensen <dpchrist@holgerdanske.com> - 2024-02-07 07:40 +0100
Page 1 of 3 [1] 2 3 Next page →
| From | David Christensen <dpchrist@holgerdanske.com> |
|---|---|
| Date | 2024-02-06 00:20 +0100 |
| Subject | Copy from Firefox and paste into Terminal with Vim |
| Message-ID | <I4gpP-89UC-11@gated-at.bofh.it> |
debian-user: I have a laptop with: 2024-02-05 15:04:48 dpchrist@laalaa ~ $ cat /etc/debian_version ; uname -a ; dpkg-query -W xfce4 firefox-esr vim 11.8 Linux laalaa 5.10.0-27-amd64 #1 SMP Debian 5.10.205-2 (2023-12-31) x86_64 GNU/Linux firefox-esr 115.7.0esr-1~deb11u1 vim 2:8.2.2434-3+deb11u1 xfce4 4.16 2024-02-05 15:10:08 dpchrist@laalaa ~ $ grep -v '"' .vimrc | grep . map q <Nop> set autoindent set backspace=indent,eol,start set nocompatible set nomodeline set number set numberwidth=8 set paste set shiftwidth=4 set wildmode=longest,list Normally, I can cut and paste between Xfce desktop applications. For example, if I start Firefox, disable all extensions, browse to: https://www.toyota.com/dealers/ Enter a Zip Code of "12345", highlight the first result, copy it to the clipboard, and paste into this message, I see: Lia Toyota of Colonie 2116 Central Ave., Rte. 5, Schenectady NY 12304 (5.3 miles) Today's Hours: 7:00 AM to 7:00 PM (518) 374-3700 But if I close the above Firefox window, start a Firefox instance, browse to: https://www.toyota.com/dealers/ Enter a Zip Code of "12345", highlight the first result, copy it to the clipboard, start Terminal, open a file with Vim, press "i" to enter insert mode, and paste, sometimes I see what I copied to the clipboard and sometimes I see nothing. I am unable to determine if the problem is Firefox, Vim, or something else. Comments or suggestions? David
[toc] | [next] | [standalone]
| From | Bret Busby <bret@busby.net> |
|---|---|
| Date | 2024-02-06 00:50 +0100 |
| Message-ID | <I4gSS-8a40-9@gated-at.bofh.it> |
| In reply to | #267014 |
On 6/2/24 07:14, David Christensen wrote: > debian-user: > > I have a laptop with: > > 2024-02-05 15:04:48 dpchrist@laalaa ~ > $ cat /etc/debian_version ; uname -a ; dpkg-query -W xfce4 firefox-esr vim > 11.8 > Linux laalaa 5.10.0-27-amd64 #1 SMP Debian 5.10.205-2 (2023-12-31) > x86_64 GNU/Linux > firefox-esr 115.7.0esr-1~deb11u1 > vim 2:8.2.2434-3+deb11u1 > xfce4 4.16 > > 2024-02-05 15:10:08 dpchrist@laalaa ~ > $ grep -v '"' .vimrc | grep . > map q <Nop> > set autoindent > set backspace=indent,eol,start > set nocompatible > set nomodeline > set number > set numberwidth=8 > set paste > set shiftwidth=4 > set wildmode=longest,list > > > Normally, I can cut and paste between Xfce desktop applications. > > > For example, if I start Firefox, disable all extensions, browse to: > > https://www.toyota.com/dealers/ > > Enter a Zip Code of "12345", highlight the first result, copy it to the > clipboard, and paste into this message, I see: > > Lia Toyota of Colonie > 2116 Central Ave., Rte. 5, Schenectady NY 12304 > (5.3 miles) > Today's Hours: 7:00 AM to 7:00 PM > (518) 374-3700 > > > But if I close the above Firefox window, start a Firefox instance, > browse to: > > https://www.toyota.com/dealers/ > > Enter a Zip Code of "12345", highlight the first result, copy it to the > clipboard, start Terminal, open a file with Vim, press "i" to enter > insert mode, and paste, sometimes I see what I copied to the clipboard > and sometimes I see nothing. > > > I am unable to determine if the problem is Firefox, Vim, or something else. > > > Comments or suggestions? > > > David > How exactly are you copying and pasting? Are you marking the text and using Copy and Paste from the menu generated by clicking the non-dominant mouse button, or, are you marking the text, and using <CTRL><C> to copy then <CTRL><V> to paste? What happens if you copy and paste to an editor such as gedit? Does that work consistently? If so, what happens if you copy and paste to gedit, and then, copy from gedit, and paste to the vim window? Does it make any difference whether you have the vim session open, and the file open, into which you want to paste, before you copy the text that you want to paste into it? Have you tried the text editor that is the default editor for alpine (previously known as pine) - I think it is either nano or pico? .... Bret Busby Armadale Western Australia (UTC+0800) .................
[toc] | [prev] | [next] | [standalone]
| From | David Christensen <dpchrist@holgerdanske.com> |
|---|---|
| Date | 2024-02-06 01:30 +0100 |
| Message-ID | <I4hvA-8avP-11@gated-at.bofh.it> |
| In reply to | #267015 |
On 2/5/24 15:44, Bret Busby wrote: > On 6/2/24 07:14, David Christensen wrote: >> debian-user: >> >> I have a laptop with: >> >> 2024-02-05 15:04:48 dpchrist@laalaa ~ >> $ cat /etc/debian_version ; uname -a ; dpkg-query -W xfce4 firefox-esr >> vim >> 11.8 >> Linux laalaa 5.10.0-27-amd64 #1 SMP Debian 5.10.205-2 (2023-12-31) >> x86_64 GNU/Linux >> firefox-esr 115.7.0esr-1~deb11u1 >> vim 2:8.2.2434-3+deb11u1 >> xfce4 4.16 >> >> 2024-02-05 15:10:08 dpchrist@laalaa ~ >> $ grep -v '"' .vimrc | grep . >> map q <Nop> >> set autoindent >> set backspace=indent,eol,start >> set nocompatible >> set nomodeline >> set number >> set numberwidth=8 >> set paste >> set shiftwidth=4 >> set wildmode=longest,list >> >> >> Normally, I can cut and paste between Xfce desktop applications. >> >> >> For example, if I start Firefox, disable all extensions, browse to: >> >> https://www.toyota.com/dealers/ >> >> Enter a Zip Code of "12345", highlight the first result, copy it to >> the clipboard, and paste into this message, I see: >> >> Lia Toyota of Colonie >> 2116 Central Ave., Rte. 5, Schenectady NY 12304 >> (5.3 miles) >> Today's Hours: 7:00 AM to 7:00 PM >> (518) 374-3700 >> >> >> But if I close the above Firefox window, start a Firefox instance, >> browse to: >> >> https://www.toyota.com/dealers/ >> >> Enter a Zip Code of "12345", highlight the first result, copy it to >> the clipboard, start Terminal, open a file with Vim, press "i" to >> enter insert mode, and paste, sometimes I see what I copied to the >> clipboard and sometimes I see nothing. >> ... > How exactly are you copying and pasting? > > Are you marking the text and using Copy and Paste from the menu > generated by clicking the non-dominant mouse button, or, are you marking > the text, and using <CTRL><C> to copy then <CTRL><V> to paste? Thank you for the reply. :-) Copy from Firefox -- drag to highlight text, then: 1. Press Ctrl+C, or 2. Right-click and choose Copy. Paste into Vim: 1. Middle click, or 2. Right-click and choose Paste. > What happens if you copy and paste to an editor such as gedit? > Does that work consistently? If so, what happens if you copy and paste to gedit, > and then, copy from gedit, and paste to the vim window? Copying from any Xfce window and pasting into Mousepad seems to work consistently. Copying from Firefox, Mousepad, and potentially other Xfce windows into Vim does not work consistently. > Does it make any difference whether you have the vim session open, and > the file open, into which you want to paste, before you copy the text > that you want to paste into it? No. > Have you tried the text editor that is the default editor for alpine > (previously known as pine) - I think it is either nano or pico? No. David
[toc] | [prev] | [next] | [standalone]
| From | Dan Ritter <dsr@randomstring.org> |
|---|---|
| Date | 2024-02-06 02:10 +0100 |
| Message-ID | <I4i8i-8aYk-1@gated-at.bofh.it> |
| In reply to | #267014 |
David Christensen wrote: > Normally, I can cut and paste between Xfce desktop applications. > > > Enter a Zip Code of "12345", highlight the first result, copy it to the > clipboard, start Terminal, open a file with Vim, press "i" to enter insert > mode, and paste, sometimes I see what I copied to the clipboard and > sometimes I see nothing. > > > I am unable to determine if the problem is Firefox, Vim, or something else. Are you aware that there are at least three 'clipboards' here? X11 primary selection: this usually get filled by selecting text in a terminal. It usually gets pasted by Button 2. In vim, this is the "+ buffer. X11 clipboard: this usually gets filled by ctrl-c or ctrl-shift-c or a menu "Copy". It usually gets pasted by ctrl-v or ctrl-shift-v or a menu "Paste". In vim, this is the "* buffer. X11 secondary selection: you are unlikely to encounter it, but when you do, it will be bizarre. Read: http://www.cs.man.ac.uk/~lindsec/secondary-selection.html Vim can bypass a chunk of this by combining primary and clipboard: :set clipboard=unnamed,unnamedplus in which case "* and "+ will be pasted simultaneously from vim. -dsr-
[toc] | [prev] | [next] | [standalone]
| From | David Christensen <dpchrist@holgerdanske.com> |
|---|---|
| Date | 2024-02-06 08:10 +0100 |
| Message-ID | <I4nKF-8eAw-5@gated-at.bofh.it> |
| In reply to | #267018 |
On 2/5/24 16:48, Dan Ritter wrote: > David Christensen wrote: >> Normally, I can cut and paste between Xfce desktop applications. >> >> >> Enter a Zip Code of "12345", highlight the first result, copy it to the >> clipboard, start Terminal, open a file with Vim, press "i" to enter insert >> mode, and paste, sometimes I see what I copied to the clipboard and >> sometimes I see nothing. >> >> >> I am unable to determine if the problem is Firefox, Vim, or something else. > > Are you aware that there are at least three 'clipboards' here? > > X11 primary selection: this usually get filled by selecting text > in a terminal. It usually gets pasted by Button 2. In vim, this > is the "+ buffer. > > X11 clipboard: this usually gets filled by ctrl-c or > ctrl-shift-c or a menu "Copy". It usually gets pasted by ctrl-v > or ctrl-shift-v or a menu "Paste". In vim, this is the "* > buffer. Thank you for the reply. I was aware of the X11 clipboard and interacting with it via Edit menus, context menus (right-click), Ctrl+C, Ctrl+X, Ctrl+V, Shift+Delete, Shift+Insert, etc.. I was aware of X11 select and paste via middle-click. Please provide a URL that describes the Vim "+ and "* buffers, how to interact with them within Vim, how to interact with them from other apps, etc.. > Vim can bypass a chunk of this by combining primary and > clipboard: > > :set clipboard=unnamed,unnamedplus I entered the above command into Vim, but am unsure what behavior or change in behavior I am supposed to see (?). David
[toc] | [prev] | [next] | [standalone]
| From | Dan Ritter <dsr@randomstring.org> |
|---|---|
| Date | 2024-02-06 12:40 +0100 |
| Message-ID | <I4rXY-8h6B-17@gated-at.bofh.it> |
| In reply to | #267036 |
David Christensen wrote: > On 2/5/24 16:48, Dan Ritter wrote: > > David Christensen wrote: > > > Please provide a URL that describes the Vim "+ and "* buffers, how to > interact with them within Vim, how to interact with them from other apps, > etc.. https://www.oreilly.com/library/view/learning-the-vi/9780596529833/ch04s03.html The "+ and "* buffers will get filled with primary and clipboard selections when they occur, or you can fill them yourself so that other applications can read from them. :set clipboard=unnamed, unnamedplus makes the basic vim clipboard -- the one without a name, the one that you use if you just dd or y a line -- be the same as the X11 primary selection buffer. https://vimdoc.sourceforge.net/htmldoc/gui.html#clipboard -dsr-
[toc] | [prev] | [next] | [standalone]
| From | Greg Wooledge <greg@wooledge.org> |
|---|---|
| Date | 2024-02-06 13:50 +0100 |
| Message-ID | <I4t3H-8hJp-11@gated-at.bofh.it> |
| In reply to | #267055 |
On Tue, Feb 06, 2024 at 06:15:39AM -0500, Dan Ritter wrote: > https://www.oreilly.com/library/view/learning-the-vi/9780596529833/ch04s03.html > > The "+ and "* buffers will get filled with primary and clipboard > selections when they occur, or you can fill them yourself so > that other applications can read from them. That page does not contain a + or * character at all, and while it does describe buffers, it does not describe buffers whose names are anything other than lowercase letters. In fact, it explicitly says there are only 26 of them (a-z). Furthermore, in my own testing just now, I'm unable to get this to work. vim (version 2:9.0.1378-2) running in urxvt, command mode, pressing "+ or "* generates a terminal bell. Pressing p after either one of these pastes what's in vim's unnamed default buffer.
[toc] | [prev] | [next] | [standalone]
| From | David Christensen <dpchrist@holgerdanske.com> |
|---|---|
| Date | 2024-02-07 08:10 +0100 |
| Message-ID | <I4Kee-8tcX-3@gated-at.bofh.it> |
| In reply to | #267055 |
On 2/6/24 03:15, Dan Ritter wrote: > David Christensen wrote: >> On 2/5/24 16:48, Dan Ritter wrote: >>> David Christensen wrote: >> Please provide a URL that describes the Vim "+ and "* buffers, how to >> interact with them within Vim, how to interact with them from other apps, >> etc.. > > https://www.oreilly.com/library/view/learning-the-vi/9780596529833/ch04s03.html Thank you for the reply. :-) Interesting. Perhaps I should try to add buffers to my Vim skill set. > The "+ and "* buffers will get filled with primary and clipboard > selections when they occur, or you can fill them yourself so > that other applications can read from them. In a window running Terminal running Vim in command mode: * Pressing " then + then p seems to paste from the default Vim buffer -- what I seem to recall being referred to as the "yank buffer" (?). * Pressing " then * then p seems to paste from the default Vim buffer. > :set clipboard=unnamed, unnamedplus Vim says: E518: Unknown option: unnamedplus If I run the command: :set clipboard=unnamed,unnamedplus Vim does not complain, and "+p and "*p behave as above. Perhaps my .vimrc is interfering (?). Here it is again FYI: 2024-02-06 22:50:35 dpchrist@laalaa ~ $ grep -v '"' .vimrc | grep . map q <Nop> set autoindent set backspace=indent,eol,start set nocompatible set nomodeline set number set numberwidth=8 set paste set shiftwidth=4 set wildmode=longest,list Disabling .vimrc and testing "+p, "*p, and :set clipboard=unnamed,unnamedplus again, the behavior is the same. > makes the basic vim clipboard -- the one without a name, the one > that you use if you just dd or y a line -- be the same as the > X11 primary selection buffer. Not on my Debian, X, Xfce, Terminal, and/or Vim. > https://vimdoc.sourceforge.net/htmldoc/gui.html#clipboard In a window running Terminal running Vim in command mode with .vimrc enabled: * "*dd deletes the line containing the insertion point. The line is not copied to the keyboard. * "*p pastes the line previously deleted after the line containing the insertion point. The behavior is the same with .vimrc disabled. So, my Debian, X, Xfce, Terminal, and/or Vim are not working as documented (?). David
[toc] | [prev] | [next] | [standalone]
| From | Greg Wooledge <greg@wooledge.org> |
|---|---|
| Date | 2024-02-07 13:30 +0100 |
| Message-ID | <I4PdT-8w9I-9@gated-at.bofh.it> |
| In reply to | #267099 |
On Tue, Feb 06, 2024 at 11:02:09PM -0800, David Christensen wrote:
> * Pressing " then + then p seems to paste from the default Vim buffer --
> what I seem to recall being referred to as the "yank buffer" (?).
>
> * Pressing " then * then p seems to paste from the default Vim buffer.
These are the same results that I had. You're most likely running a
vim package built without the full suite of GUI options, just like I am.
(Do you get a terminal bell after "+ or is your terminal bell disabled?)
> The behavior is the same with .vimrc disabled.
>
> So, my Debian, X, Xfce, Terminal, and/or Vim are not working as documented
> (?).
Try:
vim --version | sed -n -e 1,2p -e /GUI/p -e /clip/p
[toc] | [prev] | [next] | [standalone]
| From | Max Nikulin <manikulin@gmail.com> |
|---|---|
| Date | 2024-02-07 13:50 +0100 |
| Message-ID | <I4Pxf-8wgt-1@gated-at.bofh.it> |
| In reply to | #267112 |
On 07/02/2024 19:19, Greg Wooledge wrote: > On Tue, Feb 06, 2024 at 11:02:09PM -0800, David Christensen wrote: >> * Pressing " then + then p seems to paste from the default Vim buffer -- >> what I seem to recall being referred to as the "yank buffer" (?). >> >> * Pressing " then * then p seems to paste from the default Vim buffer. > > These are the same results that I had. You're most likely running a > vim package built without the full suite of GUI options, just like I am. Only vim.gtk3 and vim.motif support PRIMARY selection and CLIPBOARD registers (you do not need to run gvim). There is no support in vim.tiny, vim.basic (package "vim"), vim.nox. They are built from the same source package with different configure options. It seems neovim (different project) require an external tool for clipboard.
[toc] | [prev] | [next] | [standalone]
| From | Max Nikulin <manikulin@gmail.com> |
|---|---|
| Date | 2024-02-06 04:10 +0100 |
| Message-ID | <I4k0r-8c4r-15@gated-at.bofh.it> |
| In reply to | #267014 |
On 06/02/2024 06:14, David Christensen wrote:
> Enter a Zip Code of "12345", highlight the first result, copy it to the
> clipboard,
[...]> But if I close the above Firefox window, start a Firefox instance,
> browse to:
If you terminate an application handling selection then content is not
available any more. To make selection "persistent", you may try some
clipboard manager, but it may have not always desirable side effects.
To debug you may use xsel or xclip
xclip -o -selection PRIMARY
xclip -o -selection CLIPBOARD
To access primary selection or clipboard in vim use * and + registers:
"*p in normal mode or C-R* in insert mode. It is safer than middle click
or [Ctrl+Shift+V] handled by terminal since selection may contain
terminal control characters (e.g. to exit from vim and to run rm -rf ~
in terminal).
[toc] | [prev] | [next] | [standalone]
| From | David Christensen <dpchrist@holgerdanske.com> |
|---|---|
| Date | 2024-02-06 07:30 +0100 |
| Message-ID | <I4n7Y-8e7W-5@gated-at.bofh.it> |
| In reply to | #267019 |
On 2/5/24 19:03, Max Nikulin wrote:
> On 06/02/2024 06:14, David Christensen wrote:
>> Enter a Zip Code of "12345", highlight the first result, copy it
>> to the clipboard,
> [...]> But if I close the above Firefox window, start a Firefox
> instance,
>> browse to:
>
> If you terminate an application handling selection then content is
> not available any more.
Thank you for the reply. :-)
I did not attempt to paste from the X primary selection after closing
Firefox.
> To debug you may use xsel or xclip
>
> xclip -o -selection PRIMARY
> xclip -o -selection CLIPBOARD
That is useful.
> To access primary selection or clipboard in vim use * and +
> registers: "*p in normal mode
If I start Firefox, browse to https://www.toyota.com/dealers, select the
the first dealer contents, start Vim, press and release the double-quote
key, press and release the asterisk key, and press and release the p
key, Vim inserts a blank line.
> or C-R* in insert mode.
I do not understand your notation:
C-R*
Continuing from above in Vim in normal (command) mode, if I then press
and release the i key, then simultaneously press the Ctrl, r, and
asterisk keys, and then release all keys, nothing happens.
> ... Ctrl+Shift+V
Continuing from above in Vim in Insert mode, if I then simultaneously
press the Ctrl, Shift, and v keys, and then release all keys, Vim
inserts the contents of the clipboard; as confirmed by:
xclip -o -selection CLIPBOARD
David
[toc] | [prev] | [next] | [standalone]
| From | Greg Wooledge <greg@wooledge.org> |
|---|---|
| Date | 2024-02-06 13:30 +0100 |
| Message-ID | <I4sKm-8hCN-15@gated-at.bofh.it> |
| In reply to | #267032 |
On Mon, Feb 05, 2024 at 10:28:53PM -0800, David Christensen wrote:
> Continuing from above in Vim in Insert mode, if I then simultaneously press
> the Ctrl, Shift, and v keys, and then release all keys, Vim inserts the
> contents of the clipboard; as confirmed by:
>
> xclip -o -selection CLIPBOARD
How's that possible? Are you running a GUI version of vim (gvim?)
instead of running vim in a terminal? Or are you using an exotic
terminal?
In xterm and urxvt, Ctrl-Shift-v is identical to Ctrl-v ("literal
next"), so there's no way vim can distinguish the two. And yes, I
tested it just to be sure. In both xterm and urxvt, vim, insert
mode, Ctrl-Shift-v acts exactly like Ctrl-v.
If you're using a terminal that isn't xterm, please specify which.
This applies in general to *any* issue that involves exotic key
combinations, because different terminals handle them differently.
[toc] | [prev] | [next] | [standalone]
| From | Max Nikulin <manikulin@gmail.com> |
|---|---|
| Date | 2024-02-06 15:40 +0100 |
| Message-ID | <I4uMa-8iQn-7@gated-at.bofh.it> |
| In reply to | #267062 |
On 06/02/2024 19:28, Greg Wooledge wrote: > On Mon, Feb 05, 2024 at 10:28:53PM -0800, David Christensen wrote: >> Continuing from above in Vim in Insert mode, if I then simultaneously press >> the Ctrl, Shift, and v keys, and then release all keys, Vim inserts the >> contents of the clipboard; as confirmed by: >> >> xclip -o -selection CLIPBOARD > > How's that possible? Are you running a GUI version of vim (gvim?) > instead of running vim in a terminal? Or are you using an exotic > terminal? Are you considering any vte-based terminal as an exotic one? GNOME terminal, konsole, lxterminal, and others... They have [Ctrl+Shift+v] hotkey out of the box in addition to [Insert]-based ones. As to + and * registers. What kind of vim do you use? At least vim-gtk3 provides console vim binary built with x11 support. Perhaps it is +xterm_clipboard option.
[toc] | [prev] | [next] | [standalone]
| From | Greg Wooledge <greg@wooledge.org> |
|---|---|
| Date | 2024-02-06 16:00 +0100 |
| Message-ID | <I4v5v-8iWQ-3@gated-at.bofh.it> |
| In reply to | #267081 |
On Tue, Feb 06, 2024 at 09:38:11PM +0700, Max Nikulin wrote: > On 06/02/2024 19:28, Greg Wooledge wrote: > > On Mon, Feb 05, 2024 at 10:28:53PM -0800, David Christensen wrote: > > > Continuing from above in Vim in Insert mode, if I then simultaneously press > > > the Ctrl, Shift, and v keys, and then release all keys, Vim inserts the > > > contents of the clipboard; as confirmed by: > > > > > > xclip -o -selection CLIPBOARD > > > > How's that possible? Are you running a GUI version of vim (gvim?) > > instead of running vim in a terminal? Or are you using an exotic > > terminal? > > Are you considering any vte-based terminal as an exotic one? GNOME terminal, > konsole, lxterminal, and others... They have [Ctrl+Shift+v] hotkey out of > the box in addition to [Insert]-based ones. Anything that came from a desktop environment is pretty exotic to me. I'm pretty old-school. If xterm can't do it, then I'll call it exotic. > As to + and * registers. What kind of vim do you use? At least vim-gtk3 > provides console vim binary built with x11 support. Perhaps it is > +xterm_clipboard option. unicorn:~$ vim --version | sed -n -e 1,2p -e /GUI/p -e /clip/p VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 04 2023 10:24:44) Included patches: 1-1378, 1499 Huge version without GUI. Features included (+) or not (-): -clipboard +keymap +printer +vertsplit +eval -mouse_jsbterm -sun_workshop -xterm_clipboard
[toc] | [prev] | [next] | [standalone]
| From | Max Nikulin <manikulin@gmail.com> |
|---|---|
| Date | 2024-02-06 18:10 +0100 |
| Message-ID | <I4x7j-8knU-5@gated-at.bofh.it> |
| In reply to | #267082 |
On 06/02/2024 21:57, Greg Wooledge wrote:
> Anything that came from a desktop environment is pretty exotic to me.
> I'm pretty old-school. If xterm can't do it, then I'll call it exotic.
Rewrap on window resize is a convenient feature of libvte.
Ctrl+Shift+V for xterm:
xterm*vt100.translations: #override \n\
Shift~Ctrl <Key> Insert:insert-selection(PRIMARY, CUT_BUFFER0) \n\
Shift Ctrl <Key> Insert:insert-selection(CLIPBOARD) \n\
Shift Ctrl <Key>C: exec-formatted("sh -c 'xsel --output
--primary | \
exec xsel --input --clipboard'", PRIMARY)\n\
Shift Ctrl <Key>V: insert-selection(CLIPBOARD)
>> As to + and * registers. What kind of vim do you use? At least vim-gtk3
>> provides console vim binary built with x11 support. Perhaps it is
>> +xterm_clipboard option.
> unicorn:~$ vim --version | sed -n -e 1,2p -e /GUI/p -e /clip/p
> VIM - Vi IMproved 9.0 (2022 Jun 28, compiled May 04 2023 10:24:44)
> Included patches: 1-1378, 1499
> Huge version without GUI. Features included (+) or not (-):
> -clipboard +keymap +printer +vertsplit
> +eval -mouse_jsbterm -sun_workshop -xterm_clipboard
If you do not like vim-gtk3, perhaps vim-motif has support of * and +
registers.
[toc] | [prev] | [next] | [standalone]
| From | Nicolas George <george@nsup.org> |
|---|---|
| Date | 2024-02-06 18:40 +0100 |
| Message-ID | <I4xAm-8kxI-5@gated-at.bofh.it> |
| In reply to | #267087 |
Max Nikulin (12024-02-07):
> Shift Ctrl <Key>C:
Ctrl<Key>Insert is the standard counterpart to Shift<key>Insert.
> exec-formatted("sh -c 'xsel --output --primary |
> \
> exec xsel --input --clipboard'", PRIMARY)\n\
copy-selection(CLIPBOARD)
… is simpler.
Regards,
--
Nicolas George
[toc] | [prev] | [next] | [standalone]
| From | Max Nikulin <manikulin@gmail.com> |
|---|---|
| Date | 2024-02-07 04:30 +0100 |
| Subject | xterm PRIMARY and CLIPBOARD selection [was: Re: Copy from Firefox and paste into Terminal with Vim] |
| Message-ID | <I4GNj-8qUx-1@gated-at.bofh.it> |
| In reply to | #267088 |
On 07/02/2024 00:38, Nicolas George wrote:
> Max Nikulin (12024-02-07):
>> Shift Ctrl <Key>C:
>
> Ctrl<Key>Insert is the standard counterpart to Shift<key>Insert.
It may be a convention for applications other than terminals, however I
am unsure what "standard" means for terminals. Konsole has "reverted"
bindings: [Shift+Insert] for CLIPBOARD and [Ctrl+Shift+Insert] for
PRIMARY. Unsure if it was so before appearance of Wayland (it did not
support PRIMARY at first). I have seen a (likely) KDE bug that paste
from PRIMARY by middle click is a security issue, so it should not be
supported.
Certainly, it is up to you if you wish to have [Ctrl+Insert] binding. I
am unaware of any conflicts with applications running in terminals.
>> exec-formatted("sh -c 'xsel --output --primary | \
>> exec xsel --input --clipboard'", PRIMARY)\n\
>
> copy-selection(CLIPBOARD)
>
> … is simpler.
Thanks, it seems, it works in bookworm. Several years ago xterm did not
support ownership of independent CLIPBOARD and PRIMARY simultaneously.
It was a workaround for the following scenario:
- select some text
- copy it to CLIPBOARD
- select another fragment of text (PRIMARY)
- switch to another application
- paste from PRIMARY
- paste from CLIPBOARD
I have the following note
! Allow both primary selection and clipboard copy-paste
! Ctrl+Shift+V, Ctrl+Shift+Insert, Ctrl+Shift+C similar to gnome-terminal
! Should work out of the box:
! Shift <KeyPress> Insert:insert-selection(SELECT, CUT_BUFFER0)
! Notice that copy-selection(CLIPBOARD) binds PRIMARY and SELECTION, see
! https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=588785#108
! There is no point to use CUT_BUFFER1 as in xterm(1) "Custom Key Bindings"
! insert-selection(CLIPBOARD, CUT_BUFFER1)
Likely the related changes
https://invisible-island.net/xterm/xterm.log.html#xterm_336
Patch #336 - 2018/09/19
ensure that only one of PRIMARY and CLIPBOARD is owned by xterm
at a given time (Debian #901249).
https://invisible-island.net/xterm/xterm.log.html#xterm_338
Patch #338 - 2018/12/09
revert the change which prevented concurrent ownership
of different selection targets, and instead modify selection storage
so that different concurrent requests for different selection
targets will be stored/retrieved independently (Debian #901249).
For me it is not easy to follow discussions of xterm bugs and to read
man page selections related to selection.
[toc] | [prev] | [next] | [standalone]
| From | Nicolas George <george@nsup.org> |
|---|---|
| Date | 2024-02-07 13:30 +0100 |
| Subject | Re: xterm PRIMARY and CLIPBOARD selection [was: Re: Copy from Firefox and paste into Terminal with Vim] |
| Message-ID | <I4PdT-8w9I-1@gated-at.bofh.it> |
| In reply to | #267095 |
Max Nikulin (12024-02-07): > It may be a convention for applications other than terminals, however I am > unsure what "standard" means for terminals. I have not said it is more “standard for terminals”, I have that it is more “standard” fullstop. It is more standard by the virtue of having worked for decades, C-Ins S-Ins S-Del existed way before the C-C C-V C-X tryptich, and still working today in most contexts. > Thanks, it seems, it works in bookworm. Several years ago xterm did not > support ownership of independent CLIPBOARD and PRIMARY simultaneously. It > was a workaround for the following scenario: > > - select some text > - copy it to CLIPBOARD > - select another fragment of text (PRIMARY) > - switch to another application > - paste from PRIMARY > - paste from CLIPBOARD Works for me. The author of XTerm is quite reactive if you can explain the issue clearly, I am not surprised it was fixed. Regards, -- Nicolas George
[toc] | [prev] | [next] | [standalone]
| From | Stefan Monnier <monnier@iro.umontreal.ca> |
|---|---|
| Date | 2024-02-07 14:20 +0100 |
| Subject | Re: xterm PRIMARY and CLIPBOARD selection [was: Re: Copy from Firefox and paste into Terminal with Vim] |
| Message-ID | <I4Q0h-8wFv-7@gated-at.bofh.it> |
| In reply to | #267110 |
> I have not said it is more “standard for terminals”, I have that it is
> more “standard” fullstop. It is more standard by the virtue of having
> worked for decades, C-Ins S-Ins S-Del existed way before the C-C C-V C-X
> tryptich, and still working today in most contexts.
Indeed, IIUC these key bindings were part of the CUA standard:
https://en.wikipedia.org/wiki/IBM_Common_User_Access
Stefan
[toc] | [prev] | [next] | [standalone]
Page 1 of 3 [1] 2 3 Next page →
Back to top | Article view | linux.debian.user
csiph-web