Skip to content

Commit 95ff68c

Browse files
committed
Version 0.5.6
1 parent a1b5702 commit 95ff68c

File tree

8 files changed

+79
-4
lines changed

8 files changed

+79
-4
lines changed

Changelog.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Changelog
22
=========
33

4+
## 2012-02-06 0.5.6
5+
-------------------
6+
* Fix 'g:pymode_syntax' option
7+
* Show error message in bottom part of screen
8+
see 'g:pymode_lint_message'
9+
* Fix pylint for windows users
10+
* Fix breakpoint command (Use pdb when idpb not installed)
11+
412
## 2012-01-17 0.5.5
513
-------------------
614
* Add a sign for info messages from pylint.

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ Default values: ::
151151
" Auto open cwindow if errors be finded
152152
let g:pymode_lint_cwindow = 1
153153

154+
" Show error message if cursor placed at the error line
155+
let g:pymode_lint_message = 1
156+
154157
" Auto jump on first error
155158
let g:pymode_lint_jump = 0
156159

autoload/pymode.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,12 @@ fun! pymode#ShowCommand(cmd) "{{{
7373
normal gg
7474
wincmd p
7575
endfunction "}}}
76+
77+
" DESC: Show wide message
78+
fun! pymode#WideMessage(msg) "{{{
79+
let x=&ruler | let y=&showcmd
80+
set noruler noshowcmd
81+
redraw
82+
echo strpart(a:msg, 0, &columns-1)
83+
let &ruler=x | let &showcmd=y
84+
endfunction "}}}

autoload/pymode/lint.vim

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,23 @@ function! pymode#lint#Check()
1010
endif
1111
exe "py ".g:pymode_lint_checker."()"
1212
call setqflist(b:qf_list, 'r')
13+
1314
if g:pymode_lint_cwindow
1415
call pymode#QuickfixOpen(0, 0, g:pymode_lint_maxheight, g:pymode_lint_minheight, g:pymode_lint_jump)
1516
endif
17+
1618
if g:pymode_lint_signs
1719
call pymode#PlaceSigns()
1820
endif
21+
22+
if g:pymode_lint_message
23+
let b:errors = {}
24+
for v in b:qf_list
25+
let b:errors[v['lnum']] = v['text']
26+
endfor
27+
call pymode#lint#show_errormessage()
28+
endif
29+
1930
endfunction
2031

2132
fun! pymode#lint#Toggle() "{{{
@@ -45,3 +56,17 @@ fun! pymode#lint#toggle_win(toggle, msg) "{{{
4556
cclose
4657
endif
4758
endfunction "}}}
59+
60+
fun! pymode#lint#show_errormessage() "{{{
61+
let cursor = getpos(".")
62+
if !pymode#Default('b:errors', {}) || !len(b:errors)
63+
return
64+
endif
65+
if has_key(b:errors, l:cursor[1])
66+
call pymode#WideMessage(b:errors[l:cursor[1]])
67+
let b:show_message = 1
68+
else
69+
let b:show_message = 0
70+
echo
71+
endif
72+
endfunction " }}}

doc/pymode.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ PythonMode. These options should be set in your vimrc.
6565

6666
|'pymode_lint_cwindow'| Show cwindow
6767

68+
|'pymode_lint_message'| Show current line errors in bottom
69+
6870
|'pymode_lint_signs'| Place signs
6971

7072
|'pymode_lint_jump'| Auto jump on first error
@@ -184,6 +186,13 @@ Default: 1.
184186

185187
If this option is set to 0 then pylint not show cwindow.
186188

189+
------------------------------------------------------------------------------
190+
*'pymode_lint_message'*
191+
Values: 0 or 1.
192+
Default: 1.
193+
194+
If this option is set to 0 then pylint not show errors in bottom
195+
187196
------------------------------------------------------------------------------
188197
*'pymode_lint_signs'*
189198
Values: 0 or 1.

ftplugin/python/pymode.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ endif
7878

7979
if g:pymode_lint
8080

81+
" DESC: Show message flag
82+
let b:show_message = 0
83+
8184
" DESC: Set commands
8285
command! -buffer -nargs=0 PyLintToggle :call pymode#lint#Toggle()
8386
command! -buffer -nargs=0 PyLintWindowToggle :call pymode#lint#ToggleWindow()
@@ -93,6 +96,11 @@ if g:pymode_lint
9396
au InsertLeave <buffer> PyLint
9497
endif
9598

99+
if g:pymode_lint_message
100+
au CursorHold <buffer> call pymode#lint#show_errormessage()
101+
au CursorMoved <buffer> call pymode#lint#show_errormessage()
102+
endif
103+
96104
endif
97105

98106
" }}}

plugin/pymode.vim

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
let g:pymode_version = "0.5.5"
1+
let g:pymode_version = "0.5.6"
22

33
com! PymodeVersion echomsg "Current python-mode version: " . g:pymode_version
44

@@ -41,6 +41,9 @@ if !pymode#Default("g:pymode_lint", 1) || g:pymode_lint
4141
" OPTION: g:pymode_lint_onfly -- bool. Check code every save.
4242
call pymode#Default("g:pymode_lint_onfly", 0)
4343

44+
" OPTION: g:pymode_lint_message -- bool. Show current line error message
45+
call pymode#Default("g:pymode_lint_message", 1)
46+
4447
" OPTION: g:pymode_lint_checker -- str. Use pylint of pyflakes for check.
4548
call pymode#Default("g:pymode_lint_checker", "pylint")
4649

@@ -89,7 +92,7 @@ from pyflakes import checker
8992

9093
# Pylint setup
9194
linter = lint.PyLinter()
92-
pylint_re = re.compile('^[^:]+:(\d+): \[([EWRCI]+)[^\]]*\] (.*)$')
95+
pylint_re = re.compile('^(?:.:)?[^:]+:(\d+): \[([EWRCI]+)[^\]]*\] (.*)$')
9396

9497
checkers.initialize(linter)
9598
linter.load_file_configuration(vim.eval("g:pymode_lint_config"))
@@ -161,11 +164,18 @@ endif
161164

162165
if !pymode#Default("g:pymode_breakpoint", 1) || g:pymode_breakpoint
163166

167+
if !pymode#Default("g:pymode_breakpoint_cmd", "import ipdb; ipdb.set_trace() ### XXX BREAKPOINT") && has("python")
168+
python << EOF
169+
try:
170+
import ipdb
171+
except ImportError:
172+
vim.command('let g:pymode_breakpoint_cmd = "import pdb; pdb.set_trace() ### XXX BREAKPOINT"')
173+
EOF
174+
endif
175+
164176
" OPTION: g:pymode_breakpoint_key -- string. Key for set/unset breakpoint.
165177
call pymode#Default("g:pymode_breakpoint_key", "<leader>b")
166178

167-
call pymode#Default("g:pymode_breakpoint_cmd", "import ipdb; ipdb.set_trace() ### XXX BREAKPOINT")
168-
169179
endif
170180

171181
" }}}

syntax/python.vim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
" vim: ft=vim:fdm=marker
22

3+
" OPTION: g:pymode_syntax -- bool.
4+
call pymode#Default('g:pymode_syntax', 1)
5+
36
" DESC: Disable script loading
47
if pymode#Default('b:current_syntax', 'python') || !g:pymode_syntax
58
finish

0 commit comments

Comments
 (0)