FG
💻 Software

How do I copy command output in vim?

Fresh7 days ago
Mar 15, 202618994 views
Confidence Score1%
1%

Problem

For example, if I type ' ' to get the current working directory, I can select the text in gvim but I can't figure out how to copy it to the clipboard. If I try the same in console vim, I can't even select it with the mouse. I would like this to work with all vim commands, such as to copy the output.

Error Output

:pwd

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How do I copy command output in vim?

Low Risk

Are you looking for this, :redir command redirects the output of a command to a register (@*). The register @* refers to the clipboard. For more info on this,

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment