Open browser to preview files in current directory from vim.
How to install
-
Plugin 'leafOfTree/vim-preview'
-
cd ~/.vim/bundle && \ git clone https://github.com/leafOfTree/vim-preview --depth 1
-
Plug 'leafOfTree/vim-preview' :PlugInstall
-
Or manually, clone this plugin to
path/to/this_plugin
, and add it tortp
in vimrcset rtp+=path/to/this_plugin
Open any file in vim and call :Preview
.
Set global variable to customize specific feature:
let g:preview_image_filetypes = 'png,apng,jpg,jpeg,webp,ico,bmp,gif,svg'
variable | description | default |
---|---|---|
g:preview_open_browser |
Command to open browser with generated html | Mac: 'open', Linux: 'xdg-open', win32: 'start cmd /c start chrome' |
g:preview_image_filetypes |
Filetypes to preview with <img> |
'png,apng,jpg,jpeg,webp,ico,bmp,gif,svg' |
g:preview_video_filetypes |
Filetypes to preview with <video> |
'mp4,webm,ogg' |
g:preview_audio_filetypes |
Filetypes to preview with <audio> |
'mp3,wav' |
g:preview_object_filetypes |
Filetypes to preview with <object> |
'pdf,swf' |
The preview page at ./public/index.html
that is based on React. Run
npm install
npm start
Then call :Preview
. You can check src/index.js
, src/index.css
and public/index.html
first.