zeekay / vim-beautify

Code beautifier for vim.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vim-beautify

Why live with ugly code? Adds filetype specific :Beautify command which beautifies buffers or ranges.

Built-in support

  • C, C++
    • astyle
  • CSS
    • css-beautify
  • HTML, XML
    • html-beautify (default)
    • tidy
  • Java
    • astyle
  • JavaScript
    • js-beautify
  • JSON
    • js-beautify
    • json.tool
    • node (default)
    • uglifyjs
  • Go
    • gofmt
  • Python
    • autopep8 (default)
    • docformatter (default)

Usage

You can beautify a buffer or range using :Beautify. The appropriate beautifier (or beautifiers) will be run according to detected filetype.

An optional filetype or beautifier name may also be specified to trigger a specific beautifier regardless of detected filetype. For instance, to beautify a block of JSON inside of a Markdown file you can simply select a range and call :Beautify json.

API

You can customize the existing beautifiers, arguments used or define new beautifiers:

let g:beautify = {
    \ "beautifiers": {
        \ "python": ["autopep8", "docformatter"],
    \ },
    \ "definitions": {
        \ "autopep8": {
            \ "args": "--aggressive",
        \ }
    \ }
\ }

About

Code beautifier for vim.


Languages

Language:Vim Script 99.1%Language:JavaScript 0.9%