I set the following on my ~/.vimrc which sets the current directory to the location of the file on the buffer.

au BufEnter * silent! :lcd%:p:h

However, when I run the fzf command to search for a file, then the search starts on the current directory, althogh the file I like to get is often in other directories. So I want to set it to ~/ whenever I run fzf.

But I'm not sure if it is possible. Is it possible to set it in 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 mapping just change that mapping:

map <c-space> :FZF ~<cr>

(Unrelated to the question but related to the autocomand you mentioned: 'autochdir')

| improve this answer | |

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.