Skip to main content

Copying and Pasting Rows

VisiData's clipboard operations work on rows and cells as two separate clipboards. Yank (copy) to the internal clipboard, then paste elsewhere. Cut removes the source and yanks it in one step.

GoalCopyPaste
Duplicate / move a rowyp / P
Copy one cell → another cellzyzp
Fill a column for selected rowszygzp
Learning Focus

Master the row workflow (y → p) for duplicating rows. For a single cell, use zy → zp. To fill a column, use zy → select rows → gzp.

Common mistake

y then p does not overwrite a cell — it inserts a whole new row. Cell-to-cell copy is zy then zp.

Yank (Copy) and Paste Rows​

y # yank (copy) current row to internal clipboard
gy # yank all selected rows
Y # yank current row to system clipboard (needs xclip)
p # paste yanked rows AFTER current row (inserts new rows)
P # paste yanked rows BEFORE current row (inserts new rows)

Duplicate a row:

# Move cursor to the row you want to copy
y # yank it

# Go to end of sheet
gG

# Paste
p # row is duplicated at the end

# Edit the copy
e # change values as needed

Yank multiple rows:

# Select all 'active' rows
|
# Enter: active

# Yank all selected
gy

# Navigate to destination
p # paste all yanked rows

Cut and Move Rows​

x # cut (yank + delete) current row
gx # cut all selected rows
# Move a row to a different position
# Move cursor to the row
x # cut it

# Navigate to target position
p # paste after current row

Cell-Level Copy and Paste​

Cell clipboard keys are all under the z prefix. They never insert rows.

zy # yank (copy) current cell value only
zp # paste yanked value INTO current cell (overwrite)
zY # yank current cell value to system clipboard
gzp # paste yanked value into current column for SELECTED rows

Paste into a single cell (zy → zp)​

Overwrite one destination cell with a copied value:

# 1. Source cell (e.g. city = 'SG')
zy # yank 'SG'

# 2. Move to the destination cell (e.g. Bob's empty region)
hjkl

# 3. Overwrite that cell
zp # region is now 'SG'

zp targets the cell under the cursor only. No row selection required.

Paste into a column for selected rows (zy → gzp)​

Fill one column across many rows:

# Move to a cell containing 'sg'
zy # yank 'sg'

# Select rows with empty region
z|
# Enter: region == ""

# Move to 'region' column
gzp # all selected rows now have 'sg'

Copy a tax rate to every row:

# Move to cell containing 0.07
zy

# Move to 'tax_rate' column
gs # select all rows
gzp # paste 0.07 into every row
gzp needs selected rows

With no rows selected, gzp reports no rows selected. Use s / gs / | / z| first — or use zp for a single cell.

note

v is not visual cell select (it toggles multiline display). Select rows with s / t / |, then paste with gzp. The custom Alt+5 cell-select plugin is highlight-only and is not used by paste.


Quick Reference​

KeyAction
yYank (copy) current row
gyYank all selected rows
YYank to system clipboard (needs xclip)
pPaste yanked rows after current row (inserts rows)
PPaste yanked rows before current row (inserts rows)
xCut current row (yank + delete)
gxCut all selected rows
zyYank current cell value only
zpPaste cell value into current cell (overwrite)
zYYank cell value to system clipboard
gzpPaste cell value into column for selected rows

Hands-On Practice​

vd ~/github/practice-folder/visidata/01-loading/01-employees.csv

# 1. Duplicate a row: move cursor → y → gG → p
# 2. Cut and move: move cursor → x → navigate → p
# 3. Copy one cell to another: move to source → zy → dest → zp
# 4. Fill a value: move to 'sg' cell → zy → select rows → gzp

What's Next​