Vim status line not changing / clearing - vim

No matter what I change status line to with set statusline my status line will not change. It looks like
".vimrc" 39L, 578C 1,1 All
with the cursor position and the percentage through the file as well as the filesize and filename. It is the only line at the bottom.
How to I hide or change the status line?
How do I clear the status line?
Why is the status line not working?

What you are looking at is a ruler - a "statusline" in a way, but not a statusline. What can be changed in it you can see in help rulerformat.
If you wish to hide the ruler set set noruler, and afterwards enable the statusline with set laststatus=2 if you wish for every window to have their own statusline (the most common). Depending on what you want in your statusline, you might wish to read help statusline, and afterwards put it in set statusline=... (when adding options add them with set statusline+=... one by one - that way you can more easily turn some on or off).
As the first line, when setting statusline, set set statusline= that way statusline is cleared before it is loaded again. You'll figure this out when you source it the first few times.

What you are looking at is the ruler. You can get rid of it with
:set noruler
However, if you want to customise it, you can use
:set rulerformat=
and follow the same format as the status line.

To hide the status bar use:
:set laststatus=0

Related

Disable status line in vim's Syntastic

I use syntastic plugin for vim on a computer with small screen, so want to cut out the unnecessary space. But, syntastic, when there's an error, displays e.g.:
[Syntax: line: 5 (1)]
a.cpp|5 col 59 warning|some error
[Location List] :SyntasticCheck gcc (cpp)
Vim status bar
Is is possible to remove the status line ([Syntax: line...) and the last line ([Location List...), which I don't necessarily need?
I tried disabling the loclist altogether (then I see the warnings/errors in the vim status bar), but I cannot scroll status bar, when it's too long -- but maybe it is possible?
Before turning on loclist:
After:
Here I have already removed the statusline formatting string from my ~\.vimrc. I would like the loclist to occupy one extra line, now it takes 3.
What you need is to hide the statusbar.
Take a look at this post, which implements a function to toggle that functionality.
Or, to disable it altogether:
set noshowmode
set noruler
set laststatus=
set noshowcmd
I think the it's not possible to entirely solve the problem that I asked for, as the loclist is considered another vim window and as such, the first extra line is a mandatory status line of the main window. One can disable the second extra line though by passing:
set laststatus=0
To disable the status bar (the top bars, not the bottom line with format '%d' ...)
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
As Weston Ganger said, laststatus=0 may not work in the vimrc file. In my case, the reason was in the vim-airline plugin. As stated in https://bbs.archlinux.org/viewtopic.php?id=241303, in airline.vim has a line set laststatus=2, which just needs to be corrected to set laststatus=0.

Why doesn't Vim execute my column setting in this command?

I have a Vim command to enter a "Distraction Free" mode:
command! DistractionFreeMode set guioptions-=r gfn=Cousine:h12 showtabline=0 fullscreen laststatus=0 noruler wrap linebreak nolist linespace=5 foldcolumn=3 nonumber columns=80
Note also that I am using MacVim. The command sort of works, but some of the settings don't seem to be triggered. These include columns=80 and nolist. I always have to set these separately after executing this command in order to get them right. I have also tried putting these settings in a function that I called with the command and had the same issue. What is the source of this problem?
EDIT: Here is a screenshot of the look I'm aiming at. Using fullscreen and columns together is necessary to achieve this, as far as I know:
According for the help for fullscreen (:h fullscreen) There are option to tailor the behavior of what happens when you enter fullscreen mode which are set with fuoptions
On my MacVim fuoptions is set to
fuoptions=maxvert,maxhotz
When we look at :h fuoptions
maxvert When entering fullscreen, 'lines' is set to the maximum number
of lines fitting on the screen in fullscreen mode. When
leaving fullscreen, if 'lines' is still equal to the maximized
number of lines, it is restored to the value it had before
entering fullscreen.
maxhorz When entering fullscreen, 'columns' is set to the maximum number
of columns fitting on the screen in fullscreen mode. When
leaving fullscreen, if 'columns' is still equal to the maximized
number of columns, it is restored to the value it had before
entering fullscreen.
This mean that when you enter fullscreen mode MacVim resizes to to the maximum number of lines and columns it can. (ignoring the values you set)
To fix this you can either add set fuoption-=maxhorz to remove the offending option or add set=maxvert to force it to only use maxvert regardless if other options are set. This stops MacVim from overriding your settings in the horizontal direction.
So your fixed command would look something like
command! DistractionFreeMode set guioptions-=r gfn=Cousine:h12 showtabline=0 fuoptions-=maxhorz fullscreen laststatus=0 noruler wrap linebreak nolist linespace=5 foldcolumn=3 nonumber columns=80

Vim: What is the status bar code for the view of command being entered?

I used to (in less customized vim) get a little field in the status bar that would show me what I was typing as a command, e.g. if I enter 99dd it would display 99d as i typed it in.
Since updating my statusline to something (it used to be unset) this has now disappeared. How can I get it back?
You're looking for
:set showcmd
Actually, it's not inside the statusline, but below, in the space occupied by the command-line (and ruler, if no statusline is visible).
Since this is on by default (except on Unix), you should investigate where it was turned off, and fix it there (or just set it in your .vimrc):
:verbose set showcmd?

How to change the characters used for empty space in Vim status line?

I’m using the following statusline setting in Vim:
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
It produces the following status line:
Had the same issue, and eventually realized that I was seeing it only when using certain colorschemes. A little more digging revealed that these colorschemes were setting StatusLine and StatusLineNC highlighting groups to identical values.
:help StatusLineNC notes that if StatusLine and StatusLineNC have equal values, then Vim will use ^^^ in the status line of the current window.
The fix was to comment out the lines that changed these values in the problematic colorschemes.
The fillchars option specifies the characters to fill status lines
and vertical separators. The stl: and stlnc: items in the option’s
value correspond to the status line of the current window and the
status lines of the other windows, respectively. See the current state
of the fillchars option (by :set fcs?), and try to set the filling
characters for statusline explicitly:
:set fillchars+=stl:\ ,stlnc:\ "
(Here the last quote symbol starts a comment and does not affect the
value set, it was added only to make preceding space noticeable.)
standard statusline is :set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P so I guess it's the fugitive-part that is causing this. What does it do? and in what format does it display data?
from :help 'statusline':
{ NF Evaluate expression between '%{' and '}' and substitute result.
Note that there is no '%' before the closing '}'.
You're statusline looks correct so have a look at the fugitive part...
UPDATE
Did a git clone http://github.com/tpope/vim-fugitive and tried the statusline above
which can be found in the documentation for fugitive and the statusline is correctly
displayed for me. Using xbuntu 11.04. So update to the latest and try again is my advice.
and use set ruler

Is there way to disable the status line for certain windows?

A buffer plugin I use creates a separate window with a list of buffers. This unnecessarily has its own status line which takes up space. Is there a way to disable the statusline for certain buffers/windows?
Unfortunately, it is not possible to switch status line visibility
selectively for certain windows. The only related feature is
controlled by the laststatus option that defines when to display
the status line of the last window.
You might be interested in the buftabs plugin that shows a list
of buffers in the status line saving vertical screen space for editing.
Try to emulate absence of statusline instead:
let &l:statusline='%{getline(line("w$")+1)}'
. It is also almost possible to put correct highlighting there, but implementation should be slow.
Actually you can write a small function and put it in autocommands, which will disable and enable laststatus option depending of current buffer name.
Something like that:
au BufEnter,BufWinEnter,WinEnter,CmdwinEnter *
\ call s:disable_statusline('buffer name')
fun! s:disable_statusline(bn)
if a:bn == bufname('%')
set laststatus=1
else
set laststatus=2
endif
endfunction
You could set it locally:
setlocal statusline=

Resources