5 votes

Behaviour of BufEnter

I don't use fzf and use Vim instead of neovim. So I couldn't reproduce your scenario. Also I was not able to reproduce what @dedowsdi described in his comment.(See end of answer.) But some general ...
user avatar
  • 8,675
5 votes
Accepted

How to call the fzf Ag command with multiple arguments?

TL;DR: You can't pass ag options into that command. (But jump to the bottom for a different one.) Note the distinction between the :Ag command and the fzf#vim#ag function. The :Ag command calls the ...
user avatar
  • 28.3k
5 votes
Accepted

How to remove entries from v:oldfiles list in neovim

Fix entries in ShaDa File (neovim-specific) Neovim does not use anymore the plaintext file viminfo (used by vim) to store this but uses a msgpack formatted file called ShaDa (short for shared data, :...
user avatar
  • 4,050
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

Use feedkeys then do command

You might be able to make this work with feedkeys, but it's usually hard/brittle to do so. I would recommend using something input(':cd ', getcwd(), 'dir') to get the directory as input (with ...
user avatar
  • 21.5k
4 votes

How can I change the cursor moving on fzf?

this is the default mapping of up and down in fzf: down : ctrl-j ctrl-n down up : ctrl-k ctrl-p up Most people don't have problem with this. If you really really want to add your own setting, ...
user avatar
  • 5,908
3 votes

How can I pass extra flags to FZF/ripgrep commands with the leader key?

Please note that I changed your mapping to suit my keyboard. However this is what I got in terms of functionality: nnoremap <C-P> :MyFind0<CR> nnoremap <Leader><C-P> :MyFind1&...
user avatar
  • 143
2 votes

How to exclude filenames from Ag search (via fzf.vim)?

To find files which contains some string, the :grep command is "for that". And I know it's quite slow. For that purpose, I have added the :Find command to my .vimrc: (From this post) command! -...
user avatar
  • 442
2 votes
Accepted

VIM FZF, searching multiple directories

You can specify the command to obtain the input of fzf by using the fzf#run() function. In your case, this can look something like this: call fzf#run({'source': 'find ~/project/ ~/libs/include -type ...
user avatar
  • 916
2 votes
Accepted

FZF --preview in Vim returns zsh shell error

I don't have $LINES defined in my Vim environment, and I'm using Zsh, so it's probably not exported to child processes. However, to make this work you need to remove quotes and escape spaces: :FZF --...
user avatar
  • 4,238
2 votes
Accepted

How to use fzf :Buffers/:Files commands from vim terminal buffer

The error E948 only occurs if hidden is not set. In this case vim does not allow to move a modified buffer out of view (lingua Vim: "abandon"). A terminal buffer with a running process (e.g. the shell)...
user avatar
  • 8,675
2 votes

Insert filepath from FZF window in buffer

Add FZF setup: func! s:insert_file_name(lines) let @@ = fnamemodify(a:lines[0], ":p") normal! p endfunc let g:fzf_action = { 'ctrl-r': function('s:...
user avatar
  • 10.4k
2 votes
Accepted

Can I set the default search directory on fzf?

The following info can be found in the official docs of fzf: You can execute :FZF with an argument for the starting dir. So you can just run :FZF ~ instead of :FZF. If you open the fzf buffer from a ...
user avatar
  • 1,519
2 votes
Accepted

Can't search for strings within hidden files with fzf's Rg command in vim

A bit late but I had this issue as well. As you're using fzf.vim you can configure the Rg command as per their instructions by adding the following to your init.vim file and adding in the --hidden ...
user avatar
  • 136
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
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
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

Custom key binding for project-wide search and replace using FZF.vim Rg function?

No plugins: set the args list (e.g., :args git ls-files) search (:vimgrep /pat/ ##) replace (:cdo substitute/...) save (:argdo update or :wall or whatever) Alternately, search with :grep -R ... * or ...
user avatar
  • 21.5k
1 vote
Accepted

Opening multiple files in Vim with fzf.vim's Rg command

Any idea why I can't open multiple files with an Rg command? That is how Rg is implemented. If there are multiple entries selected it opens all of them in vim quickfix. Check ag_handler it uses for ...
user avatar
  • 10.4k
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
1 vote

How could I customize preview window coloring with results from Ripgrep and fzf?

If installed, fzf vim uses bat to add syntax highlighting to the preview. bat comes with several themes available. You can choose a theme by setting the BAT_THEME environment variable. For example, ...
user avatar
  • 67
1 vote
Accepted

Tracking down odd behavior right after opening Vim and using fuzzy finder

Thanks to some very helpful comments by @dedowsdi I have discovered some more about the vast world that is Vim. You can test startup load time by running vim --startuptime vtime.log and inspecting ...
user avatar
  • 248
1 vote
Accepted

How to use FZF to search directories and open new file in directory

I ended up using this command in my vimrc with fzf.vim, specifically filtering directories in my current git repo. function! s:append_dir_with_fzf(line) call fzf#run(fzf#wrap({ \ 'options': ['--...
user avatar
1 vote

Insert filepath from FZF window in buffer

You will need to run the underlying FZF functions to do so. Say you intend to adapt Files to do so. :Files probably calls fzf#run at some point. Find that call. The sink argument of fzf#run (and ...
user avatar
  • 1,154
1 vote
Accepted

Context aware fzf command

Based on what I read at Vimways, I would do something like this: First, we need filetype-detection working, so for every filetype you need, in ~/.vim/ftdetect/<filetype>.vim, put autocommand ...
user avatar
  • 21.5k
1 vote

Why does `:call f(...)` do nothing while mapping it to a binding works?

This touches the implementation details of fzf#complete. If you look into the source code of fzf#vim#complete, you will see call feedkeys("\<Plug>(-fzf-complete-trigger)") return '' So when ...
user avatar
  • 1,517
1 vote

How to remove entries from v:oldfiles list in neovim

I have written an article on dev.to about accessing v:oldfiles entries, here is the function to access oldfiles outside of vim: function old(){ [[ -f /tmp/oldfiles.txt ]] && \rm /tmp/...
user avatar
  • 1,017
1 vote

Can I set the default search directory on fzf?

You can provide a default path to fzf if you configure it to use fd (or rigrep or ag) in your .bashrc. Then calling fzf from vim will also use this path as a starting point. My .bashrc has the ...
user avatar
  • 917
1 vote

How can I change the cursor moving on fzf?

You can use --bind to change mappings to everything you like: So something along the lines of this should work for you: map <silent> <F2> :call fzf#run({'source': 'rg --files --column --...
user avatar
1 vote
Accepted

How to add a fallback when :b buffer change fails

You can't change the way the :b command works, but you can create an alternative :B command, and then create an abbreviation to always use the :B command when you type :b. The below works by first ...
user avatar
  • 28.3k

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