Skip to content

A Vim plugin for previewing swagger/openAPI spec in Chrome with swagger-ui.

Notifications You must be signed in to change notification settings

xavierchow/vim-swagger-preview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Vim Swagger Preview

Intro

Swagger Editor is fancy, but my favorite editor is vim, and all my code is in vim, I don't like to copy & paste the yaml between the swagger-editor and vim. That's why I built this plugin; you can edit your yaml OpenAPI spec in vim and preview the result in Chrome.

Installation

Prerequisite

  • web browser
  • docker
  • make sure port 8017 is availabe to listen on, of course you can change it here.

Plugin

  • With Pathogen: Place vim-swagger-preview/ in .vim/bundle/.
  • With Vundle:
    • Add Plugin 'xavierchow/vim-swagger-preview' to your .vimrc.
    • Launch vim and run :PluginInstall
  • With vim-plug:
    • Setup with vim-plug guide
    • Add Plug 'xavierchow/vim-swagger-preview' to your .vimrc.

Usage

File extension

This plugin only applies to yaml file with the OpenAPI spec.

Keymap for preview

The default keymap is <leader>e, it brings up a browser window and shows the swagger-ui. You can also define your keymap in vimrc.

nmap <unique> <leader>e <Plug>GenerateDiagram 

Notes: Why I named it as GenerateDiagram is that I'd like to reuse the same mapping as vim-sequence-diagram.

License

MIT

About

A Vim plugin for previewing swagger/openAPI spec in Chrome with swagger-ui.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published