VI Editor : Yank the entire file to clipboard (specific to OS X)

前端 未结 3 1702
忘了有多久
忘了有多久 2020-12-31 05:40

Is there any way to copy all lines from a file to clipboard in VI editor. I have tried *yG, +yG, \"+yG and :%y+ from prev

3条回答
  •  长情又很酷
    2020-12-31 06:16

    G just means "go to the end of the file", and you need quotes before * or + to make them effective as clipboard registers. You're looking for something more like gg"*yG which means:

    gg - go to the top of the file

    "* - use the * register

    y - begin yank

    G - go to the bottom of the file

    or you could use :!cat % | pbcopy which is not unlike the fine solutions romainl provided.

提交回复
热议问题