Skip to content

Commit f44723b

Browse files
aaronmgriffinvim-scripts
authored andcommitted
Version 0.7
* Fixed function list sorting (_ and __ at the bottom) * Removed newline removal from docs. It appears vim handles these better in recent patches
1 parent 2012864 commit f44723b

1 file changed

Lines changed: 35 additions & 13 deletions

File tree

ftplugin/pythoncomplete.vim

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
"pythoncomplete.vim - Omni Completion for python
22
" Maintainer: Aaron Griffin <[email protected]>
3-
" Version: 0.6
4-
" Last Updated: 14 May 2006
3+
" Version: 0.7
4+
" Last Updated: 19 Oct 2006
5+
"
6+
" Changes
7+
" TODO:
8+
" User defined docstrings aren't handled right...
9+
" 'info' item output can use some formatting work
10+
" Add an "unsafe eval" mode, to allow for return type evaluation
11+
" Complete basic syntax along with import statements
12+
" i.e. "import url<c-x,c-o>"
13+
" Continue parsing on invalid line??
14+
"
15+
" v 0.7
16+
" * Fixed function list sorting (_ and __ at the bottom)
17+
" * Removed newline removal from docs. It appears vim handles these better in
18+
" recent patches
519
"
620
" v 0.6:
721
" * Fixed argument completion
@@ -15,11 +29,6 @@
1529
" It was a bugfix version on top of 0.3. This is a complete
1630
" rewrite.
1731
"
18-
" Changes
19-
" TODO:
20-
" User defined docstrings aren't handled right...
21-
" 'info' item output can use some formatting work
22-
" Add an "unsafe eval" mode, to allow for return type evaluation
2332

2433
if !has('python')
2534
echo "Error: Required vim compiled with +python"
@@ -82,7 +91,24 @@ def vimcomplete(context,match):
8291
try:
8392
import vim
8493
def complsort(x,y):
85-
return x['abbr'] > y['abbr']
94+
try:
95+
xa = x['abbr']
96+
ya = y['abbr']
97+
if xa[0] == '_':
98+
if xa[1] == '_' and ya[0:2] == '__':
99+
return xa > ya
100+
elif ya[0:2] == '__':
101+
return -1
102+
elif y[0] == '_':
103+
return xa > ya
104+
else:
105+
return 1
106+
elif ya[0] == '_':
107+
return -1
108+
else:
109+
return xa > ya
110+
except:
111+
return 0
86112
cmpl = Completer()
87113
cmpl.evalsource('\n'.join(vim.current.buffer),vim.eval("line('.')"))
88114
all = cmpl.get_completions(context,match)
@@ -117,11 +143,7 @@ class Completer(object):
117143
except: dbg("locals: %s, %s [%s]" % (sys.exc_info()[0],sys.exc_info()[1],l))
118144

119145
def _cleanstr(self,doc):
120-
return doc.replace('"',' ')\
121-
.replace("'",' ')\
122-
.replace('\n',' ')\
123-
.replace('\r',' ')\
124-
.replace('',' ')
146+
return doc.replace('"',' ').replace("'",' ')
125147

126148
def get_arguments(self,func_obj):
127149
def _ctor(obj):

0 commit comments

Comments
 (0)