6

Using CtrlP with GVim I often need to open a file with the name from the system clipboard (on Windows). So my workflow should be:

  • Ctrl+P
  • {somehow paste name from the clipboard}
  • Select file and open it

In the CtrlP input line I tried:

  • Ctrl+R+ - it didn't work. Ctrl+R is remapped by CtrlP.
  • Ctrl+Ins it inserts "+P

The equivalent without CtrlP plugin would be:

:e **/Ctrl+R+TAB

So my question is, how can I paste into the CtrlP input line from the system clipboard?

Note: This is not a problem, if using vim within the console, where proprietary coping and pasting is implemented.

10

You can paste from any register (including the clipboard) into CtrlP, as explained in :help ctrlp-pasting:

  <Insert>,                                                   *'ctrlp-pasting'*
  <MiddleMouse>
    Paste the clipboard content into the prompt.

  <c-\>
    Open a console dialog to paste <cword>, <cfile>, the content of the search
    register, the last visual selection, the clipboard or any register into the
    prompt.

Choose your own mappings with |g:ctrlp_prompt_mappings|.

Using the default mappings you should type Ctrl+\ followed by c (the 'c' appears on the input prompt for clipboard).

Another options are to use the Insert key or the middle mouse button.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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