5

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 stuff around autocmd and feedkeys: Assume we open Vim with three new files in split windows: vim -O a.txt b.txt c.txt Vim will open with three windows like ...


5

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 fzf#vim#ag function passing it exactly two arguments: <q-args>: This is all the arguments that were passed to the command, passed as a single argument. (...


4

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 directory completion and getcwd() as the default), run the cd, and then do the :Rg: execute 'cd' input(':cd ', getcwd(), 'dir') Rg


4

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, :h shada). If you do not know where this file is, see :h shada-file-name and this tells you The default name of the ShaDa file is "$XDG_DATA_HOME/nvim/shada/...


2

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<CR> command! -bang -nargs=* MyFind0 call MyFind(0, <q-args>, <bang>0) command! -bang -nargs=* MyFind1 call MyFind(1, <q-args>, <bang&...


2

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 mapping just change that mapping: map <c-space> :FZF ~<cr> (Unrelated to the question but related to the autocomand you mentioned: 'autochdir')


2

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, you need to change enviroment variable: export FZF_DEFAULT_OPTS='--bind=ctrl-w:up,ctrl-m:down' above setting will bind ctrl-w to up, ctrl-m to down. check man ...


2

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 --preview=head\ -10\ {} Making $LINES working is more tricky, for basic you could probably add export LINES to your .zshrc, but this won't handle situations, ...


2

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 f', \ 'sink': 'edit'}) and if you want, you can add a command like this command! FZFLib call fzf#run({'source': 'find ~/project/ ~/libs/include ...


2

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) is handled like a modified file. Add set hidden to your vimrc. This allows to abandon a modified buffer and a terminal with a running process. See :help ...


2

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:insert_file_name')} Then open :Files select a file and press <c-r>. See :h fzf-examples.


2

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 as normal.


1

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.


1

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 that: https://github.com/junegunn/fzf.vim/blob/0eb385065bf614abb6f38db85f0a09eddec728fc/autoload/fzf/vim.vim#L722 You can rewrite fzf#vim#grep function https://...


1

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 option. command! -bang -nargs=* Rg \ call fzf#vim#grep( \ 'rg --hidden --column --line-number --no-heading --color=always --smart-case -- '.shellescape(<q-...


1

: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: the value to adjust is '100 (default) check current value with :set viminfo (mine is: '100,<50,s10,h,rA:,rB:) change '100 to whatever you want, for example ...


1

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>.


1

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, you can add this line to your .bashrc or .zshrc to set the TwoDark theme: export BAT_THEME="TwoDark" To preview the available themes run in your shell: bat --...


1

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 the log file. The main problem was due to my viminfo file being 22k lines after the updates below it is only 2.5k. Updating my .vimrc options changed the load ...


1

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': ['--prompt', a:line.'> '], \ 'source': 'git ls-files $(git rev-parse --show-toplevel) | xargs -n 1 dirname | uniq', \ 'sink': {line -> feedkeys("\<...


1

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 grep and others) would be a function that says what to do with the selected string. I have the following code: :call fzf#run({'source': uniq(reverse(b:inserts)),...


1

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 BufRead,BufNewFile *.<ext>[,*.<ext>] set filetype=<filetype> (The example in the article uses video as a filetype, with a plethora of ...


1

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 you do imap <expr> xxxx fzf#vim#complete(), what returns from the expression is '', and the key \<Plug>(-fzf-complete-trigger) stored in a buffer and ...


1

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 following line so all searches being from my home directory: export FZF_DEFAULT_COMMAND="fd . $HOME" (note that on Debian Buster, the command would be "...


1

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 --no-heading --hidden --follow --glob "!.git/*"', 'sink': 'e', 'down': '~30%', 'options': '--bind ctrl-o:up,ctrl-l:down'})<cr> Of course only the options ...


1

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 trying using the :b command, and if the E94 error is thrown, doing a :FZF instead: function! BWithFallback(buffer_name) abort " Check if the input is a number ...


1

I have the following lines in my ~.tmux.conf, and they allow me to continue to use Ctrl-H, Ctrl-J, Ctrl-K, and Ctrl-L for navigation within Vim (between windows and also between CtrlP results), and yet also use them for navigating between tmux panes: # smart pane switching with awareness of vim splits and of emacs (but not emacs splits) bind-key -n C-h run "...


1

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! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --no-ignore --hidden --follow --glob "!.git/*" --color "...


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