0

I sometimes need to copy the current value of a set option, e.g. set statusline, into the clipboard (+) to paste its value here.

I know how to show the current value of a set option, e.g. set statusline?, but how can I copy that value to the clipboard (+)?

1 Answer 1

5

Just like this

let @+ = &statusline

Or like this

call setreg("+", getbufvar("%", "&statusline"))

Or even like this...

if has("nvim")
  call provider#clipboard#Call("set", [[matchstr(execute("set statusline"), "=\@=.*"], "v", "+"])
endif

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.