4

I'm trying to get the img2sixel function to work from a terminal inside of the vim.

Outside of vim, the image ("Hey") appears inline as expected and wanted:

enter image description here

However, this does not work from within vim, but no error messages is thrown by img2sixel:

enter image description here

Remarks:

  • wezterm 20240203-110809-5046fc22

  • img2sixel 1.10.3

  • xterm-256color

  • NVIM v0.10.0, Build type: Release, LuaJIT 2.1.1716656478

2
  • I believe Vim/Neovim rely very much on fixed size font to control the layout. I doubt that it can accept to embed image within the tool. The Vim/Neovim terminal is actually an emulation reading the text of the underlying terminal and displaying it in a buffer. Commented Jun 21 at 12:02
  • It’s not font, it’s terminal protocols (see my comment on Vivian’s answer).
    – D. Ben Knoble
    Commented Jun 21 at 12:55

1 Answer 1

2

The Vim/Neovim terminal is actually an emulation reading the text of on underlying terminal and displaying it in a Vim/Neovim buffer.

Vim/Neovim rely very much on fixed size fonts to control the layout of the tool. This prevent the tool to embed image within buffers.

For this reason what you ask is actually not possible in Vim/Neovim.

4
  • 1
    Thanks for your answer. I'm a bit confused though, because I know that images can be displayed in vim - e.g. using github.com/3rd/image.nvim . Does your answer apply specifically to the terminal inside vim? (My final goal is to have images in ipython in neovim - though I guess that's always going to need a terminal buffer.)
    – ElRudi
    Commented Jun 21 at 12:42
  • I just verified that also the kitty image protocol does not work inside a vim terminal buffer despite working in the terminal proper. This time there is a more understanding error message "Error: Terminal does not support reporting screen sizes in pixels, use a terminal such as kitty, WezTerm, Konsole, etc. that does." So, indeed, it's specifically the terminal in vim that's the issue. Then my question becomes: can I run ipython in (neo)vim, in any other way than it being inside a terminal buffer? I'll open another question for it
    – ElRudi
    Commented Jun 21 at 12:51
  • The Vim terminal buffers are xterm (256 color?) emulators, and I don’t think this is easily changeable. (I have no idea if this is true of Neovim terminals.)
    – D. Ben Knoble
    Commented Jun 21 at 12:54
  • I didn't know. I suppose it is a Neovim only functionality supported by a plugin probably leveraging background image control. Commented Jun 21 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.