Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open file browser on VimEnter,BufEnter #82

Closed
ranebrown opened this issue Jan 23, 2022 · 4 comments
Closed

Open file browser on VimEnter,BufEnter #82

ranebrown opened this issue Jan 23, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@ranebrown
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I would like the file browser to open if the path is a directory e.g. nvim ~/ or :e ~/.

Describe the solution you'd like
VimEnter,BufEnter autocommands to open the file browser.

Describe alternatives you've considered
I could write these myself but figured it was worth checking if their was interest in including them in the main repo. This is a quick example but has some issues such as leaving an empty buffer of the directory.
autocmd! VimEnter * if isdirectory(expand('%:p')) | exe 'Telescope file_browser' | endif

Additional context
N/a

@ranebrown ranebrown added the enhancement New feature or request label Jan 23, 2022
@fdschmidt93
Copy link
Member

You are very happy to add it to the wiki :)

Once the following items are in better shape, I'll try to brush up the wiki with relevant examples for

That said, I'm not perfectly sure -- are you also asking for some help here? It's a bit fuzzy between the lines. If yes, could you please once more clarify? Happy to try and help then.

@ranebrown
Copy link
Contributor Author

I would appreciate it if you could provide some help. I'm not sure of the best way to setup a BufEnter autcmd that would work correctly.

@cobcobs
Copy link

cobcobs commented Mar 14, 2022

@ranebrown I'm not sure if you've solved your issue, but for other people I've just made a slight edit to the above autocmd:

autocmd! VimEnter * if isdirectory(expand('%:p')) | exe 'cd %:p:h' | exe 'bd!'| exe 'Telescope file_browser' | endif

this avoids the issue of leaving empty buffers. Hope this helps!

@ranebrown
Copy link
Contributor Author

#111 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants