mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
added viu img previewer support
This commit is contained in:
13
README.md
13
README.md
@@ -27,7 +27,7 @@ mixing it with a journal, based on [telescope.nvim](https://github.com/nvim-tele
|
|||||||
- paste images from clipboard
|
- paste images from clipboard
|
||||||
- toggle [ ] todo status of line
|
- toggle [ ] todo status of line
|
||||||
- insert links to images
|
- insert links to images
|
||||||
- **image previews**, via `catimg` or extension _(Linux only)_
|
- **image previews**, via `catimg`, `viu`, or extension
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
@@ -119,6 +119,7 @@ of being able to edit it.
|
|||||||
- [0.0.3 For pasting images: xclip (optional)](#003-for-pasting-images-xclip-optional)
|
- [0.0.3 For pasting images: xclip (optional)](#003-for-pasting-images-xclip-optional)
|
||||||
- [0.0.4 For image previews: telescope-media-files.nvim (optional)](#004-for-image-previews-telescope-media-filesnvim-optional)
|
- [0.0.4 For image previews: telescope-media-files.nvim (optional)](#004-for-image-previews-telescope-media-filesnvim-optional)
|
||||||
- [catimg](#catimg)
|
- [catimg](#catimg)
|
||||||
|
- [viu](#viu)
|
||||||
- [telescope-media-files.nvim](#telescope-media-filesnvim)
|
- [telescope-media-files.nvim](#telescope-media-filesnvim)
|
||||||
- [0.1 Install the plugin](#01-install-the-plugin)
|
- [0.1 Install the plugin](#01-install-the-plugin)
|
||||||
- [0.1.0 Other useful plugins](#010-other-useful-plugins)
|
- [0.1.0 Other useful plugins](#010-other-useful-plugins)
|
||||||
@@ -186,12 +187,22 @@ There are two supported ways to preview images:
|
|||||||
- **ONLY supported on Linux**
|
- **ONLY supported on Linux**
|
||||||
- via [catimg](https://github.com/posva/catimg)
|
- via [catimg](https://github.com/posva/catimg)
|
||||||
- supported at least on Linux and macOS
|
- supported at least on Linux and macOS
|
||||||
|
- via [viu](https://github.com/atanunq/viu)
|
||||||
|
- supports both iTerm and Kitty graphics protocols.
|
||||||
|
- Note: on my Linux machine, Kitty graphics rendering inside neovim /
|
||||||
|
telescope does not work at all, so it falls back to block rendering
|
||||||
|
mode.
|
||||||
|
|
||||||
##### catimg
|
##### catimg
|
||||||
|
|
||||||
Just install [catimg](https://github.com/posva/catimg), then set
|
Just install [catimg](https://github.com/posva/catimg), then set
|
||||||
`media_previewer` to `"catimg-previewer"` in the config.
|
`media_previewer` to `"catimg-previewer"` in the config.
|
||||||
|
|
||||||
|
##### viu
|
||||||
|
|
||||||
|
Just install [viu](https://github.com/atanunq/viu), then set
|
||||||
|
`media_previewer` to `"viu-previewer"` in the config.
|
||||||
|
|
||||||
##### telescope-media-files.nvim
|
##### telescope-media-files.nvim
|
||||||
|
|
||||||
Per default, or by setting `media_previewer` to `"telescope-media-files"` in the
|
Per default, or by setting `media_previewer` to `"telescope-media-files"` in the
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ telekasten.setup({opts})
|
|||||||
-- how to preview media files
|
-- how to preview media files
|
||||||
-- "telescope-media-files" if you have telescope-media-files.nvim installed
|
-- "telescope-media-files" if you have telescope-media-files.nvim installed
|
||||||
-- "catimg-previewer" if you have catimg installed
|
-- "catimg-previewer" if you have catimg installed
|
||||||
|
-- "viu-previewer" if you have viu installed
|
||||||
media_previewer = "telescope-media-files",
|
media_previewer = "telescope-media-files",
|
||||||
}
|
}
|
||||||
<
|
<
|
||||||
@@ -412,6 +413,8 @@ telekasten.setup({opts})
|
|||||||
plugin
|
plugin
|
||||||
- `'catimg-previewer'` : use the built-in `catimg` previewer.
|
- `'catimg-previewer'` : use the built-in `catimg` previewer.
|
||||||
Requires `catimg` to be installed.
|
Requires `catimg` to be installed.
|
||||||
|
- `'viu-previewer'` : use the built-in `viu` previewer.
|
||||||
|
Requires `viu` to be installed.
|
||||||
|
|
||||||
Default: `telescope-media-files`
|
Default: `telescope-media-files`
|
||||||
|
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ local function defaultConfig(home)
|
|||||||
-- how to preview media files
|
-- how to preview media files
|
||||||
-- "telescope-media-files" if you have telescope-media-files.nvim installed
|
-- "telescope-media-files" if you have telescope-media-files.nvim installed
|
||||||
-- "catimg-previewer" if you have catimg installed
|
-- "catimg-previewer" if you have catimg installed
|
||||||
|
-- "viu-previewer" if you have viu installed
|
||||||
media_previewer = "telescope-media-files",
|
media_previewer = "telescope-media-files",
|
||||||
}
|
}
|
||||||
M.Cfg = cfg
|
M.Cfg = cfg
|
||||||
@@ -979,6 +980,12 @@ local media_preview = defaulter(function(opts)
|
|||||||
.. "/telekasten.nvim/scripts/catimg-previewer"
|
.. "/telekasten.nvim/scripts/catimg-previewer"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if vim.startswith(M.Cfg.media_previewer, "viu-previewer") then
|
||||||
|
preview_cmd = M.base_directory
|
||||||
|
.. "/telekasten.nvim/scripts/"
|
||||||
|
.. M.Cfg.media_previewer
|
||||||
|
end
|
||||||
|
|
||||||
if vim.fn.executable(preview_cmd) == 0 then
|
if vim.fn.executable(preview_cmd) == 0 then
|
||||||
print("Previewer not found: " .. preview_cmd)
|
print("Previewer not found: " .. preview_cmd)
|
||||||
return conf.file_previewer(opts)
|
return conf.file_previewer(opts)
|
||||||
|
|||||||
5
scripts/viu-previewer
Executable file
5
scripts/viu-previewer
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
img="$1"
|
||||||
|
|
||||||
|
viu "$img"
|
||||||
Reference in New Issue
Block a user