/vim-preview

Open browser to preview files in current directory from vim

Primary LanguageJavaScript

Vim-preview

screenshot

Open browser to preview files in current directory from vim.

Installation

How to install
  • VundleVim

      Plugin 'leafOfTree/vim-preview'
    
  • vim-pathogen

      cd ~/.vim/bundle && \
      git clone https://github.com/leafOfTree/vim-preview --depth 1
    
  • vim-plug

      Plug 'leafOfTree/vim-preview'
      :PlugInstall
    
  • Or manually, clone this plugin to path/to/this_plugin, and add it to rtp in vimrc

      set rtp+=path/to/this_plugin
    

Usage

Open any file in vim and call :Preview.

Configuration

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'

Development

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.