Hot answers tagged

7 votes
Accepted

Find and open a file by fzf in a new tab

The Vim fzf plug-in has a native feature to open the selected item in a new tab. If you type Ctrl+T inside the fzf selection window, it will tell Vim to open the item in a new tab (when applicable.) ...
user avatar
  • 26.2k
5 votes
Accepted

How to prevent cnoremap taking effect for "/" searching?

Another solution is to use an abbreviation: cnoreabbrev <expr> fzf (getcmdtype() == ':' && getcmdline() =~ '^fzf$')? 'FZF' : 'fzf' You check that the command line type is : and that you ...
user avatar
  • 46.5k
4 votes
Accepted

Open FZF in current directory of file I am viewing

You can use :Files [PATH] for this. See the command reference. To pass in the directory: :Files %:p:h Alternatively, you can also use lcd to change the directory for the current window, then use FZF ...
user avatar
4 votes
Accepted

FZF showing error on preview

The arguments you pass to :FZF are split at spaces and tabs, because :FZF uses the escape sequence <f-args>. This means that Vim splits the arguments on these 2 spaces: :FZF --preview 'cat {}' ...
user avatar
  • 5,517
4 votes

FZF showing error on preview

I'm not sure why this error occurs (I have exactly the same here), however there's a workaround. So this is not a direct answer, but I hope it helps nonetheless. You can set defaults options for FZF ...
user avatar
  • 2,550
3 votes

How to prevent cnoremap taking effect for "/" searching?

You need to use an expr mapping: cnoremap <expr> fzf getcmdtype() isnot# ':' ? 'fzf' : 'FZF' You could also (maybe?) use a self-destroying mapping: augroup fzf_mapping autocmd! autocmd ...
user avatar
  • 21.5k
2 votes
Accepted

How do I setup a command to use the "in word" as an argument

how could I send the in word as an argument? expand('<cword>') Also see :h expand() for a full list of specials.
user avatar
  • 16.9k
2 votes

How do I backup/restore fzf.vim recentfile history?

Seems to be using the 'oldfiles' in vim where it's location can be determined by the following answer: https://vi.stackexchange.com/a/17260/13656 In my case it's ~/.local/share/nvim/shada/main.shada.
user avatar
2 votes
Accepted

fzf.vim how to configure the maximum amount of files stored in recent files history?

:History command operates on :oldfiles result which is stored in v:oldfiles variable that is loaded from viminfo. You can change it by changing viminfo, there might be better approach, but anyways: ...
user avatar
  • 10.4k
2 votes
Accepted

deleting a plugin (not a user defined) command?

While I'm not entirely sure deleting this command is a great idea you can do it using an autocommand like this in your vimrc: augroup deletePluginCommand autocmd! autocmd VimEnter * delcommand ...
user avatar
  • 46.5k
2 votes
Accepted

How to find files which contain given fragment?

fzf.vim provides several commands suited for this task: :Rg which uses ripgrep :Ag which uses the Silver Searcher (ag) These are external tools, they must be installed on the system (e.g. install ...
user avatar
  • 2,550
2 votes
Accepted

How do I run fzf#run not in full screen and yet store the output into a variable?

The fzf#wrap function returns a table of default options, along with what you provided to it ({'source': 'ps -e'} in your example). fzf#run function uses sink value of the options table to determine ...
user avatar
  • 3,082
1 vote
Accepted

Vim getting stuck after selecting a file in fzf preview

Thanks to @d-ben-knoble, in my case I had vim-surround in my vimrc which was causing this behaviour I removed that and now is fixed.
user avatar
1 vote

filetype plugin indent on is blowing up my vim

I solved this problem by using neovim instead of vim. Neovim gave me a better error message: unkown option: --layout=reverse-list from there i realized that I was using an outdated version of fzf, ...
user avatar
  • 561
1 vote

Citations in VIM: the fzf-Bibtex PlugIn

The command to type to test it is in your path is :!bibtex-ls You are executing an external programme, not a vim command. However, if you want to actually use fzf-bibtex in Vim in a meaningful way, ...
user avatar
  • 11
1 vote
Accepted

Can a vim filter be interactive?

On MacOS and Linux, this seems to work in vim (but not neovim): :set noshelltemp Afterwards this works as hoped. :r ! echo -e 'foo\nbar\nbaz' | fzf -m
user avatar
  • 181
1 vote

How do I remap <c-x><c-k> to work with fzf.vim completion?

you can execute command in insert like that <C-o>:echo "test"<cr> : inoremap <leader>k <C-o>:fzf#vim#complete#word({'window': { 'width': 0.2, 'height': 0.9, 'xoffset':...
user avatar
1 vote
Accepted

How to write a command that uses sends the output of an arbitrary git command to fzf?

It turns out I was overthinking this and I also missed some of the documentation. fzf#run can accept an arbitrary command which returns a list of files. A working example without a preview window: ...
user avatar
  • 135
1 vote

Open FZF in current directory of file I am viewing

As mentioned in accepted reply, to expand the solution I add nnoremap <Leader>pf :Files %:p:h<CR> to ~/.vimrc
user avatar
  • 11
1 vote

fzf vim - when configured to display filenames of matched items, how to filter on just content and not the file names

I assume the arguments of grep are similar to fzf#run. If that is the case you need to set: { 'dir': getcwd(), 'options': '-n 2'} The -n tells the column that is relevant for the search. You can do ...
user avatar
  • 1,154
1 vote
Accepted

Is there an fzf for finding an open tab?

You need :Windows instead of :Buffers because output of that command has a tab column.
user avatar
1 vote
Accepted

How can I get a path with fzf.vim and use to insert a snippet?

You can do something like that: function! HandleFZF(file) echo a:file endfunction command! -nargs=1 HandleFZF :call HandleFZF(<f-args>) Then, to invoke fzf, run: call fzf#run({'sink': '...
user avatar
  • 1,081
1 vote
Accepted

Is it normal that I can't erase an input to FZF?

No, it isn't the normal behavior for fzf.vim. I was able to backspace normally to delete typed text. Check your mappings by running :map <Backspace>.
user avatar
  • 244

Only top scored, non community-wiki answers of a minimum length are eligible