Giter VIP home page Giter VIP logo

vim-graphical-preview's Introduction

Display graphics in (N)Vim with SIXEL characters

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)

Features

  • 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

Examples

Graphic and LaTex math support

sample-sources.mp4

Support folding

sample-folding.mp4

Stream SIXEL characters via any text medium

sample-remote.mp4

Installation

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:

Before installing the vim plugin, make sure that toolchains for Rust and C are installed:

  • for C install make and gcc
  • 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.graphical-preview :

FAQ

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

Kudos to

vim-graphical-preview's People

Contributors

bytesnake avatar yehoshuapw avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.