[!NOTE] Due to lack of time, this plugin has been archived. Please switch to a newer and maintained 3rd/image.nvim.
When you open an image file (e.g. portrait.png
), the open buffer becomes non-editable and non-saveable to ensure the file contents won't be overwritten. Then the buffer is filled with the ascii art generated by ascii-image-converter. I found out that a plugin similiar to this was already implemented for vim in vimscript: image.vim, so you can consider this a modern, lua version.
With packer
use {
'samodostal/image.nvim',
requires = {
'nvim-lua/plenary.nvim'
},
},
With vim.plug
Plug 'samodostal/image.nvim'
Plug 'nvim-lua/plenary.nvim'
-- Require and call setup function somewhere in your init.lua
require('image').setup {
render = {
min_padding = 5,
show_label = true,
show_image_dimensions = true,
use_dither = true,
foreground_color = false,
background_color = false
},
events = {
update_on_nvim_resize = true,
},
}
Colors are turned off by default.
render.foreground_color
and render.background_color
render.background_color
setting is a nice addition that enables colors not only for characters, but also for the space behind them.