Skip to content

How can I run mini.starter when opening a directory? #746

Closed Answered by echasnovski
andradei asked this question in Q&A
Discussion options

You must be logged in to vote

Unfortunately, this is not as easy as it might seem. I learnt it the hard way in 'mini.files'.

Basically, there are two steps to achieve this:

  • Disable 'netrw' from taking over when directory is edited.
  • Create an autocommand for BufEnter event to decide whether a buffer is for directory and if it is, open Starter buffer.

The most robust way to do this comes from 'mini.files' (this part and this part. And for the case of 'mini.starter' it can be done with something like this:

-- Stop 'netrw' from taking over when directory path is edited
vim.cmd('silent! autocmd! FileExplorer *')
vim.cmd('autocmd VimEnter * ++once silent! autocmd! FileExplorer *')

-- Open Starter buffer when directory pa…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@andradei
Comment options

Answer selected by echasnovski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants