From 7faacacc6d1941c0392a472311b6a7f7693ed961 Mon Sep 17 00:00:00 2001 From: Dane Summers Date: Fri, 14 Apr 2017 22:20:30 -0400 Subject: [PATCH] Ensures python system path is setup when Mundo* functions are called. #44 --- autoload/mundo.vim | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/autoload/mundo.vim b/autoload/mundo.vim index de7b2b4..56c9535 100644 --- a/autoload/mundo.vim +++ b/autoload/mundo.vim @@ -46,6 +46,14 @@ let s:plugin_path = escape(expand(':p:h'), '\') "{{{ Mundo utility functions +function! s:MundoSetupPythonPath()"{{{ + if g:mundo_python_path_setup == 0 + let g:mundo_python_path_setup = 1 + call s:MundoPython('sys.path.insert(1, "'. s:mundo_path .'")') + call s:MundoPython('sys.path.insert(1, "'. s:mundo_path .'/mundo")') + end +endfunction"}}} + function! s:MundoGoToWindowForBufferName(name)"{{{ if bufwinnr(bufnr(a:name)) != -1 exe bufwinnr(bufnr(a:name)) . "wincmd w" @@ -302,11 +310,7 @@ endfunction"}}} let s:mundo_path = escape( expand( ':p:h' ), '\' ) function! s:MundoToggle()"{{{ - if g:mundo_python_path_setup == 0 - let g:mundo_python_path_setup = 1 - call s:MundoPython('sys.path.insert(1, "'. s:mundo_path .'")') - call s:MundoPython('sys.path.insert(1, "'. s:mundo_path .'/mundo")') - end + call s:MundoSetupPythonPath() if s:MundoIsVisible() call s:MundoClose() else @@ -317,6 +321,7 @@ function! s:MundoToggle()"{{{ endfunction"}}} function! s:MundoShow()"{{{ + call s:MundoSetupPythonPath() if !s:MundoIsVisible() let g:mundo_target_n = bufnr('') let g:mundo_target_f = @% @@ -325,6 +330,7 @@ function! s:MundoShow()"{{{ endfunction"}}} function! s:MundoHide()"{{{ + call s:MundoSetupPythonPath() if s:MundoIsVisible() call s:MundoClose() endif