Follow the Vim 7.4 convention where to place python files.
This commit is contained in:
parent
c78a54b158
commit
4005608bab
@ -296,16 +296,11 @@ alternative function IMAP_Jumpfunc('', 0) is called.
|
||||
For even more advanced usage, you can directly write python functions using
|
||||
UltiSnip's python modules.
|
||||
|
||||
The path to UltiSnip's python implementation is stored in the
|
||||
g:UltiSnipsPythonPath variable which is set automatically on load.
|
||||
|
||||
Here is a small example funtion that expands a snippet: >
|
||||
|
||||
function! s:Ulti_ExpandSnip()
|
||||
Python << EOF
|
||||
import sys, vim
|
||||
new_path = vim.eval("expand('g:UltiSnipsPythonPath')")
|
||||
sys.path.append(new_path)
|
||||
from UltiSnips import UltiSnips_Manager
|
||||
UltiSnips_Manager.expand()
|
||||
EOF
|
||||
@ -945,15 +940,10 @@ wow<tab>Hello World ->
|
||||
Hello World HELLO WORLD
|
||||
|
||||
Python global functions can be stored in a python module and then imported.
|
||||
This makes global functions easily accessible to all snippet files.
|
||||
|
||||
First, add the directory modules are stored in to the python search path. For
|
||||
example, add this line to your vimrc file. >
|
||||
|
||||
py import sys; sys.path.append("/home/sirver/.vim/python")
|
||||
|
||||
Now, import modules from this directory using a global snippet in your snippet
|
||||
file >
|
||||
This makes global functions easily accessible to all snippet files. Since Vim
|
||||
7.4 you can just drop python files into ~/.vim/pythonx and you an import them
|
||||
directly inside your snippets. For example to use
|
||||
~/.vim/pythonx/my_snippets_helpers.py >
|
||||
|
||||
global !p
|
||||
from my_snippet_helpers import *
|
||||
|
@ -283,9 +283,10 @@ endfunction
|
||||
|
||||
" Expand our path
|
||||
exec g:_uspy "import vim, os, sys"
|
||||
exec g:_uspy "new_path = vim.eval('expand(\"<sfile>:h\")')"
|
||||
exec g:_uspy "new_path = os.path.abspath(os.path.join(
|
||||
\ vim.eval('expand(\"<sfile>:h\")'), '..', 'pythonx'))"
|
||||
exec g:_uspy "vim.command(\"let g:UltiSnipsPythonPath = '%s'\" % new_path)"
|
||||
exec g:_uspy "sys.path.append(new_path)"
|
||||
exec g:_uspy "if not hasattr(vim, 'VIM_SPECIAL_PATH'): sys.path.append(new_path)"
|
||||
exec g:_uspy "from UltiSnips import SnippetManager"
|
||||
exec g:_uspy "UltiSnips_Manager = SnippetManager(
|
||||
\ vim.eval('g:UltiSnipsExpandTrigger'),
|
||||
|
2
pylintrc
2
pylintrc
@ -4,7 +4,7 @@ msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}"
|
||||
|
||||
# Python code to execute, usually for sys.path manipulation such as
|
||||
# pygtk.require().
|
||||
init-hook='import sys; sys.path.append("plugin/")'
|
||||
init-hook='import sys; sys.path.append("pythonx/")'
|
||||
|
||||
# Add files or directories to the blacklist. They should be base names, not
|
||||
# paths.
|
||||
|
Loading…
Reference in New Issue
Block a user