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
129
votes
10answers
68k views

How can I see the full path of the current file?

When I'm editing a file in Vim, is there a command to see the path of the current file? Sometimes this is very handy if there are multiple files with the same name in a project.
37
votes
1answer
7k views

See the Unicode code point of the current character

How can I see the Unicode code point of the character where the cursor is? For example, if my cursor is on a ⌘ character, I'd like Vim to tell me that it is U+2318. Alternative information, such as ...
17
votes
1answer
6k views

How do I change the colour of the statusline of the currently focused window?

How do I change the colour of the statusline of the currently focused window? I've seen colorschemes modify this. Is this some sort of highlight group? Or something else?
12
votes
1answer
8k views

Jumping to a byte offset, and displaying position as byte offset

How can I move the cursor to the nth byte in the buffer? How can I display the current cursor position in the ruler in terms of the byte offset, rather than lines and columns? (Follow-up question: ...
10
votes
1answer
2k views

Why do custom highlights in my vimrc get cleared or reset to default?

I would like to highlight (part of) my statusline with %1*, for example: set statusline=%1*%f%0* highlight User1 ctermbg=0 ctermfg=10 cterm=bold However, this always shows up as "empty" (the default ...
8
votes
3answers
4k views

How to get rid of the command line bar?

I am using vim-airline and it's really nice. However, I get that second status bar below it which I want to hide. I have tried set noshowmode in my .vimrc, but that only seemed to hide the default ...
8
votes
1answer
343 views

`echon` for `echomsg`

The echon and echohl commands are very useful for outputting lines of text with multiple highlight groups within the same line. This can be used to for instance create nice status messages for plugins....
7
votes
1answer
328 views

Display current subroutine/subprogram in statusline

I am currently coding fortran, and I have huge "subprograms" (called "subroutine" in fortran). So I would like the name of the current subroutine (the subprogram my cursor is currently in) to be ...
6
votes
1answer
759 views

How to cut/trim line in statusline?

I'm trying to cut string returned from fugitive plugin. It returns branch name of current file. By default returned string is Git(branchname) and this is why I want to get rid of odd Git(..) wrapper. ...
6
votes
1answer
1k views

How to disable '— INSERT --' text beneath statusline?

I have powerline statusline plugin and set laststatus=2 in .vimrc, so I have two places it tells me my mode in. What is the bottom one called and can I disable it?
6
votes
1answer
452 views

Conditional strings on the statusline

Is it possible to print a conditional string on the statusline? e.g. GREEK if iminsert=1 and LATIN otherwise?
6
votes
2answers
1k views

Vim is displaying some info and “Press ENTER …” when I open a file

From time to time I see something like in the status bar when I open a file: "Gemfile" 112L, 2941C "Gemfile" 112 lines --62%-- Press ENTER or type command to continue Where is it coming from? How to ...
6
votes
1answer
497 views

Hide statusline when more than two windows open without suffering the extra hidden empty line artifact?

I want to hide the statusline, I don't ever use nor care about what is written in it. The problem is vim doesn't offer a way to achieve that in a convenient manner. If I just do set laststatus=0 I ...
5
votes
3answers
366 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 ...
5
votes
1answer
176 views

Keep beginning of current fold on top of the screen

I've googled around but can't find anything about this. There is a case: when I navigate deep down through large blocks of code in (for example) python, it would be useful to see which method, ...
4
votes
2answers
5k views

Get percentage through file of displayed window

I was looking at some of the special characters for use in a status line, and I found one that shows the percentage through file of displayed window (%P). However, I can find no way of getting this ...
4
votes
1answer
390 views

Swap command line and status-line?

Is it possible to swap the order of the command line and status line, such that the status line is flush with the bottom? Or better yet, completely disable the command line - but I understand that ...
4
votes
1answer
150 views

Strange interaction of set hidden, shortmess and the status line

My .vimrc contains set hidden set shortmess=fotx I start Vim 7.3 with vim a b I modify a (optional), then I save it and switch to the next file with :wn. Then I use :prev to return to the previous ...
3
votes
2answers
741 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 = ...
3
votes
1answer
51 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 ...
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 ...
3
votes
1answer
753 views

Difference between `virtual column number` and `column number` in statusline

What's the difference between virtual column number and column number (%v and %c respectively) in the statusline? Is it like virtualedit, where the virtual column number counts the position of the ...
3
votes
2answers
109 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
175 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 ...
3
votes
1answer
60 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]':!...
3
votes
1answer
752 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 ...
3
votes
1answer
354 views

How can I make a slow-ish `system` call in a statusline without corrupting the display?

I wrote a quick snippet of VimL to display, in my statusline, the type of the currently focused Haskell expression It looks like this (click for better quality (as gfy)): I've included the code below,...
2
votes
2answers
205 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 ...
2
votes
1answer
694 views

How do I conditionally add items to the statusline?

As a simple example, let's say I want to show the line number only when :spell is set. I would assume the following would work, but does not. %{&spell ? %l : ""}
2
votes
2answers
158 views

How to extract part of the current working directory to the statusline?

I have a lot of projects of the form: /home/karl/source/project-name/further/hierarchy/... I would like to extract just the project-name to put into my statusline. I use autochdir, so I know I can ...
2
votes
1answer
627 views

Gvim : Statusline is loading but not its colours

I have been experimenting with colours for my statusline recently and I put the plugin file in the bundle directory. I use pathogen which loads everything up from that directory. But, Even though the ...
2
votes
2answers
90 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 ...
2
votes
1answer
505 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=...
2
votes
1answer
884 views

Status line: Display path to file in the buffer, *without* filename

I can use %t in my statusline to display the file name (tail) of the file in the buffer, but there's no corresponding option to display only the path, without the file name. What I'm after: I'd like ...
2
votes
1answer
156 views

How to show the path to the current opened file?

If I open a file in vi like: vi /etc/httpd/conf/httpd.conf Then vi shows in the bottom left corner of the window: "/etc/httpd/conf/httpd.conf" 1009L, 34418C But when I edit the file with a or i ...
2
votes
2answers
704 views

Short buffer name

Is there a way to shorten the displayed name of the buffer, for example, on the image, path(...)/application_controller.rb to simply "application_controller.rb"? If I have many buffers with such long ...
2
votes
1answer
36 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 ...
2
votes
1answer
220 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
287 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%* ...
2
votes
1answer
248 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
428 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 ...
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
405 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
498 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 ...
1
vote
2answers
652 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
1
vote
1answer
369 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 ...
1
vote
1answer
30 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+=%{...
1
vote
1answer
254 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 ...
1
vote
2answers
509 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
632 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.