image_preview.nvim icon indicating copy to clipboard operation
image_preview.nvim copied to clipboard

Image Preview for Neovim 🖼

Image Preview for Neovim

Neovim plugin for image previews. It has support for Wezterm and Kitty right now.

Using with WezTerm:

image

Using with Kitty

image preview with kitty

Installing

Plug

Plug 'adelarsq/image_preview.nvim'

Lazy

{
    'adelarsq/image_preview.nvim',
    event = 'VeryLazy',
    config = function()
        require("image_preview").setup()
    end
},

Configuration

Vim Script:

lua <<EOF
require("image_preview").setup({})
EOF

Lua:

require("image_preview").setup({})

neo-tree.nvim

To use on neo-tree.nvim it's necessary to add a command on the setup, as shows bellow:

require("neo-tree").setup({
  filesystem = {
    window = {
      mappings = {
        ["<leader>p"] = "image_wezterm", -- " or another map
      },
    },
    commands = {
      image_wezterm = function(state)
        local node = state.tree:get_node()
        if node.type == "file" then
          require("image_preview").PreviewImage(node.path)
        end
      end,
    },
  },
}

Special thanks for @pysan3 for point that.

Keybinds

  • <leader>p - image preview for file under cursor

Features

  • [x] Terminals:
  • [x] Environments:
    • [x] Windows
      • [x] PowerShell - WezTerm
      • [ ] DOS
      • [ ] WSL
    • [x] Linux - WezTerm, Kitty
    • [x] macOS - WezTerm, Kitty
  • [x] Plugins:
  • [x] Windows support. Depends on PowerShell
  • [x] macOS support
  • [x] Linux support
  • [x] bmp, png and jpg
  • [ ] svg

Related Plugins