chrisbra / csv.vim

A Filetype plugin for csv files
http://www.vim.org/scripts/script.php?script_id=2830
Vim License
1.28k stars 62 forks source link

Question: Pasting data into a column #225

Closed openjck closed 11 months ago

openjck commented 1 year ago

Please let me know if there's a better place to ask questions.

Is there a way to paste data into a column? For example, imagine my clipboard contains 100 lines of text, separated by newlines. Is there a way to paste that data into a particular column, such that each line of text in the clipboard becomes one cell in that column?

This can be done in Excel. For example, if I copy the following data:

Kiley

Rosalia

Zondra
Samara

...then create a new Excel spreadsheet, left-click on cell A:1, and finally use CTRL+V to paste, the following results:

A screenshot of Excel, with the data above occupying cells A:1 through A:8, in order, with empty spaces preserved

It's easy enough to do this when the spreadsheet is empty, but Excel also makes it possible to do this in any arbitrary column.

Can something like that be achieved using csv.vim?

chrisbra commented 1 year ago

It may be possible, by setting the register to be pasted to blockwise mode.

So try the following:

call setreg('a', '+', 'b')
norm! "ap

untested