Skip to content

Commit 412b5c5

Browse files
committed
Added autopep8 (PyLintAuto), some bugs fix in async linter
1 parent 5cb4de1 commit 412b5c5

File tree

11 files changed

+1649
-10
lines changed

11 files changed

+1649
-10
lines changed

Changelog.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
Changelog
22
=========
33

4-
## 2012-XX-XX 0.6.5
4+
## 2012-08-XX 0.6.5
55
-------------------
66
* Updated Pep8 to version 1.3.3
77
* Updated Pylint to version 0.25.2
88
* Fixed virtualenv support for windows users
99
* Added pymode modeline ':help PythonModeModeline'
1010
* Added diagnostic tool ':call pymode#troubleshooting#Test()'
11-
* Async code checking
11+
* Added `PyLintAuto` command ':help PyLintAuto'
12+
* Now Code checking is async operation
1213
* Improve speed of pymode folding
1314

1415
## 2012-05-24 0.6.4

README.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,8 @@ PyLintCheckerToggle Toggle code checker (pylint, pyflakes)
395395
-------------------- -------------
396396
PyLint Check current buffer
397397
-------------------- -------------
398+
PyLintAuto Automatic fix PEP8 errors
399+
-------------------- -------------
398400
Pyrun Run current buffer in python
399401
==================== =============
400402

@@ -466,6 +468,10 @@ Copyright (C) 2012 Kirill Klenov (klen_)
466468
Copyright (C) 2006 Johann C. Rocholl <johann@rocholl.net>
467469
http://github.com/jcrocholl/pep8
468470

471+
**autopep8**:
472+
Copyright (c) 2012 hhatto <hhatto.jp@gmail.com>
473+
https://github.com/hhatto/autopep8
474+
469475
**Python syntax for vim**
470476
Copyright (c) 2010 Dmitry Vasiliev
471477
http://www.hlabs.spb.ru/vim/python.vim

autoload/pymode.vim

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@ endfunction "}}}
1313

1414

1515
fun! pymode#Option(name) "{{{
16-
if exists('b:pymode_'.a:name)
17-
return {'b:pymode_'.a:name}
18-
else
19-
return {'g:pymode_'.a:name}
16+
17+
let name = 'b:pymode_' . a:name
18+
if exists(name)
19+
return eval(name)
2020
endif
21+
22+
let name = 'g:pymode_' . a:name
23+
return eval(name)
24+
2125
endfunction "}}}
2226

2327

@@ -166,6 +170,7 @@ fun! pymode#Modeline() "{{{
166170
let {'b:pymode_'.name} = value
167171
endfor
168172
endif
173+
au BufRead <buffer> call pymode#Modeline()
169174
endfunction "}}}
170175

171176

autoload/pymode/lint.vim

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fun! pymode#lint#Check() "{{{
1010
echohl Error | echo "File modified and I can't save it. Cancel code checking." | echohl None
1111
return 0
1212
endtry
13-
endif
13+
endif
1414

1515
let g:pymode_lint_buffer = bufnr('%')
1616

@@ -88,3 +88,18 @@ fun! pymode#lint#show_errormessage() "{{{
8888
endif
8989
endfor
9090
endfunction " }}}
91+
92+
93+
fun! pymode#lint#Auto() "{{{
94+
if &modifiable && &modified
95+
try
96+
write
97+
catch /E212/
98+
echohl Error | echo "File modified and I can't save it. Cancel operation." | echohl None
99+
return 0
100+
endtry
101+
endif
102+
py auto.fix_current_file()
103+
cclose
104+
edit
105+
endfunction "}}}

doc/pymode.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,9 @@ iM Operation with inner function or method.
447447

448448
*:PyLint* *PyLint*
449449
Check current buffer
450+
451+
*:PyLintAuto* *PyLintAuto*
452+
Automatic fix PEP8 errors
450453

451454
*:Pyrun* *Pyrun*
452455
Run current buffer
@@ -509,9 +512,13 @@ You may set |exrc| and |secure| in your |vimrc| for auto set custom settings fro
509512
http://www.divmod.com/
510513

511514
PEP8:
512-
Copyright (C) 2006 Johann C. Rocholl <johann@rocholl.net>
515+
Copyright (c) 2006 Johann C. Rocholl <johann@rocholl.net>
513516
http://github.com/jcrocholl/pep8
514517

518+
autopep8:
519+
Copyright (c) 2012 hhatto <hhatto.jp@gmail.com>
520+
https://github.com/hhatto/autopep8
521+
515522
Python syntax for vim:
516523
Copyright (c) 2010 Dmitry Vasiliev
517524
http://www.hlabs.spb.ru/vim/python.vim

ftplugin/python/pymode.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ if pymode#Option('lint')
6868
command! -buffer -nargs=0 PyLintWindowToggle :call pymode#lint#ToggleWindow()
6969
command! -buffer -nargs=0 PyLintCheckerToggle :call pymode#lint#ToggleChecker()
7070
command! -buffer -nargs=0 PyLint :call pymode#lint#Check()
71+
command! -buffer -nargs=0 PyLintAuto :call pymode#lint#Auto()
7172

7273
" DESC: Set autocommands
7374
if pymode#Option('lint_write')

plugin/pymode.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ if !pymode#Default("g:pymode_lint", 1) || g:pymode_lint
116116
let g:pymode_lint_config = expand("<sfile>:p:h:h") . "/pylint.ini"
117117
endif
118118

119-
py from pymode import lint, queue
119+
py from pymode import lint, queue, auto
120120

121121
au VimLeavePre * py queue.stop_queue()
122122

0 commit comments

Comments
 (0)