Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to yank current cmdline? #102

Open
amerlyq opened this issue Nov 27, 2015 · 0 comments
Open

How to yank current cmdline? #102

amerlyq opened this issue Nov 27, 2015 · 0 comments

Comments

@amerlyq
Copy link

amerlyq commented Nov 27, 2015

With default / I used next mapping to yank current cmdline directly from cmdline:

function! CopyStringInReg(r, str)
 " Preserve previous buffer in register.
  call setreg('p', getreg(a:r, 1),  getregtype(a:r))
  call setreg(a:r, a:str, getregtype(a:r))
  call CountLinesInRegister(a:r, '@'. a:r .':')
endfunction
cnoremap <C-y> <C-R>=CopyStringInReg('+', getcmdline())<CR><C-H>

How can I do something similar from inside incsearch.vim fake cmdline?
I know there is something like cli-remapping. But this don't work:

  let g:incsearch_cli_key_mappings = { "\<C-y>": {
        \ 'key': "\<C-r>=CopyStringInReg('+',incsearch#cli()._pattern)\<CR>\<C-h>",
        \ 'noremap': 1 }}

I haven't found any useful field inside incsearch#cli() dict, which I could use instead of getcmdline().
Any useful suggestions/alternatives are very desirable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant