23

Sometimes I work with really small terminal windows and need every piece of space available. So I want to hide the vim status line.

I already set laststatus=0 this hides one of the status lines. But there is still another one with the content -- INSERT -- and "filename.ext" 22L 500C.

How can I hide this line?

2

3 Answers 3

24

Add these lines to your .vimrc:

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

nnoremap <S-h> :call ToggleHiddenAll()<CR>

Then in normal mode, type Shift + H to hide all, type again to make them visible.

You can change <S-h> to any key you want.

4
  • Thank you, this is already a good step. But the status line still exists. It says "filename.ext" 22L 500C when I start vim.
    – ph3nx
    Commented Jul 5, 2014 at 11:14
  • @ph3nx: What happen when you type Shift + H
    – cuonglm
    Commented Jul 5, 2014 at 11:23
  • 3
    Then messages like -- INSERT -- are not shown anymore, but the line still exists and says "filename.ext" 22L 500C.
    – ph3nx
    Commented Jul 5, 2014 at 11:25
  • In order to get rid of the fileinfo in the command line, you can put: set shortmess=F in your vimrc. I recommend reading :help shortmess
    – m4110c
    Commented Sep 20, 2018 at 0:09
1

If anyone else comes here looking for how to disable the status bar (top one of the 2 bars)

Supposedly set laststatus=0 should work. However I noticed this was not working in my vimrc but would work if set manually for each vim session.

To resolve this issue, I added an autocmd within my .vimrc to override any existing laststatus setting:

# ~/.vimrc

" Hide Status Line
set laststatus=0 " For some reason this doesnt work
autocmd BufRead,BufNewFile * set laststatus=0 " This will work instead
0

The noshowmode setting hides the messages such as --Insert--, --Replace--, --Visual--, etc. from your last line in insert, replace and visual mode.

set noshowmode

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .