-1

I have a specific request. First, I have a Python shell where I print a column of values :

>>> np.savetxt(sys.stdout, np.matrix(bias_new).T)
1.399821417181491778e+00
1.444645285182490690e+00
1.496495907111008439e+00
1.565247584249852775e+00
1.774823934929884883e+00

I have another file edited with vim and I would like to be able to insert this above column of values directly in this file (after the second column of file). For the moment, I can copy in buffer this column by doing CMD+C and on the edited file, I can select a block with CTRL+V but I don't know how to insert directly the buffered column into vim edited file as a third column.

Maybe it is not possible on MacOS. But if it is, this would be nice to explain the way to do it.

halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

Copy the text, then use any of the :put commands with the * register:

:put[!] *
"*p
"*P
"*[p

Etc.


Since you need to paste it as a column, I would suggest pasting as before, the using <C-v> to block-select it, d to delete, then p to paste as column.

D. Ben Knoble
  • 4,273
  • 1
  • 20
  • 38
  • Thanks but If I set the command `:put[!] *`command into vim on MacOS Catalina vim, it tells me ; `E488: Caractères surnuméraires` (Sorry this is in french) : what am I doing wrong ? –  Feb 09 '20 at 13:13
  • @youpilat13 les excuses ne sont pas nécessaires! Mon vim est aussi en français. Are you typing the square brackets? – D. Ben Knoble Feb 09 '20 at 13:15
  • Yes, I wrote the same expression as you indicated it : `:put[!] *`. Maybe this issue comes from my MacOS vim (version 8.1.2234) ? –  Feb 09 '20 at 15:18
  • @youpilat13 not at all! The square brackets are just a convention to indicate optional parts, the commands are `:put` and `:put!`, with slightly different behaviors – D. Ben Knoble Feb 09 '20 at 15:27
  • Have I to choose a simple letter for register instead of your character star `*` ? I can easily delete a column into visual bloc mode but have still difficulies to paste/insert the column above : I don't understans the commands `"*p`, `"*[p` in command mode and I didin't find a lot of documentation about this : could you explain please with more details how does it work ? –  Feb 09 '20 at 17:17
  • The best documentation is `:help p` for the normal-mode put commands (`"*p` means put from the star register; more generally, `"xp` puts from register x). Try `:help :put` for the ex-command version. And then you might want `:help quote-star` and `:help quote-plus` for the clipboard-relevant registers – D. Ben Knoble Feb 09 '20 at 18:45
  • After a copy into clipboard with `CMD+C` of the column at the beginning of this post, I tried in command mode : `:put a`. Then, I have deleted the colum in visual block mode and finally did : `"*p`. The main problem is that the command `:put a`adds an extra line with characters : `^[^[:^[`. How to circumvent it ? Regards –  Feb 09 '20 at 23:08