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

Disable statusline in file tree #424

Closed
siduck opened this issue Jun 1, 2021 · 17 comments
Closed

Disable statusline in file tree #424

siduck opened this issue Jun 1, 2021 · 17 comments

Comments

@siduck
Copy link
Contributor

siduck commented Jun 1, 2021

Hi there! Is it possible to disable the statusline in nvimtree? since nvimree's width is small so the statusline wouldnt be properly visible at all and I dont think there's any need of statusline in the file tree.

looks bad :

image
I made the statusline of inactive windows (StatuslineNC) look like a plain line

image

It would be nice if the statusline would be completely remvoed from nvimtree's window!

@kyazdani42
Copy link
Member

i do this in my personal statusline, this should be part of the statusline api not nvim tree :)
although, you could maybe:

function! DisableST()
  return " "
endfunction
au BufEnter NvimTree setlocal statusline=%!DisableST()

works for me if i have no statusline enabled. This will not be implemented in nvim tree because it relies on the statusline, not nvim tree, maybe open a PR there, it's quite easy to do.

@siduck
Copy link
Contributor Author

siduck commented Jun 1, 2021

@kyazdani42 sorry to bother , Im new to lua and could you write a lua function for it

@kyazdani42
Copy link
Member

this is not doable on nvim-tree side, you have to refer to the plugin developer for your statusline (i cannot handle every edge case for this feature, most people might not even want this).
The vim snippet might work though, did you test it out ?

@siduck
Copy link
Contributor Author

siduck commented Jun 1, 2021

I use a lua config so that vimscript code didnt work :(

vim.api.nvim_exec(
    [[
function! DisableST()
  return " "
endfunction
au BufEnter NvimTree setlocal statusline=%!DisableST()
]],
    false
)  

@siduck
Copy link
Contributor Author

siduck commented Jun 1, 2021

@kyazdani42 statusline can be disabled in nerdtree

preservim/nerdtree#280

@kyazdani42
Copy link
Member

this is not particularly something that i consider i should do in nvim tree because it's a window option that i don't manage by default so the users can basically bind an autocmd to set it themselves. I don't want to start providing setup like this or else i'd have to provide every window/buffer option one after the other.
look at my config to understand how i do this :)

@kyazdani42
Copy link
Member

i think you might need to vim.schedule the lua function in order to apply the modification after the plugin you use sets the statusline value

@siduck
Copy link
Contributor Author

siduck commented Jun 8, 2021

@kyazdani42 Is it possible to add a specific highlight for NvimTree's statuslineNc? something like NvimTreeVertsplit , which let me hide vertsplit near nvimtree.
image
Maybe something similar could be done with statuslineNc

@kyazdani42
Copy link
Member

you should be able to set NvimTreeStatusLineNC

@siduck
Copy link
Contributor Author

siduck commented Jun 11, 2021

thanks! it looks much better now :D

image

@JonathanLorimer
Copy link

How do we set NvimTreeStatusLineNC? I am having trouble figuring it out!

@siduck
Copy link
Contributor Author

siduck commented Oct 17, 2021

How do we set NvimTreeStatusLineNC? I am having trouble figuring it out!

hi NvimTreeStatusLineNC guibg=nvim_treebg guifg=nvim_treebg

@lius-new
Copy link

lius-new commented Apr 17, 2022

If you use nvim-lualine, it provides disabled_filetypes, which you can set to NvimTree. nvim-lualine.disable_filetypes.

@riverajohan
Copy link

If you use nvim-lualine, it provides disabled_filetypes, which you can set to NvimTree. nvim-lualine.disable_filetypes.

For reference:
disabled_filetypes = { 'packer', 'NvimTree' }

@dave-kennedy
Copy link

dave-kennedy commented Feb 12, 2023

This basically works in case you don't use nvim-lualine:

require('nvim-tree.api').events.subscribe(api.events.Event.TreeOpen, function ()
    vim.wo.statusline = ' '
end)

It doesn't work if you open the tree on VimEnter. See #1993.

@alex-courtis
Copy link
Member

It doesn't work if you open the tree on VimEnter. See #1993.

Thank you

@ahbali
Copy link

ahbali commented Oct 10, 2024

This basically works in case you don't use nvim-lualine:

require('nvim-tree.api').events.subscribe(api.events.Event.TreeOpen, function ()
    vim.wo.statusline = ' '
end)

It doesn't work if you open the tree on VimEnter. See #1993.

i had to change api.events.Event.TreeOpen to "TreeOpen" to make it work

require('nvim-tree.api').events.subscribe("TreeOpen", function ()
     vim.wo.statusline = ' '
end)

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

No branches or pull requests

8 participants