Skip to content

Commit 5ae1df9

Browse files
committed
Auto-open existing projects.
When Vim loads, if, on the current directory, there's a `.ropeproject` sub-directory and both rope and `g:pymode_rope_auto_project_open` are enabled, the project is automatically opened.
1 parent 681a182 commit 5ae1df9

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

plugin/pymode.vim

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,14 @@ endif
175175

176176
if !pymode#Default("g:pymode_rope", 1) || g:pymode_rope
177177

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

181+
" OPTION: g:pymode_rope_auto_project_open -- bool.
182+
" Auto open existing projects, ie, if the current directory has a
183+
" `.ropeproject` subdirectory.
184+
call pymode#Default("g:pymode_rope_auto_project_open", 1)
185+
181186
" OPTION: g:pymode_rope_enable_autoimport -- bool. Enable autoimport
182187
call pymode#Default("g:pymode_rope_enable_autoimport", 1)
183188

@@ -234,6 +239,13 @@ if !pymode#Default("g:pymode_rope", 1) || g:pymode_rope
234239
return ""
235240
endfunction "}}}
236241

242+
fun! RopeOpenExistingProject() "{{{
243+
if isdirectory('./.ropeproject')
244+
call RopeOpenProject()
245+
return ""
246+
endif
247+
endfunction "}}}
248+
237249
fun! RopeLuckyAssistInsertMode() "{{{
238250
call RopeLuckyAssist()
239251
return ""
@@ -270,6 +282,12 @@ if !pymode#Default("g:pymode_rope", 1) || g:pymode_rope
270282
menu <silent> Rope.Undo :RopeUndo<CR>
271283
menu <silent> Rope.UseFunction :RopeUseFunction<CR>
272284

285+
" Hooks
286+
if !pymode#Default("g:pymode_rope_auto_project_open", 1) || g:pymode_rope_auto_project_open
287+
autocmd VimEnter * call RopeOpenExistingProject()
288+
call windo e
289+
endif
290+
273291
endif
274292

275293
" }}}

0 commit comments

Comments
 (0)