mirror of
https://github.com/davidhalter/jedi-vim.git
synced 2025-12-15 14:57:08 +08:00
compressed settings
This commit is contained in:
@@ -16,48 +16,36 @@ if exists("g:loaded_jedi") || &cp
|
|||||||
endif
|
endif
|
||||||
let g:loaded_jedi = 1
|
let g:loaded_jedi = 1
|
||||||
|
|
||||||
|
|
||||||
" ------------------------------------------------------------------------
|
" ------------------------------------------------------------------------
|
||||||
" defaults for jedi-vim
|
" defaults for jedi-vim
|
||||||
" ------------------------------------------------------------------------
|
" ------------------------------------------------------------------------
|
||||||
if !exists("g:jedi#use_tabs_not_buffers ")
|
let s:settings = {
|
||||||
let g:jedi#use_tabs_not_buffers = 1
|
\ 'use_tabs_not_buffers': 1,
|
||||||
endif
|
\ 'auto_initialization': 1,
|
||||||
if !exists("g:jedi#auto_initialization")
|
\ 'goto_command': "'<leader>g'",
|
||||||
let g:jedi#auto_initialization = 1
|
\ 'get_definition_command': "'<leader>d'",
|
||||||
endif
|
\ 'related_names_command': "'<leader>n'",
|
||||||
if !exists("g:jedi#goto_command")
|
\ 'rename_command': "'<leader>r'",
|
||||||
let g:jedi#goto_command = "<leader>g"
|
\ 'popup_on_dot': 1,
|
||||||
endif
|
\ 'pydoc': "'K'",
|
||||||
if !exists("g:jedi#get_definition_command")
|
\ 'show_function_definition': 1,
|
||||||
let g:jedi#get_definition_command = "<leader>d"
|
\ 'function_definition_escape': "'≡'",
|
||||||
endif
|
\ 'auto_close_doc': 1
|
||||||
if !exists("g:jedi#related_names_command")
|
\ }
|
||||||
let g:jedi#related_names_command = "<leader>n"
|
|
||||||
endif
|
for [key, val] in items(s:settings)
|
||||||
if !exists("g:jedi#rename_command")
|
if !exists('g:jedi#'.key)
|
||||||
let g:jedi#rename_command = "<leader>r"
|
exe 'let g:jedi#'.key.' = '.val
|
||||||
endif
|
endif
|
||||||
if !exists("g:jedi#popup_on_dot")
|
endfor
|
||||||
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
|
|
||||||
|
|
||||||
set switchbuf=useopen " needed for pydoc
|
set switchbuf=useopen " needed for pydoc
|
||||||
let s:current_file=expand("<sfile>")
|
|
||||||
|
|
||||||
if g:jedi#auto_initialization
|
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
|
autocmd FileType python setlocal omnifunc=jedi#complete
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -71,10 +59,10 @@ import vim
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from os.path import dirname, abspath, join
|
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("<sfile>")')))), 'jedi'))
|
||||||
|
|
||||||
# update the sys path to include the jedi_vim script
|
# 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("<sfile>")'))))
|
||||||
import jedi_vim
|
import jedi_vim
|
||||||
sys.path.pop()
|
sys.path.pop()
|
||||||
|
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ def goto(is_definition=False, is_related_name=False, no_output=False):
|
|||||||
echo_highlight("Builtin modules cannot be displayed.")
|
echo_highlight("Builtin modules cannot be displayed.")
|
||||||
else:
|
else:
|
||||||
if d.module_path != vim.current.buffer.name:
|
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.current.window.cursor = d.line_nr, d.column
|
||||||
vim.command('normal! zt') # cursor at top of screen
|
vim.command('normal! zt') # cursor at top of screen
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user