Skip to content

Commit d7afdbd

Browse files
Allow external definition of include and source paths
1 parent 49c931f commit d7afdbd

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

myplugin/plugin/myplugin.vim

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
let current_dir = expand('<sfile>:p:h/')
44

5-
let g:include_path = resolve(current_dir . '/' . '../include')
6-
let g:src_path = resolve(current_dir . '/' . '../src')
5+
if !exists('g:include_path')
6+
let g:include_path = resolve(current_dir . '/' . '../include')
7+
endif
8+
9+
if !exists('g:src_path')
10+
let g:src_path = resolve(current_dir . '/' . '../src')
11+
endif
712

813
let $PYTHONPATH = expand("%:p:h") . ":" . $PYTHONPATH
914

1015
python3 << EOF
11-
import sys
12-
13-
sys.path.append(vim.eval('g:include_path'))
14-
sys.path.append(vim.eval('g:src_path'))
15-
1616
import vim
1717
EOF
1818

@@ -41,9 +41,14 @@ EOF
4141

4242
endfunction
4343

44-
4544
function! CreatePythonCommands()
46-
python3 << EOF
45+
46+
python3 << EOF
47+
48+
import sys
49+
sys.path.append(vim.eval('g:src_path'))
50+
sys.path.append(vim.eval('g:include_path'))
51+
4752
import os
4853
import importlib.util
4954

0 commit comments

Comments
 (0)