1

I find myself selecting text from a vim buffer and appending it to another file. I currently do that by:

  • select the text with Shift + V
  • in commend mode, execute: w >> my_file

This requires that I write the exact filepath to my_file. Instead, I would like to use fzf.vim to fuzzy find the file I am writing into. What is the best way to do this?

I tried the following, but it just append bunch of garbage instead of selected text.

call fzf#run({'sink': 'w>>'})

  • 1
    You know Vim has built-in filename completion, right? – romainl Jun 09 '23 at 08:43
  • if you mean tab completion, I have been using that but it's not optimal. The new files I need to copy my text into are nested into directory and I need to remember the path of the file. I am trying to simplify this with fuzzy finder. – user1602031 Jun 10 '23 at 06:28
  • Hmm. Doing `:w >> **my` then a couple of ``s may not be as *refined* as the fuzzy magic of fzf, but it sure is pretty optimal. Making it a mapping would be even more optimal. – romainl Jun 11 '23 at 07:58
  • Hitting works only when you know when the file is located. For example: I have 10 directories under my Documents folder. Each one of them has 2-3 directories which contains documents. When I need to copy text into file.txt, I need to know it's path [dirA/dirB/file.txt]. ing can help me write this path without typing it but it can't help me if I don't already know that file.txt lives in dirA/dirB (unless I am missing something here). – user1602031 Jun 13 '23 at 22:30
  • Yes, you are a) thinking about the command I suggested instead of trying it and b) you are missing the `**`. – romainl Jun 14 '23 at 05:51

0 Answers0