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.

155 questions
260
votes
13 answers

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.
thameera
  • 17,434
  • 16
  • 40
  • 42
8
votes
1 answer

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?
Toothrot
  • 3,129
  • 13
  • 27
6
votes
1 answer

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 this function to be called periodically (say…
Durga Swaroop
  • 1,059
  • 6
  • 17
6
votes
1 answer

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 still no statusline. I know I had a statusline at one…
Aaron Thomas
  • 355
  • 1
  • 4
  • 8
4
votes
2 answers

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 value through a function or a command that is…
EvergreenTree
  • 8,180
  • 2
  • 37
  • 59
4
votes
1 answer

check if plugin is loaded in .vimrc and set option accordingly?

I apologise if this seems very basic but I wasn't able to find a satisfactory answer. In my vimrc I want to check if the lightline status bar is loaded and set options accordingly. call plug#begin('~/.vim/plugged') Plug 'itchyny/lightline.vim' call…
First User
  • 391
  • 1
  • 8
4
votes
1 answer

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', \ '^V' : 'V·Block', \ 's' : 'Select', \…
Max
  • 153
  • 3
4
votes
1 answer

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]':!&modifiable?'\ \ [RO]':''} I removed other parts for…
3N4N
  • 5,684
  • 18
  • 45
3
votes
3 answers

How to prevent whitespace associated with items in the statusline from taking up space, when the item is not shown?

Consider the following statusline that makes use of %r to display [RO], when readonly has been set. The problem is that when readonly is not set, two spaces occur between %f (file path) and %y (file type). The problem is even worse, if I have…
Shuzheng
  • 1,235
  • 8
  • 21
3
votes
1 answer

How to add the "filetype" to the default "statusline" in Vim?

I like the default statusline in Vim, but would you like to add the filetype to it. Is it possible to add the filetype to the default statusline without having to create a new statusline from scratch?
Shuzheng
  • 1,235
  • 8
  • 21
3
votes
2 answers

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 Yet when I open the file with my own statusline there is…
Andy Stewart
  • 1,349
  • 8
  • 13
3
votes
1 answer

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 useful, while the full path (or relative path) is…
maged
  • 195
  • 4
3
votes
1 answer

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
1 answer

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
user419050
  • 129
  • 3
2
votes
1 answer

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?
3N4N
  • 5,684
  • 18
  • 45
1
2