1

I want to disable the terminal statusline in gVim as it seems quite useless and I usually have the windows at a relatively small size when using gVim, so it takes up too much space.

I've tried quite a few things, like this:

" Disable statusline in gvim terminal window
if has('gui_running')
  augroup TerminalStatusline
    autocmd!
    autocmd TermOpen * setlocal laststatus=0
    autocmd TermClose * setlocal laststatus=2
  augroup END
endif

This results in an error on startup:

E216: No such group or event TermOpen * setlocal laststatus=0

Even if it didn't error, I don't think it would have done what I wanted anyway, as the statusline on other windows would also be disabled until I closed the terminal window.

2 Answers 2

1

You can't disable individual status lines, the :terminal's included.

Furthermore…

  1. The events TermOpen and TermClose don't exist. Instead of trying random events, find the right ones under :help autocommand-events:

              Terminal
     |TerminalOpen|      after a terminal buffer was created
     |TerminalWinOpen|   after a terminal buffer was created in a new window
    

    And yes, there is no corresponding "*Close" event, which means that your strategy needs a bit of rethinking.

  2. Setting :help 'laststatus' locally is pointless anyway, because it is a global option. You either have a status line on the last window or you don't, and the terminal's status line is not special.

1
  • Oh, I see. I have another autocmd that uses TermOpen to disable a plugin in the terminal as it caused problems (BetterWhiteSpace), but that's for NeoVim. It does exist in NeoVim. I think I managed to get it working with this information.
    – paradroid
    Dec 5, 2023 at 0:09
0

This disables the distracting and unpleasant terminal statusline when the terminal window is active.

It reappears when it's not active, but that doesn't matter as it's not getting in the way (it appears in lightened text as the window is not active).

It also only works with the first terminal if you have both vertically and horizontally split terminals, which is an unlikely thing for me to do in gvim.

" These options need to be set, which I think make more sense anyway
set splitright
set splitbelow

" Disable statusline in gvim terminal window (when active)
if has('gui_running')
  augroup TerminalStatusline
    autocmd!
    autocmd TerminalOpen * set laststatus=0
    autocmd BufEnter     * if &buftype != 'terminal' | set laststatus=2 | endif
    autocmd BufEnter     * if &buftype == 'terminal' | set laststatus=0 | endif
  augroup END
endif
10
  • 1
    Well no. 1. That autocommand doesn't do what you asked at all. 2. The check for buftype is pointless. 3. The comment doesn't describe what is happening accurately. 4. The status line for the last window is lost once you have closed the terminal window.
    – romainl
    Dec 5, 2023 at 5:43
  • @romainl I have come up with a satisfactory solution. Thanks for the help.
    – paradroid
    Dec 5, 2023 at 7:33
  • How does :set laststatus=0 disable the statusline? That cannot work if you have multiple windows open. Dec 5, 2023 at 7:39
  • @ChristianBrabandt Well, it does. It only disables the terminal statusline when the terminal windows is active and nothing else.
    – paradroid
    Dec 5, 2023 at 7:44
  • yes, if you only have a single window open, it will disable the statusline, yes that is correct. But that is quite a limiting factor, it does not work in the general case when you have multiple windows open Dec 5, 2023 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.