Skip to content

Commit 40c67d2

Browse files
committed
Merge branch 'master' into develop
2 parents 5f6b283 + 59350ae commit 40c67d2

10 files changed

Lines changed: 474 additions & 162 deletions

File tree

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-09-07 0.6.10
5+
--------------------
6+
* Dont raise an exception when Logger has no message handler (c) nixon
7+
* Improve performance of white space removal (c) Dave Smith
8+
* Improve ropemode support (c) s0undt3ch
9+
* Add `g:pymode_updatetime` option
10+
* Update autopep8 to version 0.8.1
11+
412
## 2012-09-07 0.6.9
513
-------------------
614
* Update autopep8

autoload/pymode.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,15 @@ fun! pymode#PlaceSigns() "{{{
5555
"
5656
if has('signs')
5757
sign unplace *
58+
59+
if !pymode#Default("g:pymode_lint_signs_always_visible", 0) || g:pymode_lint_signs_always_visible
60+
call RopeShowSignsRulerIfNeeded()
61+
endif
62+
5863
for item in filter(getqflist(), 'v:val.bufnr != ""')
5964
execute printf('silent! sign place 1 line=%d name=%s buffer=%d', item.lnum, item.type, item.bufnr)
6065
endfor
66+
6167
endif
6268
endfunction "}}}
6369

@@ -174,4 +180,11 @@ fun! pymode#Modeline() "{{{
174180
endfunction "}}}
175181

176182

183+
fun! pymode#TrimWhiteSpace() "{{{
184+
let cursor_pos = getpos('.')
185+
silent! %s/\s\+$//
186+
call setpos('.', cursor_pos)
187+
endfunction "}}}
188+
189+
177190
" vim: fdm=marker:fdl=0

ftplugin/python/pymode.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ if pymode#Option('lint')
7171
endif
7272

7373
" DESC: Run queue
74-
setlocal updatetime=1000
74+
let &l:updatetime = g:pymode_updatetime
7575
au CursorHold <buffer> call pymode#queue#Poll()
7676
au BufLeave <buffer> py queue.stop_queue()
7777

@@ -133,7 +133,7 @@ endif
133133
" Utils {{{
134134

135135
if pymode#Option('utils_whitespaces')
136-
au BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
136+
au BufWritePre <buffer> call pymode#TrimWhiteSpace()
137137
endif
138138

139139
" }}}

plugin/pymode.vim

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ if !pymode#Default("g:pymode_lint", 1) || g:pymode_lint
9999
" OPTION: g:pymode_lint_mccabe_complexity -- int. Maximum allowed complexity
100100
call pymode#Default("g:pymode_lint_mccabe_complexity", 8)
101101

102+
" OPTION: g:pymode_lint_signs_always_visible -- bool. Always show the
103+
" errors ruller, even if there's no errors.
104+
call pymode#Default("g:pymode_lint_signs_always_visible", 0)
105+
102106
" OPTION: g:pymode_lint_signs -- bool. Place error signs
103107
if (!pymode#Default("g:pymode_lint_signs", 1) || g:pymode_lint_signs) && has('signs')
104108

@@ -109,6 +113,12 @@ if !pymode#Default("g:pymode_lint", 1) || g:pymode_lint
109113
sign define E text=EE texthl=Error
110114
sign define I text=II texthl=Info
111115

116+
if !pymode#Default("g:pymode_lint_signs_always_visible", 0) || g:pymode_lint_signs_always_visible
117+
" Show the sign's ruller if asked for, even it there's no error to show
118+
sign define __dummy__
119+
autocmd BufRead,BufNew * call RopeShowSignsRulerIfNeeded()
120+
endif
121+
112122
endif
113123

114124
" DESC: Set default pylint configuration
@@ -175,9 +185,17 @@ endif
175185

176186
if !pymode#Default("g:pymode_rope", 1) || g:pymode_rope
177187

178-
" OPTION: g:pymode_rope_auto_project -- bool. Auto open ropeproject
188+
" OPTION: g:pymode_rope_auto_project -- bool. Auto create ropeproject
179189
call pymode#Default("g:pymode_rope_auto_project", 1)
180190

191+
" OPTION: g:pymode_rope_auto_project_open -- bool.
192+
" Auto open existing projects, ie, if the current directory has a
193+
" `.ropeproject` subdirectory.
194+
call pymode#Default("g:pymode_rope_auto_project_open", 1)
195+
196+
" OPTION: g:pymode_rope_auto_session_manage -- bool
197+
call pymode#Default("g:pymode_rope_auto_session_manage", 0)
198+
181199
" OPTION: g:pymode_rope_enable_autoimport -- bool. Enable autoimport
182200
call pymode#Default("g:pymode_rope_enable_autoimport", 1)
183201

@@ -234,6 +252,15 @@ if !pymode#Default("g:pymode_rope", 1) || g:pymode_rope
234252
return ""
235253
endfunction "}}}
236254

255+
fun! RopeOpenExistingProject() "{{{
256+
if isdirectory(getcwd() . '/.ropeproject')
257+
" In order to pass it the quiet kwarg I need to open the project
258+
" using python and not vim, which should be no major issue
259+
py ropevim._interface.open_project(quiet=True)
260+
return ""
261+
endif
262+
endfunction "}}}
263+
237264
fun! RopeLuckyAssistInsertMode() "{{{
238265
call RopeLuckyAssist()
239266
return ""
@@ -249,6 +276,13 @@ if !pymode#Default("g:pymode_rope", 1) || g:pymode_rope
249276
endif
250277
endfunction "}}}
251278

279+
fun! RopeShowSignsRulerIfNeeded() "{{{
280+
if &ft == 'python'
281+
execute printf('silent! sign place 1 line=1 name=__dummy__ file=%s', expand("%:p"))
282+
endif
283+
endfunction "}}}
284+
285+
252286
" Rope menu
253287
menu <silent> Rope.Autoimport :RopeAutoImport<CR>
254288
menu <silent> Rope.ChangeSignature :RopeChangeSignature<CR>
@@ -270,6 +304,15 @@ if !pymode#Default("g:pymode_rope", 1) || g:pymode_rope
270304
menu <silent> Rope.Undo :RopeUndo<CR>
271305
menu <silent> Rope.UseFunction :RopeUseFunction<CR>
272306

307+
if !pymode#Default("g:pymode_rope_auto_project_open", 1) || g:pymode_rope_auto_project_open
308+
call RopeOpenExistingProject()
309+
endif
310+
311+
if !pymode#Default("g:pymode_rope_auto_session_manage", 0) || g:pymode_rope_auto_session_manage
312+
autocmd VimLeave * call RopeSaveSession()
313+
autocmd VimEnter * call RopeRestoreSession()
314+
endif
315+
273316
endif
274317

275318
" }}}
@@ -290,4 +333,7 @@ call pymode#Default("g:pymode_utils_whitespaces", 1)
290333
" OPTION: g:pymode_options -- bool. To set some python options.
291334
call pymode#Default("g:pymode_options", 1)
292335

336+
" OPTION: g:pymode_updatetime -- int. Set updatetime for async pymode's operation
337+
call pymode#Default("g:pymode_updatetime", 1000)
338+
293339
" vim: fdm=marker:fdl=0

0 commit comments

Comments
 (0)