Hi Sébastien, hi Marc,
On 2020-03-12, Sébastien Labbé <
sla...@gmail.com> wrote:
> You may not be using the good register. You may see what is in the current
> registers by writing:
>
>:registers<ENTER>
>
> To yank in the register +, you do "+y or "+\Y to yank with Marc's code. The
> register + is the clipboard on my machine (Linux). On OSX, the register +
> was not the clipboard...
By some duckduckgo search, I found
https://stackoverflow.com/questions/3961859/how-to-copy-to-clipboard-in-vim,
from which I learned two things:
1. To access the OS's clipboard, one either needs to compile vim with the
+clipboard flag, or (easier) "sudo apt-get install vim-gnome"
(or perhaps installing vim-gtk will work, too)
2. In Windows, the registers + and * are equivalent. For X11 systems,
though, they differ. For X11 systems, * is the selection, and + is
the cut buffer (like clipboard).
After installing vim-gnome and opening a Sage source file in vim, I
hit V, moved down a few lines (marking a doctest) including the expected
output, then hit "*\Y and went to Sage, hit <shift>-insrt, et voilà: The
expected output and the prompts were removed and the test correctly
evaluated.
Caveat: It was treated as a single block of code, i.e. it was
not evaluated line by line, i.e. the original doctest was not recreated.
For example, the test from the file
sage: M = MatrixSpace(GF(25,'z'),2,3)([1,2,3,4,5,6])
sage: print(M)
[1 2 3]
[4 0 1]
sage: type(M) # optional: meataxe
<type 'sage.matrix.matrix_gfpn_dense.Matrix_gfpn_dense'>
eventually became
sage: M = MatrixSpace(GF(25,'z'),2,3)([1,2,3,4,5,6])
....: print(M)
....: type(M) # optional: meataxe
....:
[1 2 3]
[4 0 1]
<class 'sage.matrix.matrix_gfpn_dense.Matrix_gfpn_dense'>
in Sage command line after pasting.
In spite of the caveat, I think it is a quite useful addition!
Best regards,
Simon