Add auto-goto command/function

This adds g:jedi#goto_command, and uses `<Leader>d` by default for it -
the old default for `g:jedi#goto_definitions_command`, which is now
empty.

It will try `script.goto_definitions()` first, and falls back to
`script.goto_assignments()` for builtins.

Closes https://github.com/davidhalter/jedi-vim/pull/407
This commit is contained in:
Daniel Hahler
2015-04-29 12:53:24 +02:00
parent 9a13f143a8
commit dd33e38631
5 changed files with 64 additions and 31 deletions

View File

@@ -22,12 +22,13 @@ Contents *jedi-vim-contents*
4. Usage |jedi-vim-usage|
5. Mappings |jedi-vim-keybindings|
5.1. Start completion |g:jedi#completions_command|
5.2. Go to assignment |g:jedi#goto_assignments_command|
5.3. Get original definition |g:jedi#goto_definitions_command|
5.4. Show documentation |g:jedi#documentation_command|
5.5. Rename variables |g:jedi#rename_command|
5.6. Show name usages |g:jedi#usages_command|
5.7. Open module by name |:Pyimport|
5.2. Go to definition |g:jedi#goto_command|
5.3. Go to assignment |g:jedi#goto_assignments_command|
5.4 Go to definition (deprecated) |g:jedi#goto_definitions_command|
5.5. Show documentation |g:jedi#documentation_command|
5.6. Rename variables |g:jedi#rename_command|
5.7. Show name usages |g:jedi#usages_command|
5.8. Open module by name |:Pyimport|
6. Configuration |jedi-vim-configuration|
6.1. auto_initialization |g:jedi#auto_initialization|
6.2. auto_vim_configuration |g:jedi#auto_vim_configuration|
@@ -233,17 +234,15 @@ Note: If you want to use <Tab> for completion, please install Supertab:
https://github.com/ervandew/supertab.
------------------------------------------------------------------------------
5.2. `g:jedi#goto_assignments_command` *g:jedi#goto_assignments_command*
Function: `jedi#goto_assignments()`
Default: <leader>g Go to definition
5.2. `g:jedi#goto_command` *g:jedi#goto_command*
Function: `jedi#goto()`
Default: <leader>d Go to definition (or assignment)
This function finds the first definition of the function/class under the
cursor. It produces an error if the definition is not in a Python file.
------------------------------------------------------------------------------
5.3. `g:jedi#goto_definitions_command` *g:jedi#goto_definitions_command*
Function: `jedi#goto_definitions()`
Default: <leader>d Go to original definition
This function first tries |jedi#goto_definitions|, and falls back to
|jedi#goto_assignments| for builtin modules. It produces an error if nothing
could be found.
NOTE: this implementation is subject to change.
Ref: https://github.com/davidhalter/jedi/issues/570
This command tries to find the original definition of the function/class under
the cursor. Just like the `jedi#goto_assignments()` function, it does not work
@@ -275,7 +274,23 @@ you all the way to the >
line in file3.py.
------------------------------------------------------------------------------
5.4. `g:jedi#documentation_command` *g:jedi#documentation_command*
5.3. `g:jedi#goto_assignments_command` *g:jedi#goto_assignments_command*
Function: `jedi#goto_assignments()`
Default: <leader>g Go to assignment
This function finds the first definition of the function/class under the
cursor. It produces an error if the definition is not in a Python file.
------------------------------------------------------------------------------
5.4. `g:jedi#goto_definitions_command` *g:jedi#goto_definitions_command*
Function: `jedi#goto_definitions()`
Default: - Go to original definition
NOTE: Deprecated. Use |g:jedi#goto_command| / |jedi#goto()| instead, which
currently uses this internally.
------------------------------------------------------------------------------
5.5. `g:jedi#documentation_command` *g:jedi#documentation_command*
Function: `jedi#show_documentation()`
Default: <K> Show pydoc documentation
@@ -284,7 +299,7 @@ The documentation is opened in a horizontally split buffer. The height of this
buffer is controlled by `g:jedi#max_doc_height` (set by default to 30).
------------------------------------------------------------------------------
5.5. `g:jedi#rename_command` *g:jedi#rename_command*
5.6. `g:jedi#rename_command` *g:jedi#rename_command*
Function: `jedi#rename()`
Default: <leader>r Rename variables
@@ -295,7 +310,7 @@ with the new one. The number of performed renames is displayed in the command
line.
------------------------------------------------------------------------------
5.6. `g:jedi#usages_command` *g:jedi#usages_command*
5.7. `g:jedi#usages_command` *g:jedi#usages_command*
Function: `jedi#usages()`
Default: <leader>n Show usages of a name.
@@ -303,7 +318,7 @@ The quickfix window is populated with a list of all names which point to the
definition of the name under the cursor.
------------------------------------------------------------------------------
5.7. Open module by name *:Pyimport*
5.8. Open module by name *:Pyimport*
Function: `jedi#py_import(args)`
Default: :Pyimport e.g. `:Pyimport os` shows os.py in VIM.