6

When you use the += operator, you actually ask vim to append some new values to the statusline variable. When you first open Vim statusline is set to an emtpy value so adding %.35f to it give you the expected behavior. However when you source your config again, nothing empties the variable so you keep adding duplicate values to it. Thus you probably want to ...


6

vim 8.1.1270 (May 2019) :set shortmess-=S Since May 2019 vim offers the possibility to show the count in the statusline (as long as it less than 99) which however is disabled by default. Add to your vimrc set shortmess-=S or activate it on demand with :se shm-=S Following additional information can be found under :h search-commands When 'shortmess' ...


5

You're probably overlooking the additional attributes set in the cterm= field for those highlights. For instance, after I set ctermfg=black ctermbg=white for StatusLine, I get this when I query it: :hi StatusLine StatusLine xxx term=bold,reverse cterm=bold,reverse ctermfg=0 ctermbg=15 gui=bold,reverse You'll see the cterm=bold,...


4

I finally found a way to get rid of the command, mode as well as file name in the command line bar! at the bottom of your .vimrc: set noshowmode " to get rid of thing like --INSERT-- set noshowcmd " to get rid of display of last command set shortmess+=F " to get rid of the file name displayed in the command line bar notice that this piece of code ...


3

To add a pipe, escape it with double \\|: func! VimMode() abort let md = mode() if md == 'n' return 'NORMAL' elseif md == 'v' return 'VISUAL' else " check mode() help to define other mode names here return 'OTHER' endif endfunc set statusline=%{VimMode()}\ \\| set statusline+=\ %f set statusline+=%< ...


3

It's a hack, but you could try this: augroup filetype_nerdtree au! au FileType nerdtree call s:disable_lightline_on_nerdtree() au WinEnter,BufWinEnter,TabEnter * call s:disable_lightline_on_nerdtree() augroup END fu s:disable_lightline_on_nerdtree() abort let nerdtree_winnr = index(map(range(1, winnr('$')), {_,v -> getbufvar(winbufnr(v), ...


3

Of course, your attempt won't work, because Lightline forcefully updates status line content on many auto events. That's quite obvious from its code and was clearly stated by the author in the issues you've quoted. The only solution is to exclude some specific buffers from such update, but, again, as the author said he is not going to do so for several ...


2

The easiest way would be to call git inside %{} like so: let &statusline = '%{substitute(system("git status -s"), "\n", " ", "g")}' Anything inside %{} get evaluated as an expression, and here we call git status -s with system() and replace newlines with a space, resulting in a statusline like: ## repl M db.go ?? ...


2

To change the divider for the none current window you can do this with (look up :help fillchars): set fillchars=stlnc:- To change some content depending on whether it is the current or none current window: function SomeText(nr) let activebuffer = (a:nr == win_getid()) ? "Active Window" : "None Current Window" let buf_type = &buftype return ...


2

Since %! statusline functions are re-evaluated (at what frequency, I do not know), you can do this instead: let savestatus = &modified ? '%#StatusUnsaved#[+++]%*' : &modifiable ? '[---] ' : '[ R ]' According to :help statusline: When the option starts with "%!" then it is used as an expression, evaluated and the result is used as the ...


2

One simple fix is to get your autocmd to clear the "file written" message before echoing: autocmd BufEnter * redraw | echo @% =~ '^\/.*$' ? @% : './' . @% You get subtly different behaviour (the redraw is a bit faster) if you add !: autocmd BufEnter * redraw! | echo @% =~ '^\/.*$' ? @% : './' . @% The obvious downside to this approach is that you don't ...


2

I should add that I have written some code, which looks like this: function! Statusline_SpellingErrorCount() if &spell if !exists('b:spelling_warning') let l:view = winsaveview() let l:mycount = 0 call cursor(1, 1) let l:lastline = 0 while 1 let l:lastline = line('....


1

The mode() function returns an actual Ctrl+V character when you're in Visual Block mode. It might look like ^V in a Vim buffer, but it's actually a single character (rather than separate ^ and V), which you can typically tell by moving the cursor through it using l or a right arrow (cursor will only stop on the ^ and skip the V to the next character in line) ...


1

With the help of D. Ben Knoble hi StatusLine guifg=#000000 guibg=#00CC00 gui=none " WARNING! By default gui set to reverse, need to overide it with none hi StatusLineNC guifg=#192224 guibg=#ABABAB gui=none " Status line None current hi _StatusFileName guifg=#FFFFFF guibg=#007700 gui=bold hi _StatusFileNameNC guifg=#FFFFFF guibg=#...


1

it is possible, at least I do pass variables: set statusline=%{misc#unicode_number(winnr())} I am not sure what is set local statusline though. Did you mean setlocal? Btw, a: variables implies you set statusline from the function? Bear in mind that statusline is evaluated quite often and it calls functions being bound to it without knowing local ...


1

The help page for mode() only mentions normal mode That's not true. The help page (:h mode()) is quite complete. You have to supply an optional argument for the mode() function. let s:mode = mode(1) if s:mode[0] ==# 'n' if s:mode[1] ==# 'i' " normal using i_CTRL-O elseif s:mode[1] ==# 'o' " normal Operator-pending else " ...


1

That's not really possible. The last line is used not only to display messages and information, but also to enter Ex commands (the commands starting with a colon, such as :w, :q, :e filename, etc.), also where you can type a search pattern if you start a search using / or ?. Furthermore, that line is also used to display messages, such as error messages ...


1

You could check the value of endofline and display your statusline accordingly. For example, this shows [noeol] in your statusline when endofline is false: set statusline+=%{&endofline?'':'[noeol]'}


1

This can be done much more simply with the expand() command: function! SetStatusLinePath() return expand("%:h") . "/" endfunction function! SetStatusLineFile() return expand("%:t") endfunction set statusline+=%#pwd#%{SetStatusLinePath()} set statusline+=%#file#%{SetStatusLineFile()} see :h expand()


1

Apart from the native support as indicated by @Hotschke, you may want to try vim-indexed-search. This plugin also summarizes several similar plugins in its GitHub homepage.


1

It doesn't answer your question about the length of the status line, but Vim should manage this for you: are you aware that 'statusline' has a potential < item you can include? It indicates where to truncate the status line if it's too long. See :help statusline for more information.


Only top voted, non community-wiki answers of a minimum length are eligible