Reman
Reman

Reputation: 8109

Copy command/search history to clipboard

I'm trying to insert the commands

Copy Command History to clipboard q::%y
Copy Search History to clipboard q/:%y

in a vimscript doing this:

:normal q::%y
:normal q/:%y

but it doesn't copy anything
Why?

(It works fine when I do it manually (q::%y q/:%y))

Upvotes: 6

Views: 325

Answers (1)

mattb
mattb

Reputation: 3063

This worked for me:

nnoremap <Leader>r q::%y<cr>

and to close the window after:

nnoremap <Leader>r q::%y<cr>:q<cr>

Upvotes: 2

Related Questions