Questions tagged [statusline]

A status line will be used to separate windows. Questions about how to format and change the content of this status line.

Filter by
Sorted by
Tagged with
3
votes
1answer
43 views

Sourcing vimrc duplicates statusline in nvim

I'm new to vim so I'm not sure if this is intended behavior or not, but it seems like a bug. Desired Behavior After sourcing vimrc from within nvim, don't duplicate the contents of my statusline. Or ...
1
vote
1answer
20 views

detecting insert-normal mode

I notice that when in insert, pressing <C-o> will take me to normal mode, but once I finish pressing a sequence of keys, I get taken back to insert mode. I find this very useful, but I want a ...
0
votes
1answer
36 views

How to move airline status bar to the bottom of the editor?

There is VIM's default bar below my Airline's status bar, which causes file information to be viewed twice (as shown in the image). How can I move my airline's bar to the bottom? I have tried adding ...
1
vote
0answers
47 views

Is there a keybinding that allows to scroll through the status line?

I was wondering if it was possible to scroll (left or right) along the status line so that the content (which could not be displayed due to the size of the window) could be seen. Perhaps there is a ...
2
votes
2answers
158 views

Review: git branch in statusline

Note: this is an educational exercise. For those wanting a ready-made solution, use vim-gitbranch. I am learning vimscript, and the code below is part of my .vimrc used to display the current git ...
1
vote
1answer
100 views

How can I add a count of all columns on every line to the statusline in Vim?

I'm using vim-airline and would like to add a count of all characters on the current line to it. It should be displayed like 1:75 where 1 is the column the cursor is currently on and 75 the total ...
2
votes
1answer
35 views

How to have getcwd() give path with ~ in place of home folder?

I have the following (simplified) statusline config in my vimrc: set laststatus=2 set statusline= set statusline+=%{getcwd()} When I'm somewhere in my home directory on macOS, my statusline looks ...
1
vote
1answer
45 views

How to efficiently use the paste registers?

I often don't remember what was copied lately. So I don't know if I need to do <C-r>0 or <C-R>1 in insert mode. I tend to rely only on the * register, or type :reg, look at everything ...
0
votes
1answer
57 views

Custom string colors in statusline

This is my statusline setting: :set laststatus=2 :set statusline=%{GetMode()}\ %n\ %#StatusLineY#%m%*\%#StatusLineR#%r%*\ %t\ [%o\ %l\,%c\ %p%%\] and this is the GetMode() functiom function! ...
2
votes
1answer
193 views

Change/Set color to a string in statusline

I'll preface by saying that I am using Airline, plytophogy/vim-virtualenv plugin and gruvbox as the Airline theme. I am trying to change the color of some string in the status line to, say, orange. ...
2
votes
2answers
222 views

Vim Statusline colors not appearing

I want my vim statusline to have some color and I can't figure out why it does not with this code: set laststatus=2 set statusline+=%1*\ %f\ %* set statusline+=%2*\ %<%F%* set statusline+=%2*%m%* ...
0
votes
0answers
855 views

How to display all buffer names in tabline?

How do I display the list of all buffers in the tabline? I am using the lightline plugin, with the following settings in my .vimrc: set showtabline=2 let g:lightline = { 'colorscheme': 'PaperColor' } ...
2
votes
1answer
182 views

How to get the current mode in vim?

I'm writting scripts for vim, and I want to let the script do different things in different mode. I know that the statusline will show the current mode, but I don't know how to get the exact current ...
1
vote
1answer
27 views

How to use plugin provided value in statusline?

Some vim plugins provides functions especially designed to be used for statusline rendering. For example, in my .vimrc I create the status line format string like this: ... set statusline+=%{...
0
votes
1answer
56 views

Add whitespace conditionally, based on flags

I'm trying to add whitespace on the left side of the flags section, and to hide this whitespace when flags aren't exist. Here is what I mean: Statusline with no flags: :File.txt ...
1
vote
1answer
79 views

Replace text in status line flags

How could I replace text in status line flags? set laststatus=2 set statusline= set statusline+=%r%m Is there a way to replace [RO] to Read only, and [+] to Modified?
1
vote
0answers
54 views

How to write to a temproary buffer in a plugin

I've started to write my first vim plugin, a simple timer. I want to be able to set a timer for an arbitrary amount of time, and have it notify me once that time has passed. I've got it all working, ...
0
votes
2answers
132 views

Statusline percentage is erratic

The rightmost entry of the status line changes erratically. Reproduce: vim --clean :set number o<Esc>98. Press and hold k The rightmost entry of the status line first says Bot and only ...
2
votes
2answers
77 views

How to show [noeol] flag in custom statusline?

If I create a file without an EOL, for example: $ echo -n "1" > test ...and then open it in vim: $ vim --clean test ...the left hand side of the statusline looks like: "test" [noeol] 1L, 1C ...
0
votes
1answer
52 views

How to use a regexp to search/match specific pattern only for the custom statusline and/or tabline?

I got this regexp from google which is for matching specific glyphs in vim-nerdtree. autocmd FileType nerdtree syntax match {hl-group} /\v{glyph}/ containedin=ALL But obviously it won't work on ...
3
votes
1answer
170 views

How to update the statusline continuously even if the window becomes inactive

I have a vim script function MyFunction that returns a string value. I want to display this output in the statusline and so I have set the statusline as follows statusline +=\ %{MyFunction()}. I want ...
1
vote
0answers
105 views

How to access “additional sections” in vim-airline?

The vim-airline documentation addresses statusline sections as "airline_section_[a-z]" and mentions "additional sections" ([...]). I have searched in vain to figure out what letter/number could be ...
1
vote
0answers
39 views

Airline section_x for particular filetype

For .js files, I set a particular filetype in order to enable snippets, like this: augroup project autocmd! autocmd BufRead,BufNewFile *.js set filetype=javascript.javascript-es6-react.jsx ...
3
votes
2answers
714 views

How to remove ^@ character returned by `system()`?

When I call this function inside vim statusline it returns this nvim^@.weird character, What is the meaning of ^@ in returned value and how to get rid of it? function! GetEditor() let s:name = ...
0
votes
1answer
122 views

Statusline – update variables on file change

I'm currently learning Vimscript, but I'm stuck at a particular problem. I'm creating a statusline which shows the full path (~) of the file currently displayed in the buffer. Instead of just using %...
1
vote
0answers
76 views

Set different values for non-current and current statuslines

When vim is split into different panes horizontally, each pane has its own statusline. It's easy to highlight the statuslines differently based on current and non-current panes. BUT, I cannot figure ...
0
votes
1answer
166 views

Ctrl-G doesn't show column in Nvim

I have both vim and nvim using the same configuration file (basically nvim's config is a symlink to vim's one) but vim shows current column when I press Ctrl-G, while nvim doesn't. Is there some ...
2
votes
1answer
412 views

Cannot change the color of status line

I tried: hi StatusLine ctermfg=red highlight statisline ctermfg=red hi! statusline ctermfg=008 hi statusline ctermfg=008 hi statusline cterm=bold hi StatusLineNC ctermfg=2 ctermbg=8 cterm=NONE hi ...
1
vote
1answer
350 views

How to differentiate quickfix window buffers and location list buffers?

Recently I've been playing with my statusline and I'm coming to a point where I want to set a different highlighting group for the statusline of my quickfix window, location list window, and the other ...
3
votes
1answer
57 views

Why do I need two escaped spaces to insert one space in statusline

I have this lines for my statusline set statusline=%{&paste?'\ \ paste\ ':''} set statusline+=\ %{expand('%:~:.')!=#''?expand('%:~:.'):'[No\ Name]'} set statusline+=%{&readonly?'\ \ [RO]':!...
5
votes
3answers
286 views

How to display in the statusline the number of matches from a search?

I've seen this question: Is there a way to count the number of occurrences of a word in a file? but most of the time I search using * or just /. It is possible to display automatically in the ...
2
votes
1answer
464 views

Carets in status line

When splitting the editor window, the caret symbols appear in the status line of the current window. This happens when StatusLine and StatusLineNC have the same highlighting. For example, when cterm=...
-1
votes
1answer
170 views

Showing read-only or non-modifiable status in status line

I am building my statusline. Previously I used functions to return information, but recently I learnt that these can be done in one line. For example: set statusline+=%{&modified?'\ \ [+]':''} ...
0
votes
1answer
256 views

remove vim statusline for horizontal splits with laststatus already set to 0

I was wondering if the statusline between horizontal splits can be removed. Maybe it can be replaced by command line?
1
vote
1answer
465 views

Show filename tail and parent directory in statusline

If I'm at file /a/b/c/foo.txt, I'd like the statusline to display c/foo.txt. Is this possible? The reason for this is that for web development, too many files are named index.js to make just the tail ...
0
votes
1answer
100 views

My status line is getting erased, so I can't print function result

I have a function that counts the number of matches in a file using the substitute Ex command with the /n flag and returns the value. However, I cannot echo the answer because the status line is ...
1
vote
0answers
33 views

How to trigger :redrawstatus to a different window?

Is there a way to invoke :redrawstatus from a window that is different than the window whose statusline is to be updated ? Not a global :redrawstatus to all windows, but to one specific window.
1
vote
2answers
635 views

How to display file size in vim rulerformat?

I want to display file size in the rulerformat in vim. Please answer for all file size formats like bits, bytes, kibibytes, mebibytes, gibibytes
0
votes
1answer
440 views

vim: count how many buffers been modified?

Pursuing a vimscript function or expression that count how many buffers been modified. i.e., how many buffers :bm could switch to, given that option hidden is set. == Edit == In the hope of used ...
2
votes
1answer
2k views

Problem of neovim with powerline-status

I have neovim 0.2.0 and powerline-status (2.6) on Fedora 26. But it fails as follows: Se ha detectado un error al procesar function provider#python3#Call: línea 18 Traceback (most recent call last):...
1
vote
2answers
385 views

Setting custom statusline for help window

I've been trying to set a custom statusline for help files. I tried: set statusline=%!StatusLine() function! StatusLine() if &ft == 'help' let b:status = "%#error#[HELP]%*" else ...
1
vote
1answer
245 views

Checking if Makefile exists before executing autocmd

I want Vim to execute build the project automatically after I write the buffer to a *.c or *.cpp file. Here is what I've done: autocmd BufWritePost *.c,*.cpp make This one works as expected (but the ...
0
votes
1answer
131 views

Change messages display duration

Is there a way to make Vim's messages stay longer on the screen? Messages and error messages are currently shown for a very short time; for about half-second, if not mistaken.
1
vote
2answers
485 views

Display enclosing namespace, class, and function

How can I convince Vim or Neovim to show the enclosing namespace, class, and function that the cursor is in? Some programming languages have no interesting namespaces or class names. In general, this ...
1
vote
1answer
608 views

turn off “— INSERT --” color

vim 7.4 console mode. When in insert mode, I would like to turn off the ugly yellow when I am in insert mode. My background is set to light, so vim should not use a light yellow for anything.
0
votes
2answers
196 views

Can I use different User1… User9 colors for active and inactive panes?

I know User1... User9 colors the status line. I have applied several colors to the statusline to make it easy to recognize, but I wish this is only applied to active panes, not inactive panes. So that ...
3
votes
1answer
728 views

How to get git branch information supplied by vim-fugitive asynchronously for my statusline?

I can directly use the following approach to get the git branch information: ... let l:git = "%6*%{exists('g:loaded_fugitive')?fugitive#statusline():''}%*" ... If so, it can cause a delay to the ...
1
vote
1answer
112 views

I want to indicate in the status line whether or not `spell` is set

I am using vim-tinyline and it doesn't seem to have an option for this and I have no idea how to write a function to do this. Example function from tinyline that checks whether the file has been ...
3
votes
1answer
1k views

My statusline is missing. How do I get it back?

I'm using Vim 8, and my status line is missing. I type in: set statusline=%f ...and hit Enter, and nothing seems to happen. Once I do some moving or editing, what I just typed in disappears, and ...
0
votes
1answer
232 views

Ask a list of all percent-prefixed variables

In reading other's .vimrc, I find many percent signs. For instance in the portion concerning the status line, I know %F%m%r%h must stands for something like the current filename being edited. But ...