Skip to content

machichima/image-view.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

image-view.nvim

Plugin to display image in the markdown file through:

  1. windows explorer
  2. image viewer in wsl
  3. feh (linux image viewer)
  4. tmux vertical split
    • in wezterm or kitty

This can be used in windows wsl and linux system. Option 1, 2, and 3 will open a image viewer window to show the image, while 4 will create the split view in tmux.

It can show the image with markdown link and wiki link:

  • markdown link: open the image with the relative path
  • wiki link: Only work with obsidian.nvim plugin. Open the image in the folder attachments.img_folder set in the obsidian.nvim plugin.

NOTE: currently does not support relative link option in wiki link

Table of Contents

Demo

Demo for linux using feh and kitty-tmux

linux.image.preview.demo.mp4

Installing

Lazy

{
    'machichima/image-view.nvim',
    name = "imageview",
    config = function()
        require("imageview").setup({})
    end,
},

Usage

Add keymap to capture and show the image with link under the cursor.

Using Lua:

local imageview = require("imageview")
vim.keymap.set("n", "<leader>i", imageview.get_node_at_cursor, {})

Configuration

Default use the explorer option. This can be modified on the setup by:

require("imageview").setup({
    opts = {
        open_type = "explorer",
        -- option:
        -- 1. "explorer": by Windows picture
        -- 2. "wezterm-tmux"
        -- 3. "kitty-tmux"
        -- 4. "wsl": use `open` command
        -- 5. "feh": use `feh -. filepath` to open the image (only available on linux)
    },
})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages