Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim yank path under the cursor

Tags:

vim

What's the most efficient way to yank a path that's under a cursor? So if a line has the following contents:

/some/file /some/other/file /last/file

... and the cursor is over other, I would like to yank /some/other/file. Normally, if it were a word yiw would work, but since that path contains quotes, yiw would only yank other rather than the entire /some/other/file.

Is there a way to efficiently yank the entire filename?

like image 220
juniper- Avatar asked Jan 27 '26 12:01

juniper-


1 Answers

A word consists of a sequence of letters, digits and underscores, or a sequence of other non-blank characters, separated with white space (spaces, tabs, ). This can be changed with the 'iskeyword' option. An empty line is also considered to be a word.

A WORD consists of a sequence of non-blank characters, separated with white space. An empty line is also considered to be a WORD.

yiW - just need to capitalize the W

like image 160
dave Avatar answered Jan 30 '26 07:01

dave



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!