I would like to copy the first words of multiple lines.
Example of code :
apiKey := fmt.Sprintf("&apiKey=%s", args.ApiKey)
maxCount := fmt.Sprintf("&maxCount=%d", args.MaxCount)
id := fmt.Sprintf("&id=%s", args.Id)
userid := fmt.Sprintf("&userid=%s", args.Userid)
requestFields := fmt.Sprintf("&requestFields=%s", args.RequestFields)
I would like to have this in my clipboard :
apiKey
maxCount
id
userid
requestFields
I tried with ctrl-v and after e, but it copies like on the image :
Press 0 to go to the beginning of a line, or ^ to go to the first non-blank character in a line.
Manipulate multiple lines of textPress Shift+V to enter line mode. The words VISUAL LINE will appear at the bottom of the screen. Use navigation commands, such as the Arrow keys, to highlight multiple lines of text. Once the desired text is highlighted, use commands to manipulate it.
You could append every first word to an empty register (let's say q
) using
:'<,'>norm! "Qyiw
That is, in every line of the visual selection, execute the "Qyiw
sequence of normal
commands to append (the first) "inner word" to the q
register.
You need to have >
in cpoptions
for the newline to be added in between yanks (:set cpoptions+=>
), otherwise the words will be concatenated on a single line.
If you want to quickly empty a register you can use qqq
in normal mode (or qaq
to empty register a
).
Note: the unnamed register (""
) will also contain what you want at the end of the operation, so you don't need to "qp
to paste it, p
will do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With