Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy command/search history to clipboard

Tags:

vim

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))

like image 405
Reman Avatar asked Oct 30 '22 16:10

Reman


1 Answers

This worked for me:

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

and to close the window after:

nnoremap <Leader>r q::%y<cr>:q<cr>
like image 128
mattb Avatar answered Nov 15 '22 02:11

mattb