Skip to content

Commit d18c289

Browse files
authored
Add SuperTab functionality
1 parent c491fb7 commit d18c289

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

plugin/vim-mysql-suggestions.vim

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,33 @@ function! DatabasePrefixesInit(word)
2929
endfunction
3030

3131

32+
function! MySQLCompleteSuperTabContext()
33+
34+
let column = col('.')
35+
if column > 1
36+
37+
let synname = synIDattr(synID(line('.'), column-1, 1), 'name')
38+
39+
if synname == 'phpStringSingle' || synname == 'javaScriptString' || synname == 'javaScriptFuncArg'
40+
return "\<c-x>\<c-u>"
41+
elseif synname == 'phpMethodsVar'
42+
let curline = getline('.')
43+
let beforecursor = curline[ 0 : (column-2) ]
44+
let splitWord = split(beforecursor, '->')
45+
let currentWord = splitWord[-1]
46+
let currentWord = substitute( currentWord , "_" , '' , 'g')
47+
48+
if strlen(currentWord) > 2
49+
if DatabasePrefixesInit( currentWord ) == '1'
50+
return "\<c-x>\<c-u>"
51+
endif
52+
endif
53+
return "\<c-x>\<c-o>"
54+
endif
55+
56+
if &omnifunc != ''
57+
return "\<c-x>\<c-o>"
58+
endif
59+
endif
60+
return "\<c-x>\<c-p>"
61+
endfunction

0 commit comments

Comments
 (0)