How to yank from the command line

vivim

I wonder if it is possible to yank something I have written in the command line from vim so I can later paste it again.

This would be particularly useful because I often try out search/replace patterns by just searching for them first and – if they match what I need – I would like to be able to just copy that searched expression from the command line and use it in my search/replace function.

I already know that you can paste into the command window by using <ctrl-r><buffer> and I just wonder if there is a command similar to this that will yank my whole command window.

Best Answer

You can use the command line window. Use q+: to open it. Then you can navigate the window as an ordinary one and yank what you want to yank.