dylanaraps / fff.vim

A plugin for vim/neovim which allows you to use fff as a file opener.
MIT License
104 stars 11 forks source link

Custom behaviour: launch when vim is invoked w/o arguments or with a folder #4

Open mgiugliano opened 5 years ago

mgiugliano commented 5 years ago

I was successful configuring my .vimrc to launch fff if vim is invoked without arguments (copying a similar setting offered for NERD Tree):

autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | exe 'F' | endif

However it does not work nicely if invoked with a folder (once more, copied from NERD tree), as it follows:

autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'F' argv()[0] | wincmd p | ene | endif

Any suggestion on how to make the last working smoothly?

MoonPadUSer commented 3 years ago

I just played around with it a lil' bit and I figured out if you remove the last | wincmd p | ene it still opens the normal filebrowser in the background but everything else works smoothly

autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'F' argv()[0] | endif

Now the only thing to figure out would be if one can disable the default file manager in vim