Skip to content

SalarAlo/rndr.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rndr.nvim

Render images and simple 3D assets directly inside the current Neovim buffer.

rndr.nvim pairs a Lua plugin with a native C++ renderer. Open an image or model, run :RndrOpen, and the buffer is replaced with an in-place preview you can rerender, rotate, and restore.

Showcase

Image preview showcase

What It Supports

  • Raster images: png, jpg, jpeg, gif, bmp, webp, tga, psd, hdr, pic, pnm, ppm, pgm, pbm
  • Vector images: svg, svgz
  • Models: obj, fbx, glb, gltf, dae, 3ds, blend, ply, stl, x, off
  • SVG rasterizers: rsvg-convert, magick, or convert

Requirements

Required:

  • Neovim with Lua support
  • git
  • CMake 3.16+
  • A C++23-capable compiler

Optional:

  • rsvg-convert, magick, or convert for SVG rendering

Plugin Manager Setup

lazy.nvim:

{
  "SalarAlo/rndr.nvim",
  build = "make",
  config = function()
    require("rndr").setup()
  end,
}

Note

Compile times can take a while. Installing assimp locally can drastically reduce compile times. If lazy.nvim times out your installation, add the following to your lazy config:

require("lazy").setup({
  git = {
    timeout = 900 -- 15 minutes
  }
})

packer.nvim:

use({
  "SalarAlo/rndr.nvim",
  run = "make",
  config = function()
    require("rndr").setup()
  end,
})

If make is unavailable:

{
  "SalarAlo/rndr.nvim",
  build = "./scripts/build_renderer.sh",
}

If you keep the binary somewhere else, override renderer.bin in setup().

Install

Clone the repository and build the native renderer:

git clone https://github.com/SalarAlo/rndr.nvim.git
cd rndr.nvim
make

This produces the renderer binary at renderer/build/rndr.

If assimp is not installed locally, CMake falls back to fetching a bundled copy during configure. That path still needs network access, so offline builds currently require a local assimp installation.

make is a thin wrapper around ./scripts/build_renderer.sh. If you prefer raw CMake commands:

cmake -S renderer -B renderer/build -DCMAKE_BUILD_TYPE=Release
cmake --build renderer/build --parallel --config Release

Quick Start

Minimal setup:

require("rndr").setup({
  preview = {
    auto_open = true,
  },
})

Open a supported file and run:

:RndrOpen

Or render a specific file directly:

:RndrOpen lua/examples/dog.jpg

Check whether the renderer binary and optional SVG tools are available:

:checkhealth rndr

Commands

  • :RndrOpen [path]
  • :RndrClose
  • :RndrRotateLeft
  • :RndrRotateRight
  • :RndrRotateUp
  • :RndrRotateDown
  • :RndrResetView

Rotation commands only affect model files.

Configuration

require("rndr").setup({
  preview = {
    auto_open = true,
    events = { "BufReadPost" },
    render_on_resize = true,
  },
  assets = {
    images = { "png", "jpg", "jpeg", "gif", "bmp", "webp" },
    vectors = { "svg", "svgz" },
    models = { "obj", "fbx", "glb", "gltf", "dae", "blend", "ply", "stl" },
  },
  window = {
    termguicolors = true,
    size = {
      width_offset = 0,
      height_offset = 0,
      min_width = 1,
      min_height = 1,
    },
    options = {
      number = false,
      relativenumber = false,
      wrap = false,
      signcolumn = "no",
    },
  },
  renderer = {
    bin = "/absolute/path/to/rndr.nvim/renderer/build/rndr",
    supersample = 2,
    brightness = 1.0,
    saturation = 1.18,
    contrast = 1.08,
    gamma = 0.92,
    background = "0d0f14",
  },
  controls = {
    rotate_step = 15,
    keymaps = {
      close = "q",
      rerender = "R",
      reset_view = "0",
      rotate_left = "h",
      rotate_right = "l",
      rotate_up = "k",
      rotate_down = "j",
    },
  },
})

Telescope preview override:

local rndr = require("rndr")

require("telescope").setup({
  defaults = {
    buffer_previewer_maker = rndr.telescope_buffer_previewer_maker,
  },
})

This keeps Telescope's normal previewer for non-renderable files and swaps in rndr automatically for supported images and models.

Manual Renderer Usage

The renderer can also be called directly:

./renderer/build/rndr <file> <term-width> <term-height> [supersample] [yaw] [pitch] [brightness] [saturation] [contrast] [gamma] [background]

Project Layout

.
├── lua/rndr/             # Neovim plugin code
├── lua/examples/         # Sample assets
├── renderer/             # Native renderer built with CMake
├── scripts/              # Build helpers
└── showcase/             # README media

About

A low resolution renderer for models and images within neovim.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors