Skip to content

Ruler doesn't update properly in horizontal split #25960

@hedyhli

Description

@hedyhli

Problem

When using laststatus=0 and cmdheight=1, the ruler does not update in horizontal split, but does update for vertical splits.

Config:

vim.opt.laststatus = 0
vim.opt.statusline = "---"
vim.opt.rulerformat = "%20(%f %p%%%)"
vim.opt.cmdheight = 1

-- For easier navigation in demo
vim.keymap.set("n", "<C-h>", "<C-w>h")
vim.keymap.set("n", "<C-l>", "<C-w>l")
vim.keymap.set("n", "<C-k>", "<C-w>k")
vim.keymap.set("n", "<C-j>", "<C-w>j")

Screen recording:

nvim-ruler.mov

I'm currently on nvim 0.9:

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1692716794

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info

Steps to reproduce

  1. Save the config from above somewhere
  2. Run nvim with nvim -u the-config.lua
  3. Open horizontal split for any file
  4. See how the ruler updates correctly for newly opened buffer, but when cursor is at the previous buffer, it still shows the ruler as if cursor was in the new buffer

If you close the new buffer, it works correctly again.

This is not a problem in vertical splits.

Expected behavior

The ruler should update based on the buffer the cursor is in, regardless of vertical/horizontal splits.

From :help ruler:

					 *'ruler'* *'ru'* *'noruler'* *'noru'*
'ruler' 'ru'		boolean	(default on)
			global
	Show the line and column number of the cursor position, [...]

To my understanding it's basically like statusline which also updates based on cursor position.

Neovim version (nvim -v)

0.9.4

Vim (not Nvim) behaves the same?

Actually vim doesn't show the ruler at all with this config.

Operating system/version

macOS 13

Terminal name/version

kitty

$TERM environment variable

xterm-256color

Installation

app image from github release

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed:questionissues that are closed as usage questions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions