#19360·vim

popup horizontal scroll

Author: ubaldotCreated Feb 8, 2026Updated Sep 17, 2026
Labelsenhancement

Sometimes, the text displayed in a popup goes over the popup maxwidth and it is not possible to horizontally scroll. Wrapping text may work in a number of case, but in some other case wrapping text is not a good idea (think for example to large tables).

To better understand the feature request, consider the following example: it is possible to vertically scroll the popup through j and k, but it is not possible to horizontally scroll it.

vim
vim9script

var some_text = ['This is a very long string that clearly does not fit the popup max width',
  'This is another line',
  'This is a third line'
]

def PopupFilter(id: number, key: string): bool
  if key == 'q' || key == "\<esc>"
    popup_close(id, -1)
  # Move down
  elseif key == "j"
    win_execute(id, "normal! j")
  # Move up
  elseif key == "k"
    win_execute(id, "normal! k")
  # Wanna scroll right
  elseif key == "l"
    win_execute(id, "normal! zl")
  # Wanna scroll left
  elseif key == "h"
    win_execute(id, "normal! zh")
  elseif key == "$"
    win_execute(id, "normal! $")
  elseif key == "0"
    win_execute(id, "normal! 0")
  else
    return false
  endif
  return true
enddef


var opts = {
  border: [1, 1, 1, 1],
  borderchars: ['─', '│', '─', '│', '╭', '╮', '╯', '╰'],
  filter: PopupFilter,
  maxheight: 1,
  maxwidth: 30,
  scrollbar: 0,
}

popup_create(some_text, opts)