Skip to content
/ neoformat Public
forked from sbdchd/neoformat

✨ A (Neo)vim plugin for formatting code.

License

Notifications You must be signed in to change notification settings

copy/neoformat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

Neoformat

A Neovim plugin for formatting code.

Neoformat uses a variety of formatters for differing filetypes. Currently, Neoformat will run a formatter asynchronously, and on success it will update the current buffer with the formatted text. On a formatter failure, Neoformat will try the next formatter defined for the filetype.

The job control is based off of vim-go's.

Basic Usage

Format the current file using its filetype

:Neoformat

Or specify a filetype

:Neoformat python

Current Limitation(s)

In order to preserve marks, jumps, etc., Neoformat uses Vim's setline() function to insert the formatted text. If the buffer is changed before the formatter has completed, then the updated text will be put into the current buffer.

To prevent this, format jobs are cancelled when changing / closing the buffer.

So don't switch buffers before the the formatting is complete!

Config [Optional]

Define custom formatters.

let g:neoformat_python_autopep8 = {
            \ 'exe': 'autopep8'
            \ }

let g:neoformat_enabled_python = ['autopep8']

Enable basic formatting when a filetype is not found. Disabled by default.

" Enable alignment
let g:neoformat_basic_format_align = 1

" Enable tab to spaces conversion
let g:neoformat_basic_format_retab = 1

" Enable trimmming of trailing whitespace
let g:neoformat_basic_format_trim = 1

Supported Filetypes

About

✨ A (Neo)vim plugin for formatting code.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Vim Script 87.8%
  • Python 8.4%
  • Shell 2.3%
  • TypeScript 1.1%
  • CSS 0.3%
  • Makefile 0.1%