nvimdev / galaxyline.nvim

neovim statusline plugin written in lua

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

disable statusline in NvimTree

siduck opened this issue · comments

Hi there! Is it possible to disable the statusline in nvimtree? I dont think its needed and it looks bad too

image

I tried this but didnt work either :

vim.api.nvim_exec(
    [[

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

]],
    false
)  

I found some config but Idk how to implement it in galaxyline , doesnt work :c

Have you tried adding this to your config
require("galaxyline").short_line_list = { "NvimTree" }

I tried that , didnt work :(

image

My basic config

Hmm.. I don't think that can be avoided. The best that can be done is to have short_line's background match the background of the colourscheme.

@SmiteshP I did that and yes it works

image

but this makes my StatuslineNc ugly too :(

image

I made the statuslineNc look like a thin line before

image

highlight! StatusLineNC gui=underline guifg=#383c44"

@siduck76 Try using this, seems to work for me

au BufEnter,BufWinEnter,WinEnter,CmdwinEnter *
                       \ call s:disable_statusline('NvimTree')
fun! s:disable_statusline(bn)
   if a:bn == bufname('%')
       set laststatus=0
   else
       set laststatus=2
   endif
endfunction

Stackoverflow

@SmiteshP sorry to bother! Im still new to lua and I have a lua nvim config , could you write a lua config for it ( disabling statusline in nvimtree )

I would just stick it inside vim.cmd like so

vim.cmd [[
au BufEnter,BufWinEnter,WinEnter,CmdwinEnter *
                       \ call s:disable_statusline('NvimTree')
fun! s:disable_statusline(bn)
   if a:bn == bufname('%')
       set laststatus=0
   else
       set laststatus=2
   endif
endfunction
]]

Or alternatively you could put this as a statusline_fix.vim under ~/.config/nvim/plugin/ and it would get sourced automatically

There is probably a more elegant way of doing it through lua but I am new to lua as well :)

I tried that and it didnt work ( I removed nvimtree from shortline ) , can you show me how does your statusline in nvimtree look?

Here is how it looks for me.

hide_statusline.mp4

could you open more windows and check how does StatuslineNC ( statusline in inactive window ) look? and can we hide StatuslineNC for nvimtree too?

It works as I would expect it to

hide_statusline2.mp4

yeah it works for me only if I focus on NvimTree window but if I dont then the statuslineNc shows . How do I disable statuslineNc for nvimtree?

image

image

Yeah! I see what your saying. But I don't know how to fix it ¯_(ツ)_/¯

@SmiteshP is it possible to disable the statusline on terminal windows?

Found a answer on StackExchange
The toggle function can easily be set to run on terminal open and close events using autocmd

let s:hidden_all = 0
function! ToggleHiddenAll()
    if s:hidden_all  == 0
        let s:hidden_all = 1
        set noshowmode
        set noruler
        set laststatus=0
        set noshowcmd
    else
        let s:hidden_all = 0
        set showmode
        set ruler
        set laststatus=2
        set showcmd
    endif
endfunction

autocmd TermOpen * silent! call ToggleHiddenAll()<CR>
autocmd TermLeave * silent! call ToggleHiddenAll()<CR>

Of course you might want to tweak the options changes inside the toggle function according to your needs.

damnn this seems long af , I have tried this

au BufEnter term://* set laststatus=0

But it works on some term buffers (like only on the bottom)

simplescreenrecorder-2021-06-18_08.32.08.mp4

Finally I was able to disable statusline in NvimTree

vim.api.nvim_exec(
[[
au BufEnter,BufWinEnter,WinEnter,CmdwinEnter * if bufname('%') == "NvimTree" | set laststatus=0 | else | set laststatus=2 | endif
]],
false
)

add guibg to this too

NvimTreeStatuslineNc