A rich-cli preview directly in your neovim buffer.
- Neovim 0.5 or higher
with vim-plug
Plug 'ginsburgnm/rich.nvim'with packer.nvim
use {"ginsburgnm/rich.nvim"}rich_path
Use g:rich_path for vimscript config or vim.g.rich_path for lua config.
If set, this path will be used to execute rich. Otherwise rely on $PATH.
If rich is not on $PATH or rich__path is set and rich is not found
the popup will return this error
Example:
let g:rich_path = "~/venv/bin/rich"vim.g.rich_path = "~/venv/bin/rich"rich_border
Use g:rich_border for vimscript config or vim.g.rich_border for lua config.
If set, this will change the border of the window. Type :help nvim_open_win
for border options.
Example:
let g:rich_border = "rounded"vim.g.rich_border = "rounded"rich_width
Use g:rich_width for vimscript config or vim.g.rich_width for lua config.
If set, this will change the width of the window.
Example:
let g:rich_width = 120vim.g.rich_width = 120rich_style
Use g:rich_style for vimscript config or vim.g.rich_style for lua config.
If set this will change the theme used by rich (all pygments names should work)
default is material
Example:
let g:rich_style = "dracula"vim.g.rich_style = "dracula":Rich [path-to-md-file]- Pressing
qwill automatically close the window - No path arg means rich uses current path in vim
:Richcommand will work as toggle feature, so calling it will open or close the current preview- you can also pass arbitrary arguments to
rich-cliwhen doing so all arguments must come after the file name or you must not provide a filename
Example to force markdown rendering on current file
:Rich -mYou can also create a mapping getting a preview of the current file
noremap <leader>p :Rich<CR>For users who want to make rich.nvim buffer fullscreen, there's a native vim keybinding
Ctrl-w + |set window's width maxCtrl-w + _set window's height max
Or you can have a fullscreen option by creating a mapping for setting both window's height and width max at once
noremap <C-w>z <C-w>\|<C-w>\_Pictures are worth a thousand words
Here we see the preview window displaying markdown with the plugin's default
border settings

Here we are previewing with border set to "rounded" (I have changed the color
of my border by setting highlight for FloatBorder

Similarly we can preview RST in the same manner

And JSON files you will note here that I specified to preview a different
file than the one I an currently editing by providing a file path.

I wll not interate through all the possibilities that rich-cli allows us to
preview. If rich-cli can preview a file this plugin should be able to show
it in a pop-up window.
This was HEAVILY influenced by glow.nvim to the point where most of the code (and even this readme) is copy paste, then find-rename.
Some of the configs I haven't actually tested but it looked like they were parameters to the neovim buffer windows so it should just work.
