Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
PUBLIC
Thisrepository
Searchortypeacommand
Explore
Gist
Blog
Help
davidhalter / jedivim
Watch
jedivim/doc/jedivim.txt
branch:master
zennro
67
Star
910
Fork
73
davidhalter6daysagoresolvemergeconflictinauthors
4contributors
file
431lines(314sloc)
17.425kb
Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
*jedivim.txt*ForVimversion7.3Lastchange:2013/3/1
____________________________.______.~
|||____||\||\\//|||\/|~
||||__|..|||_____\\//|||\/|~
..|||__||||||||______\/||||\/||~
|`'|||____|''|||\/||||||~
\______/|_______||_______/|__|\__/|__||__||__|~
6.2.auto_vim_configuration
|g:jedi#auto_vim_configuration|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
6.3.popup_on_dot
6.4.popup_select_first
6.5.auto_close_doc
6.6.show_call_signatures
6.7.use_tabs_not_buffers
6.8.squelch_py_warning
6.9.completions_enable
6.10.use_splits_not_buffers
7.Testing
8.Contributing
9.License
|g:jedi#popup_on_dot|
|g:jedi#popup_select_first|
|g:jedi#auto_close_doc|
|g:jedi#show_call_signatures|
|g:jedi#use_tabs_not_buffers|
|g:jedi#squelch_py_warning|
|g:jedi#completions_enable|
|g:jedi#use_splits_not_buffers|
|jedivimtesting|
|jedivimcontributing|
|jedivimlicense|
Raw
Blame
History
Delete
jedivimawesomePythonautocompletionwithVim
==============================================================================
Contents
*jedivimcontents*
1.Introduction
2.Installation
|jedivimintroduction|
|jediviminstallation|
2.0.Requirements
2.1.Manually
|jediviminstallationrequirements|
|jediviminstallationmanually|
2.2.UsingPathogen
2.3.UsingVundle
3.SupportedPythonfeatures
|jediviminstallationpathogen|
|jediviminstallationvundle|
|jedivimsupport|
4.Usage
5.Mappings
|jedivimusage|
|jedivimmappings|
|g:jedi#completions_command|
|g:jedi#goto_assignments_command|
5.1.Startcompletion
5.2.Gotoassignment
5.3.Getoriginaldefinition
5.4.Showdocumentation
5.5.Renamevariables
|g:jedi#get_definitions_command|
|g:jedi#documentation_command|
|g:jedi#rename_command|
5.6.Shownameusages
5.7.Openmodulebyname
|g:jedi#usages_command|
|:Pyimport|
6.Configuration
6.1.auto_initialization
|jedivimconfiguration|
|g:jedi#auto_initialization|
==============================================================================
1.Introduction
*jedivimintroduction*
JedivimisaisaVimbindingtotheawesomePythonautocompletionlibrary
`jedi`.Amongjedi's(and,therefore,jedivim's)featuresare:
CompletionforawidearrayofPythonfeatures(see|jedivimsupport|)
Robustindealingwithsyntaxerrorsandwrongindentation
Parsescomplexmodule/function/classstructures
InfersfunctionargumentsfromSphinx/Epydocstrings
https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt
1/7
10/4/13
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
*jediviminstallation*
2.0.Requirements
*jediviminstallationrequirements*
Firstofall,jedivimrequiresVimtobecompiledwiththe`+python`option.
Thejedilibraryhastobeinstalledforjedivimtoworkproperly.Youcan
installitfirst,byusinge.g.yourdistribution'spackagemanager,orby
usingpip:>
pipinstalljedi
However,youcanalsoinstallitasagitsubmoduleifyoudon'twanttouse
jediforanythingbutthisplugin.Howtodothisisdetailedbelow.
2.1.Installingmanually
*jediviminstallationmanually*
1a.GetthelatestrepositoryfromGithub:>
gitclonehttp://github.com/davidhalter/jedivimpath/to/bundles/jedivim
1b.Ifyouwanttoinstalljediasasubmoduleinstead,issuethiscommand:>
gitclonerecursivehttp://github.com/davidhalter/jedivim
2.Putthepluginfilesintotheirrespectivefoldersinyourvimruntime
directory(usually~/.vim).Besuretopayattentiontothedirectory
structure!
3.UpdatetheVimhelptagswith>
:helptags<path/to/vimruntime>/doc
2.1.InstallingusingPathogen
*jediviminstallationpathogen*
Pathogensimplifiesinstallationconsiderably.
1.aClonethegitrepositoryintoyourbundlesdirectory:>
gitclonehttp://github.com/davidhalter/jedivimpath/to/bundles/jedivim
1b.Again,ifyouwanttoinstalljediasasubmodule,usethiscommand
instead:>
gitclonerecursivehttp://github.com/davidhalter/jedivim
2.3.InstallingusingVundle
*jediviminstallationvundle*
1.Vundleautomaticallydownloadssubrepositoriesasgitsubmodules,soyou
willautomaticallygetthejedilibrarywiththejedivimplugin.Addthe
followingtotheBundlessectioninyour.vimrcfile:>
Bundle'git://github.com/davidhalter/jedivim'
2.IssuethefollowingcommandinVim:>
https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt
2/7
10/4/13
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
Helptagsaregeneratedautomatically,soyoushouldbegoodtogo.
==============================================================================
3.SupportedPythonfeatures
*jedivimsupport*
TheJedilibrarydoesallthehardworkbehindthescenes.Itsupports
completionofalargenumberofPythonfeatures,amongthem:
Builtins
Multiple`return`sor`yield`s
Tupleassignments/arrayindexing/dictionaryindexing
`with`statement/exceptionhandling
`*args`and`**kwargs`
Decorators,lambdas,closures
Generators,iterators
Somedescriptors:`property`/`staticmethod`/`classmethod`
Somemagicmethods:`__call__`,`__iter__`,`__next__`,`__get__`,
`__getitem__`,`__init__`
`list.append()`,`set.add()`,`list.extend()`,etc.
(Nested)listcomprehensionsandternaryexpressions
Relative`import`s
`getattr()`/`__getattr__`/`__getattribute__`
Functionannotations(py3kfeature,arebeingignoredatthemoment,butare
parsed)
Classdecorators(py3kfeature,arebeingignoredatthemoment,butare
parsed)
Simple/usual`sys.path`modifications
`isinstance`checksfor`if`/`while`/`assert`case,thatdoesntworkwith
Jedi
Andmore...
Note:Thislistisnotnecessarilyuptodate.Foracompletelistof
features,pleaserefertotheJedidocumentationathttp://jedi.jedidjah.ch.
==============================================================================
4.Usage
*jedivimusage*
Withthedefaultsettings,autocompletioncanbetriggeredbytyping
<CtrlSpace>.Thefirstentrywillautomaticallybeselected,soyoucanpress
<Return>toinsertitintoyourcodeorkeeptypingandnarrowdownyour
completionoptions.Theusual<CX><CO>and<CP>/<CN>keybindingsworkas
well.Autocompletionisalsotriggeredbytypingaperiodininsertmode.
SinceperiodsrarelyoccurinPythoncodeoutsideofmethod/importlookups,
thisishandytohave(butcanbedisabled).
Whenitencountersanewmodule,jedimighttakeafewsecondstoparsethat
module'scontents.Afterwards,thecontentsarecachedandcompletionwillbe
almostinstantaneous.
==============================================================================
5.KeyBindings
*jedivimkeybindings*
Allkeybindingscanbemappedbysettingtheappropriateglobaloption.For
example,tosetthekeybindingforstartingomnicompletionto<CN>insteadof
<CtrlSpace>,addthefollowingsettingtoyour.vimrcfile:>
letg:jedi#completions_command="<CN>"
Note:Ifyouhave|g:jedi#auto_initialization|setto0,youhavetocreate
amappingyourselfbycallingafunction:>
"Using<CN>foromnicompletion
inoremap<silent><buffer><CN><cx><co>
"Use<localleader>r(bydefault<\r>)forrenaming
nnoremap<silent><buffer><localleader>r:calljedi#rename()<cr>
"etc.
Note:Youcansetcommandsto'',whichmeansthattheyareemptyandnot
https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt
3/7
10/4/13
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
Note:Youcansetcommandsto'',whichmeansthattheyareemptyandnot
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
ifthedefinitionisn'tinaPythonsourcefile.
assigned.It'saneasywayto"disable"functionalityofjedivim.
5.1.`g:jedi#completions_command`
*g:jedi#completions_command*
Function:n/aseeabove
Default:<CtrlSpace>
Startcompletion
Performsautocompletion(oromnicompletion,tobeprecise).
Note:Ifyouwanttouse<Tab>forcompletion,pleaseinstallSupertab:
https://github.com/ervandew/supertab.
5.2.`g:jedi#goto_assignments_command` *g:jedi#goto_assignments_command*
Function:`jedi#goto_assignments()`
Default:<leader>g
Gotodefinition
Thisfunctionfindsthefirstdefinitionofthefunction/classunderthe
cursor.ItproducesanerrorifthedefinitionisnotinaPythonfile.
5.3.`g:jedi#goto_definitions_command` *g:jedi#goto_definitions_command*
Function:`jedi#goto_definitions()`
Default:<leader>d
Gotooriginaldefinition
Thiscommandtriestofindtheoriginaldefinitionofthefunction/classunder
thecursor.Justlikethe`jedi#goto_assignments()`function,itdoesnotwork
Thedifferencebetween`jedi#goto_assignments()`and`jedi#goto_definitions()`
isthattheformerdoesn'tperformrecursivelookups.Take,forexample,the
followingmodulestructure:>
#file1.py:
fromfile2importfoo
#file2.py:
fromfile3importbarasfoo
#file3.py
defbar():
pass
The`jedi#goto_definitions()`functionwilltakeyoutothe"fromfile2importfoo"
statementinfile1.py,whilethe`jedi#goto_definitions()`functionwilltake
youallthewaytothe"defbar():"lineinfile3.py.
5.4.`g:jedi#documentation_command`
*g:jedi#documentation_command*
Function:`jedi#show_documentation()`
Default:<K>
Showpydocdocumentation
Thisshowsthepydocdocumentationfortheitemcurrentlyunderthecursor.
Thedocumentationisopenedinahorizontallysplitbuffer.
5.5.`g:jedi#rename_command`
*g:jedi#rename_command*
Function:`jedi#rename()`
Default:<leader>r
Renamevariables
JedivimdeletesthewordcurrentlyunderthecursorandputsVimininsert
mode,wheretheuserisexpectedtoenterthenewvariablename.Uponleaving
insertmode,jedivimthenrenamesalloccurencesoftheoldvariablename
withthenewone.Thenumberofperformedrenamesisdisplayedinthecommand
line.
5.6.`g:jedi#usages_command`
*g:jedi#usages_command*
Function:`jedi#usages()`
Default:<leader>n
Showusagesofaname.
https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt
4/7
10/4/13
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
5.7.Openmodulebyname
Function:`jedi#py_import(args)`
Default::Pyimport
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
menu.Bydisablingthissetting,completionisonlystartedwhenyoumanually
pressthecompletionkey.
*:Pyimport*
e.g.`:Pyimportos`showsos.pyinVIM.
SimulateanimportandopenthatmoduleinVIM.
==============================================================================
6.Configuration
*jedivimconfiguration*
Note:Youcurrentlyhavetosettheseoptionsinyour.vimrc.Settingthemin
anftplugin(e.g.~/.vim/ftplugin/python/jedivimsettings.vim)willnotwork
becausejedivimisnotsetupasanfiletypeplugin,butasa"regular"
plugin.
6.1.`g:jedi#auto_initialization`
*g:jedi#auto_initialization*
Uponinitialization,jedivimperformsthefollowingsteps:
1.Setthecurrentbuffers'omnifunc'toitsowncompletionfunction
`jedi#complete`
2.Createmappingstocommandsspecifiedin|jedivimmappings|
3.Call`jedi#configure_call_signatures()`if
`g:jedi#show_call_signatures`isset
Youcandisablethedefaultinitializationroutinebysettingthisoptionto
0.Bewarethatyouhavetoperformtheabovestepsyourself,though.
Options:0or1
Default:1(Performautomaticinitialization)
6.2.`g:jedi#auto_vim_configuration` *g:jedi#auto_vim_configuration*
Jedivimsets'completeopt'to`menuone,longest,preview`bydefault.Italso
remaps<CtrlC>to<Esc>ininsertmode.Ifyouwanttokeepyourown
configuration,disablethissetting.
Options:0or1
Default:1(Set'completeopt'andmappingasdescribedabove)
6.3.`g:jedi#popup_on_dot`
*g:jedi#popup_on_dot*
Jedivimautomaticallystartscompletionupontypingaperiodininsertmode.
However,whenworkingwithlargemodules,thiscanslowdownyourtypingflow
sinceyouhavetowaitforjeditoparsethemoduleandshowthecompletion
Options:0or1
Default:1(Startcompletionontypingaperiod)
6.4.`g:jedi#popup_select_first`
*g:jedi#popup_select_first*
Uponstartingcompletion,jedivimcanautomaticallyselectthefirstentry
thatpopsup(withoutactuallyinsertingit).
Thisleadstoabettertypingflow:Asyoutypemorecharacters,theentries
inthecompletionmenuarenarroweddown.Iftheyarenarroweddownenough,
youcanjustpress<Return>toinsertthefirstmatch.
Options:0or1
Default:1(Automaticallyselectfirstcompletionentry)
https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt
5/7
10/4/13
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
Default:1(Automaticallyselectfirstcompletionentry)
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
6.5.`g:jedi#auto_close_doc`
*g:jedi#auto_close_doc*
Whendoingcompletion,jedivimshowsthedocstringofthecurrentlyselected
iteminapreviewwindow.Bydefault,thiswindowisbeingclosedafter
insertionofacompletionitem.
Setthisto1toleavethepreviewwindowopenevenafterleavinginsertmode.
Thiscouldbeusefulifyouwanttobrowselongerdocstrings.
Options:0or1
Default:1(Automaticallyclosepreviewwindowuponleavinginsertmode)
6.6.`g:jedi#show_call_signatures`
*g:jedi#show_call_signatures*
Jedivimcandisplayasmallwindowdetailingtheargumentsofthecurrently
completedfunctionandhighlightingthecurrentlyselectedargument.Thiscan
bedisabledbysettingthisoptionto0.
Options:0or1
Default:1(Showcallsignatureswindow)
Note:Thissettingisignoredif|g:jedi#auto_initialization|issetto0.In
thatcase,ifyouwanttoseecallsignatures,youhavetosetitup
manuallybycallingafunctioninyourconfigurationfile:>
calljedi#configure_call_signatures()
6.7.`g:jedi#use_tabs_not_buffers`
*g:jedi#use_tabs_not_buffers*
Bydefault,jedivimopensanewtabifyouusethe"goto","show
definition",or"relatednames"commands.Whenyousetthisoptionto0,they
openinthecurrentbufferinstead.
Options:0or1
Default:1(Commandoutputisputinanewtab)
6.8.`g:jedi#squelch_py_warning`
*g:jedi#squelch_py_warning*
WhenVimhasnotbeencompiledwith+python,jedivimshowsawarningtothat
effectandabortsloadingitself.Setthisto1tosuppressthatwarning.
Options:0or1
Default:0(Warningisshown)
6.9.`g:jedi#completions_enable`
*g:jedi#completions_enable*
Ifyoudon'twantJedicompletion,butalltheotherfeatures,youcandisable
itinfavorofanothercompletionengine(thatprobablyalsousesJedi,like
YCM).
Options:0or1
Default:1
6.10.`g:jedi#use_splits_not_buffers` *g:jedi#use_splits_not_buffers*
Ifyouwanttoopennewsplitfor"goto",youcouldsetthisoptiontothe
directionwhichyouwanttoopenasplitwith.
Options:top,left,rightorbottom
Default:""(notenabledbydefault)
==============================================================================
7.Testing
*jedivimtesting*
https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt
6/7
10/4/13
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
Thetestsareautomaticallyrunwith`travis
<https://travisci.org/davidhalter/jedivim>`_.
==============================================================================
8.Contributing
*jedivimcontributing*
WelovePullRequests!Readtheinstructionsin`CONTRIBUTING.md`.
==============================================================================
9.License
*jedivimlicense*
JedivimislicensedwiththeMITlicense.
vim:textwidth=78tabstop=8filetype=help:norightleft:
https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt
7/7