From 18613fe325443107339ce5f64ed0ef042ce77cf0 Mon Sep 17 00:00:00 2001 From: David Halter Date: Sat, 13 Oct 2012 02:05:57 +0200 Subject: [PATCH] compressed settings --- plugin/jedi.vim | 62 +++++++++++++++++++--------------------------- plugin/jedi_vim.py | 2 +- 2 files changed, 26 insertions(+), 38 deletions(-) diff --git a/plugin/jedi.vim b/plugin/jedi.vim index 0c8a19e..43cffc5 100644 --- a/plugin/jedi.vim +++ b/plugin/jedi.vim @@ -16,48 +16,36 @@ if exists("g:loaded_jedi") || &cp endif let g:loaded_jedi = 1 - " ------------------------------------------------------------------------ " defaults for jedi-vim " ------------------------------------------------------------------------ -if !exists("g:jedi#use_tabs_not_buffers ") - let g:jedi#use_tabs_not_buffers = 1 -endif -if !exists("g:jedi#auto_initialization") - let g:jedi#auto_initialization = 1 -endif -if !exists("g:jedi#goto_command") - let g:jedi#goto_command = "g" -endif -if !exists("g:jedi#get_definition_command") - let g:jedi#get_definition_command = "d" -endif -if !exists("g:jedi#related_names_command") - let g:jedi#related_names_command = "n" -endif -if !exists("g:jedi#rename_command") - let g:jedi#rename_command = "r" -endif -if !exists("g:jedi#popup_on_dot") - let g:jedi#popup_on_dot = 1 -endif -if !exists("g:jedi#pydoc") - let g:jedi#pydoc = "K" -endif -if !exists("g:jedi#show_function_definition") - let g:jedi#show_function_definition = 1 -endif -if !exists("g:jedi#function_definition_escape") - let g:jedi#function_definition_escape = '≡' -endif -if !exists("g:jedi#auto_close_doc") - let g:jedi#auto_close_doc = 1 -endif +let s:settings = { + \ 'use_tabs_not_buffers': 1, + \ 'auto_initialization': 1, + \ 'goto_command': "'g'", + \ 'get_definition_command': "'d'", + \ 'related_names_command': "'n'", + \ 'rename_command': "'r'", + \ 'popup_on_dot': 1, + \ 'pydoc': "'K'", + \ 'show_function_definition': 1, + \ 'function_definition_escape': "'≡'", + \ 'auto_close_doc': 1 +\ } + +for [key, val] in items(s:settings) + if !exists('g:jedi#'.key) + exe 'let g:jedi#'.key.' = '.val + endif +endfor + set switchbuf=useopen " needed for pydoc -let s:current_file=expand("") if g:jedi#auto_initialization + " this is only here because in some cases the VIM library adds their + " autocompletion as a default, which may cause problems, depending on the + " order of invocation. autocmd FileType python setlocal omnifunc=jedi#complete endif @@ -71,10 +59,10 @@ import vim import sys import os from os.path import dirname, abspath, join -sys.path.insert(0, join(dirname(dirname(abspath(vim.eval('s:current_file')))), 'jedi')) +sys.path.insert(0, join(dirname(dirname(abspath(vim.eval('expand("")')))), 'jedi')) # update the sys path to include the jedi_vim script -sys.path.append(dirname(abspath(vim.eval('s:current_file')))) +sys.path.append(dirname(abspath(vim.eval('expand("")')))) import jedi_vim sys.path.pop() diff --git a/plugin/jedi_vim.py b/plugin/jedi_vim.py index d59924c..d4c28b2 100644 --- a/plugin/jedi_vim.py +++ b/plugin/jedi_vim.py @@ -127,7 +127,7 @@ def goto(is_definition=False, is_related_name=False, no_output=False): echo_highlight("Builtin modules cannot be displayed.") else: if d.module_path != vim.current.buffer.name: - vim.eval('jedi#new_buffer(%s)' % d.module_path) + vim.eval('jedi#new_buffer(%s)' % repr(d.module_path)) vim.current.window.cursor = d.line_nr, d.column vim.command('normal! zt') # cursor at top of screen else: