Nvim-tree.lua: Only auto-open on directory

Created on 16 Mar 2021  路  5Comments  路  Source: kyazdani42/nvim-tree.lua

I would like the tree to auto open when I do vim $DIR but not when I do vim, is that currently possible?

enhancement

Most helpful comment

Sounds good! But in the meantime, this auto command works fine:)

All 5 comments

Hi, it is not yet possible, although if you use something like 'startify', you could set let g:nvim_tree_auto_ignore_ft = { 'startify' }

@AckslD This can be set up with an autocommand:

augroup NvimTreeConfig
  au!
  au BufEnter * if isdirectory(expand('%')) | exec("cd " . expand('%')) | exec('NvimTreeOpen') | endif
augroup END

lua << EOF
  require'nvim-tree.events'.on_nvim_tree_ready(function ()
    vim.cmd("NvimTreeRefresh")
  end)
EOF

i like your hacks @sindrets :) but i think it should be a feature anyway, the auto_open could be easily extended i just didn't spend the time to do that.

Sounds good! But in the meantime, this auto command works fine:)

Thanks for sharing @sindrets :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

seblj picture seblj  路  6Comments

kristijanhusak picture kristijanhusak  路  5Comments

kutsan picture kutsan  路  5Comments

DimitrisMilonopoulos picture DimitrisMilonopoulos  路  5Comments

CantoroMC picture CantoroMC  路  7Comments