diff --git a/functions.py b/functions.py index f82d9836..90fc1fe6 100644 --- a/functions.py +++ b/functions.py @@ -98,6 +98,9 @@ class Definition(object): return str(par.path) + def in_builtin_module(self): + return not self.module_path.endswith('.py') + @property def line_nr(self): return self.definition.start_pos[0] diff --git a/plugin/jedi.vim b/plugin/jedi.vim index 2898277c..1a65bfd4 100644 --- a/plugin/jedi.vim +++ b/plugin/jedi.vim @@ -98,12 +98,15 @@ if 1: vim.command('normal! m`') d = definitions[0] - if d.module_path != vim.current.buffer.name: - if vim.eval('g:jedi#use_tabs_not_buffers') == '1': - vim.command('call jedi#tabnew("%s")' % d.module_path) - else: - vim.command('edit ' + d.module_path) - vim.current.window.cursor = d.line_nr, d.column + if d.in_builtin_module(): + echo_highlight("Builtin modules cannot be displayed.") + else: + if d.module_path != vim.current.buffer.name: + if vim.eval('g:jedi#use_tabs_not_buffers') == '1': + vim.command('call jedi#tabnew("%s")' % d.module_path) + else: + vim.command('edit ' + d.module_path) + vim.current.window.cursor = d.line_nr, d.column else: # multiple solutions echo_highlight("Multiple solutions: Not implemented yet.")