• Stars
    star
    274
  • Rank 150,274 (Top 3 %)
  • Language
    Vim Script
  • License
    MIT License
  • Created over 11 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

autopep8 plugin for Vim

vim-autopep8

vim-autopep8 is a Vim plugin that applies autopep8 to your current file. autopep8 automatically formats Python code to conform to the PEP 8 style guide.

Required

Installation

Simply put the contents of this repository in your ~/.vim/bundle directory.

But on some platforms the following extra steps might be necessary to enable the plugin to be loaded in vim:

  • ensure you have the ~/.vim/plugin directory
  • either copy or symlink the file ftplugin/python_autopep8.vim into the ~/.vim/plugin directory

Documentation (Read The Docs)

Usage

call function

:Autopep8

with arguments

:Autopep8 --range 1 5

or

:call Autopep8(" --range 1 5")

range selection

:'<,'>Autopep8

Caution!

This plugin remove default <F8> key mapping since v1.1.0. It is the user's business to decide which key to be mapped to.

Customization

For example, to map it to <F8>:

autocmd FileType python noremap <buffer> <F8> :call Autopep8()<CR>

Do not fix these errors/warnings (default: E226,E24,W6)

let g:autopep8_ignore="E501,W293"

Fix only these errors/warnings (e.g. E4,W)

let g:autopep8_select="E501,W293"

Maximum number of additional pep8 passes (default: 100)

let g:autopep8_pep8_passes=100

Set maximum allowed line length (default: 79)

let g:autopep8_max_line_length=79

Enable possibly unsafe changes (E711, E712) (default: non defined)

# add aggressive option (--aggressive)
let g:autopep8_aggressive=1

# add more aggressive options (--aggressive --aggressive)
let g:autopep8_aggressive=2

Number of spaces per indent level (default: 4)

let g:autopep8_indent_size=2

Disable show diff window

let g:autopep8_disable_show_diff=1

Chose diff window type. (default: horizontal)

# default
let g:autopep8_diff_type='horizontal'

let g:autopep8_diff_type='vertical'

Automatically format every time saving a file.

let g:autopep8_on_save = 1

Tips

If you want to use ใ€Œ=ใ€ with autopep8. It's good to set it as follows. But please be careful as "vim-autopep8" setting will not be inherited.

autocmd FileType python set equalprg=autopep8\ -

Author

  • tell-k

License

  • MIT License

More Repositories

1

sphinxjp.themes.revealjs

A sphinx theme for generate reveal.js presentation. #sphinxjp
CSS
54
star
2

sphinxjp.themes.basicstrap

Theme for Sphinx using Twitter Bootstrap
HTML
49
star
3

vim-browsereload-mac

vimplugin. scripts to reflesh your browser. works only MacOS
Python
41
star
4

django-modelsdoc

Create models definitions document from your django project.
Python
34
star
5

pypi-updates

Unofficial bot to flow PyPI recent updates.
Python
11
star
6

vim-autoflake

autoflake plugin for Vim
Python
11
star
7

goolabs

Goo labs API client for python. And provide some command line tools.
Python
10
star
8

pyconjp2015

PyconJP 2015 ใฎ็™บ่กจ่ณ‡ๆ–™ใงใ™ใ€‚
Python
7
star
9

csquery

A simple query builder for Amazon Cloudsearch Structured query parser.
Python
6
star
10

sphinxjp.themes.gopher

A sphinx theme for generate gotalk style presentation. #sphinxjp
JavaScript
6
star
11

pyconjp2016

Pycon JP 2016 ใฎ็™บ่กจ่ณ‡ๆ–™
Python
5
star
12

django-variantmpl

Provide a mechanism for Django that switching template based on request context.
Python
5
star
13

uadetector

WSGI Middleware and web framework extensions for handling User-Agent.
Python
5
star
14

djangocongressjp2019

Python
4
star
15

vim-quick-radon

vim-quick-radon is a Vim plugin that applies randon to your current file.
Vim Script
4
star
16

blister-pack

Ansible playbooks template for OS X.
Ruby
3
star
17

djangocongressjp2018

DjangoCongress JP 2018 ใฎ็™บ่กจ่ณ‡ๆ–™ใงใ™ใ€‚
Python
3
star
18

dotfiles

my dotfiles
Vim Script
2
star
19

php-services_buzzurl

PHP Library for Buzzurl API
PHP
2
star
20

aws-sns-register

aws sns topic ใซ้›ป่ฉฑ็•ชๅทใ‚’็™ป้Œฒใ™ใ‚‹ใ‚ตใƒณใƒ—ใƒซ
Python
1
star
21

qiitanote

Tech note for me by Sphinx.
Python
1
star