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
37 views

Is it possible to get vim-airline to make the statusline 2 or more lines high?

My statusline has too much information to fit on one line. It was already marginal, but now that I've rotated my monitor into portrait mode, it's a huge issue. I really like all the information ...
2
votes
1answer
285 views

How to get Vim to show git status in the statusline?

I want to show the git status in the vim statusline, but I can't find any advice on how to do that. The output of git status -s would be fine, or alternatively a single field readout indicating ...
2
votes
1answer
36 views

Use pipe symbol as separator in statusline

I wanted to make my own status line and I wonder how can I use a pipe as a separator? I want to achieve something like this: NORMAL | file.html [html] | utf-8 | 80:10
1
vote
0answers
48 views

Local “statusline” override problem

I'm currently writing a plugin, and got stuck with this problem. My plugin opens a new window with all local options I want, but also sets the statusline option to display some useful information. Vim ...
1
vote
0answers
31 views

rulerformat truncated when filename included

Given the limited screen real estate on my device (27x48), I'm trying set laststatus=1 set rulerformat=%25(%<%f%M\ %=%l\|%c%) No matter the minwid prefix, or if I apply it to %() or %f, or if I ...
2
votes
1answer
35 views

Is there a way to get a count of the number of spelling errors in a buffer?

I'd like to be able to show the number of spelling errors in a buffer in my status line. Is there a vimscript way of getting a count of the number of spelling errors? I could write some code to count ...
1
vote
1answer
42 views

Mapping statuses fails on Visual Block ^V

I've got some code to print the current mode in the status line. let g:currentmode={ \ 'n' : 'Normal', \ 'no' : 'Normal·Operator Pending', \ 'v' : 'Visual', \ 'V' : 'V·Line', \ ...
2
votes
1answer
35 views

Having current filename in the command line

Some time ago I completely got rid of the status line. Vertical space is a scarcity in the modern HD world. The only thing I missed from it is an ability to see what file I'm working with. So I'm ...
2
votes
0answers
24 views

Can I trigger a command when the status bar shows up or hides?

I'm using set laststatus=1 so the status bar is only visible when needed, e.g. to display file names when multiple splits are open. However, when the status bar shows up, the existing buffer seems to ...
0
votes
2answers
35 views

Require nested evaluation within the status line, a render status line function?

With regards to this line (full code at the bottom): let savestatus = "%{&modified ? '%#StatusUnsaved#[+++]%*' : &modifiable ? '[---] ' : '[ R ]'}" If the file is modified, I wish to print [...
0
votes
1answer
35 views

Is it possible to pass local variables to functions inside statusline=%{}?

I have a function that builds my status line by appending values with statusline+= depending on the context. Everything works, except that if I try to call a function in the following form: setlocal ...
3
votes
1answer
288 views

ctermbg and ctermfg are backwards or incorrect for certain highlighting groups

I am currently attempting to create a custom colorscheme for vim by using ctermfg and ctermbg values, and checking what the colorscheme looks like with the highlight test file provided by Vim. What I ...
1
vote
0answers
115 views

Add to statusline

I'm using vim-airline plugin for my statusline. Now I want to install kite which suggests adding a section to the statusline. I tried adding using: set statusline+=%{kite#statusline()} but that ...
3
votes
2answers
707 views

Disable Lightline on Nerdtree

I would like to disable or hide Lightline (i.e. vim's statusline) when my cursor is in Nerdtree, while keeping it activated for other buffers. Here is what I mean: How can I achieve this? ...
3
votes
1answer
76 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
94 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
216 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
72 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
808 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
211 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
55 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
2answers
67 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
83 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
668 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
710 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%* ...
1
vote
1answer
2k 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' } ...
3
votes
1answer
761 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 ...
2
votes
1answer
47 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
90 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
171 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
69 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
276 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
147 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
72 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
296 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
197 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
51 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 ...
4
votes
2answers
969 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
2answers
284 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 %...
2
votes
1answer
152 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
231 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
603 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
566 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
93 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]':!...
7
votes
3answers
973 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 ...
3
votes
1answer
717 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
223 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?'\ \ [+]':''} ...
1
vote
1answer
430 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
695 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
111 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 ...