smart_auto_mappings: look for from only at the start of a line

Fixes https://github.com/davidhalter/jedi-vim/issues/469.
Closes https://github.com/davidhalter/jedi-vim/pull/470.
This commit is contained in:
Daniel Hahler
2015-10-05 23:27:52 +02:00
parent 525524b5cf
commit 9ec2fb44b0

View File

@@ -451,7 +451,7 @@ endfunction
function! jedi#smart_auto_mappings()
" Auto put import statement after from module.name<space> and complete
if search('\<from\s\+[A-Za-z0-9._]\{1,50}\%#\s*$', 'bcn', line('.'))
if search('^\s*from\s\+[A-Za-z0-9._]\{1,50}\%#\s*$', 'bcn', line('.'))
" Enter character and start completion.
return "\<space>import \<C-x>\<C-o>\<C-r>=jedi#complete_opened(1)\<CR>"
endif