SVGPreview is a straightforward Vim/Neovim plugin that allows you to preview SVG files directly from your editor. It detects the current operating system and uses the most suitable command to open SVG files in the default viewer.
Using Vim-Plug
- Add the following to your
.vimrc
orinit.vim
:Plug 'dcorral/svgpreview-vim'
- Reload your Vim/Neovim configuration or restart your editor.
- Run
:PlugInstall
.
Using Lazy
- Add the following to your
init.lua
for Neovim:require("lazy").setup({ {"dcorral/svgpreview-vim"} })
- Reload Neovim or source your configuration file.
- Run
:LazySync
to install the plugin.
- Clone this repository or download the latest release.
- Copy the
plugin
andautoload
directories to your Vim/Neovim configuration directory (~/.vim
for Vim,~/.config/nvim
for Neovim).
Open an SVG file in Vim/Neovim and run the command :SVGPreview
. The plugin will attempt to open the SVG file in your default system viewer.
You can set custom keyboard shortcuts to quickly trigger the SVG preview. Here are examples of how to set these in your .vimrc
or init.vim
:
nnoremap <silent> <Leader>sp :SVGPreview<CR>
Currently, SVGPreview does not require any configuration. It automatically detects your operating system and uses the most suitable command available to open SVG files.
SVGPreview is released under the MIT License. See the LICENSE file for more details.