Adds the ability to display graphics to (N)Vim. This is developed for my digital notebook and is still in infancy. Expect weird behaviour and crashes.
The picture's content is streamed via the SIXEL character set (see 1, 2, 3 for more information)
- Render LaTex equations within math fences
- Display pictures in standalone image links
- Support GnuPlot, arbitrary LaTex, fetch source from other files
- Fix weird artifacts of SIXEL
sample-sources.mp4
sample-folding.mp4
sample-remote.mp4
The installation is a bit more involved. You have to make sure that your terminal is able to render SIXEL characters. The plugin is written in Rust for performance reasons, and interfaced to Vimscript with libcallex-vim. For this you also need to install toolchains for Rust and C. Imagemagick is also required to convert between different graphic formats and SIXEL.
First use a terminal supporting SIXEL characters
You have to install imagemagick to render graphics to SIXEL format:
- Archlinux:
pacman -S imagemagick
- Ubuntu: package
libmagickwand
too old, seehttps://github.com/SoftCreatR/imei
- Other: https://imagemagick.org/script/download.php
Before installing the vim plugin, make sure that toolchains for Rust and C are installed:
- for C install
make
andgcc
- for Rust install a stable toolchain, for example with rustup
Finally add the following section to your vim configuration
Plug 'mattn/libcallex-vim', { 'do': 'make -C autoload' }
Plug 'bytesnake/vim-graphical-preview', { 'do': 'cargo build --release' }
and install with source %|PlugInstall
.
The plugin is currently not mapped to a file format, but can be manually enabled by setting the filetype
variable to graphical-preview
or add the follow preamble to your file:
vim: set filetype=markdown.graphics :
The graphic is overlapping with the command and status line
This is a limitation of SIXEL as it always scrolls after a line and would do that as well for the last one. Otherwise we could overlap and delete with a raster sequence. There is special mode, disabling this behaviour, but then your image is fixed at the upper, left corner (see here).
TODO
- heapslip for inspiring me with vimimage
- the awesome people at alacritty, Ayose Cazorla and microo8