Jedi Vim Doc Jedi Vim

Download Jedi Vim Doc Jedi Vim

Post on 26-Oct-2015

110 views

Category:

Documents

4 download

Embed Size (px)

DESCRIPTION

jedi

TRANSCRIPT

<ul><li><p>10/4/13 jedi-vim/doc/jedi-vim.txt at master davidhalter/jedi-vim</p><p>https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt 1/7</p><p>davidhalter6daysagoresolvemergeconflictinauthors</p><p>4contributors </p><p>zennro </p><p>67 910 73Watch Star Forkdavidhalter / jedivimPUBLIC </p><p> masterbranch: jedivim/doc/jedivim.txt </p><p> file 431lines(314sloc) 17.425kb </p><p>123456789</p><p>1011121314151617181920212223242526272829303132</p><p>333435363738394041424344454647484950515253545556</p><p>*jedivim.txt*ForVimversion7.3Lastchange:2013/3/1____________________________.______.~|||____||\||\\//|||\/|~||||__|..|||_____\\//|||\/|~..|||__||||||||______\/||||\/||~|`'|||____|''|||\/||||||~\______/|_______||_______/|__|\__/|__||__||__|~</p><p>jedivimawesomePythonautocompletionwithVim</p><p>==============================================================================Contents *jedivimcontents*</p><p>1.Introduction |jedivimintroduction|2.Installation |jediviminstallation|2.0.Requirements |jediviminstallationrequirements|2.1.Manually |jediviminstallationmanually|2.2.UsingPathogen |jediviminstallationpathogen|2.3.UsingVundle |jediviminstallationvundle|3.SupportedPythonfeatures |jedivimsupport|4.Usage |jedivimusage|5.Mappings |jedivimmappings|5.1.Startcompletion |g:jedi#completions_command|5.2.Gotoassignment |g:jedi#goto_assignments_command|5.3.Getoriginaldefinition |g:jedi#get_definitions_command|5.4.Showdocumentation |g:jedi#documentation_command|5.5.Renamevariables |g:jedi#rename_command|5.6.Shownameusages |g:jedi#usages_command|5.7.Openmodulebyname |:Pyimport|6.Configuration |jedivimconfiguration|6.1.auto_initialization |g:jedi#auto_initialization|6.2.auto_vim_configuration |g:jedi#auto_vim_configuration|</p><p>6.3.popup_on_dot |g:jedi#popup_on_dot|6.4.popup_select_first |g:jedi#popup_select_first|6.5.auto_close_doc |g:jedi#auto_close_doc|6.6.show_call_signatures |g:jedi#show_call_signatures|6.7.use_tabs_not_buffers |g:jedi#use_tabs_not_buffers|6.8.squelch_py_warning |g:jedi#squelch_py_warning|6.9.completions_enable |g:jedi#completions_enable|6.10.use_splits_not_buffers |g:jedi#use_splits_not_buffers|7.Testing |jedivimtesting|8.Contributing |jedivimcontributing|9.License |jedivimlicense|</p><p>==============================================================================1.Introduction *jedivimintroduction*</p><p>JedivimisaisaVimbindingtotheawesomePythonautocompletionlibraryj`edi`.Amongjedi's(and,therefore,jedivim's)featuresare:</p><p>CompletionforawidearrayofPythonfeatures(see|jedivimsupport|)RobustindealingwithsyntaxerrorsandwrongindentationParsescomplexmodule/function/classstructuresInfersfunctionargumentsfromSphinx/Epydocstrings</p><p>Edit Raw Blame History Delete</p><p>Explore Gist Blog HelpSearchortypeacommandThisrepository </p></li><li><p>10/4/13 jedi-vim/doc/jedi-vim.txt at master davidhalter/jedi-vim</p><p>https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt 2/7</p><p>56575859606162636465666768697071727374757677787980</p><p>81828384858687888990919293949596979899</p><p>100101102103104105106107108109110111112113114115116117118119120121122123124125126127</p><p>Doesn'texecutePythoncodeSupportsVirtualenvSupportsPython2.5+and3.2+</p><p>Byleveragingthislibrary,jedivimaddsthefollowingcapabilitiestoVim:</p><p>Displayingfunction/classbodies"Gotodefinition"commandDisplayingdocstringsRenamingandrefactoringLookinguprelatednames</p><p>==============================================================================2.Installation *jediviminstallation*</p><p>2.0.Requirements *jediviminstallationrequirements*</p><p>Firstofall,jedivimrequiresVimtobecompiledwiththe`+python`option.</p><p>Thejedilibraryhastobeinstalledforjedivimtoworkproperly.Youcaninstallitfirst,byusinge.g.yourdistribution'spackagemanager,orbyusingpip:&gt;</p><p>pipinstalljedi</p><p>However,youcanalsoinstallitasagitsubmoduleifyoudon'twanttousejediforanythingbutthisplugin.Howtodothisisdetailedbelow.</p><p>2.1.Installingmanually *jediviminstallationmanually*</p><p>1a.GetthelatestrepositoryfromGithub:&gt;</p><p>gitclonehttp://github.com/davidhalter/jedivimpath/to/bundles/jedivim</p><p>1b.Ifyouwanttoinstalljediasasubmoduleinstead,issuethiscommand:&gt;</p><p>gitclonerecursivehttp://github.com/davidhalter/jedivim</p><p>2.Putthepluginfilesintotheirrespectivefoldersinyourvimruntimedirectory(usually~/.vim).Besuretopayattentiontothedirectorystructure!3.UpdatetheVimhelptagswith&gt;</p><p>:helptags/doc</p><p>2.1.InstallingusingPathogen *jediviminstallationpathogen*</p><p>Pathogensimplifiesinstallationconsiderably.</p><p>1.aClonethegitrepositoryintoyourbundlesdirectory:&gt;</p><p>gitclonehttp://github.com/davidhalter/jedivimpath/to/bundles/jedivim</p><p>1b.Again,ifyouwanttoinstalljediasasubmodule,usethiscommandinstead:&gt;</p><p>gitclonerecursivehttp://github.com/davidhalter/jedivim</p><p>2.3.InstallingusingVundle *jediviminstallationvundle*</p><p>1.Vundleautomaticallydownloadssubrepositoriesasgitsubmodules,soyouwillautomaticallygetthejedilibrarywiththejedivimplugin.AddthefollowingtotheBundlessectioninyour.vimrcfile:&gt;</p><p>Bundle'git://github.com/davidhalter/jedivim'</p><p>2.IssuethefollowingcommandinVim:&gt;</p></li><li><p>10/4/13 jedi-vim/doc/jedi-vim.txt at master davidhalter/jedi-vim</p><p>https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt 3/7</p><p>127128</p><p>129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176</p><p>177178179180181182183184185186187188189190191192193194195196197</p><p>:BundleInstall</p><p>Helptagsaregeneratedautomatically,soyoushouldbegoodtogo.</p><p>==============================================================================3.SupportedPythonfeatures *jedivimsupport*</p><p>TheJedilibrarydoesallthehardworkbehindthescenes.ItsupportscompletionofalargenumberofPythonfeatures,amongthem:</p><p>BuiltinsMultiple`return`sor`yield`sTupleassignments/arrayindexing/dictionaryindexing`with`statement/exceptionhandling`*args`and`**kwargs`Decorators,lambdas,closuresGenerators,iteratorsSomedescriptors:`property`/`staticmethod`/`classmethod`Somemagicmethods:`__call__`,`__iter__`,`__next__`,`__get__`,`__getitem__`,`__init__``list.append()`,`set.add()`,`list.extend()`,etc.(Nested)listcomprehensionsandternaryexpressionsRelative`import`s`getattr()`/`__getattr__`/`__getattribute__`Functionannotations(py3kfeature,arebeingignoredatthemoment,butareparsed)Classdecorators(py3kfeature,arebeingignoredatthemoment,butareparsed)Simple/usual`sys.path`modifications`isinstance`checksfor`if`/`while`/`assert`case,thatdoesntworkwithJediAndmore...</p><p>Note:Thislistisnotnecessarilyuptodate.Foracompletelistoffeatures,pleaserefertotheJedidocumentationathttp://jedi.jedidjah.ch.</p><p>==============================================================================4.Usage *jedivimusage*</p><p>Withthedefaultsettings,autocompletioncanbetriggeredbytyping.Thefirstentrywillautomaticallybeselected,soyoucanpresstoinsertitintoyourcodeorkeeptypingandnarrowdownyourcompletionoptions.Theusualand/keybindingsworkaswell.Autocompletionisalsotriggeredbytypingaperiodininsertmode.SinceperiodsrarelyoccurinPythoncodeoutsideofmethod/importlookups,thisishandytohave(butcanbedisabled).</p><p>Whenitencountersanewmodule,jedimighttakeafewsecondstoparsethatmodule'scontents.Afterwards,thecontentsarecachedandcompletionwillbe</p><p>almostinstantaneous.</p><p>==============================================================================5.KeyBindings *jedivimkeybindings*</p><p>Allkeybindingscanbemappedbysettingtheappropriateglobaloption.Forexample,tosetthekeybindingforstartingomnicompletiontoinsteadof,addthefollowingsettingtoyour.vimrcfile:&gt;</p><p>letg:jedi#completions_command=""</p><p>Note:Ifyouhave|g:jedi#auto_initialization|setto0,youhavetocreateamappingyourselfbycallingafunction:&gt;</p><p>"Usingforomnicompletioninoremap"User(bydefault)forrenamingnnoremapr:calljedi#rename()"etc.</p><p>Note:Youcansetcommandsto'',whichmeansthattheyareemptyandnot</p></li><li><p>10/4/13 jedi-vim/doc/jedi-vim.txt at master davidhalter/jedi-vim</p><p>https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt 4/7</p><p>197198199200201202203204205206207208209210211212213214215216217218219220221222223224</p><p>225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268</p><p>Note:Youcansetcommandsto'',whichmeansthattheyareemptyandnotassigned.It'saneasywayto"disable"functionalityofjedivim.</p><p>5.1.`g:jedi#completions_command` *g:jedi#completions_command*Function:n/aseeaboveDefault: Startcompletion</p><p>Performsautocompletion(oromnicompletion,tobeprecise).</p><p>Note:Ifyouwanttouseforcompletion,pleaseinstallSupertab:https://github.com/ervandew/supertab.</p><p>5.2.`g:jedi#goto_assignments_command`*g:jedi#goto_assignments_command*Function:`jedi#goto_assignments()`Default:g Gotodefinition</p><p>Thisfunctionfindsthefirstdefinitionofthefunction/classunderthecursor.ItproducesanerrorifthedefinitionisnotinaPythonfile.</p><p>5.3.`g:jedi#goto_definitions_command`*g:jedi#goto_definitions_command*Function:`jedi#goto_definitions()`Default:d Gotooriginaldefinition</p><p>Thiscommandtriestofindtheoriginaldefinitionofthefunction/classunderthecursor.Justlikethe`jedi#goto_assignments()`function,itdoesnotwork</p><p>ifthedefinitionisn'tinaPythonsourcefile.</p><p>Thedifferencebetween`jedi#goto_assignments()`and`jedi#goto_definitions()`isthattheformerdoesn'tperformrecursivelookups.Take,forexample,thefollowingmodulestructure:&gt;</p><p>#file1.py:fromfile2importfoo</p><p>#file2.py:fromfile3importbarasfoo</p><p>#file3.pydefbar():pass</p><p>The`jedi#goto_definitions()`functionwilltakeyoutothe"fromfile2importfoo"statementinfile1.py,whilethe`jedi#goto_definitions()`functionwilltakeyouallthewaytothe"defbar():"lineinfile3.py.</p><p>5.4.`g:jedi#documentation_command` *g:jedi#documentation_command*Function:`jedi#show_documentation()`Default: Showpydocdocumentation</p><p>Thisshowsthepydocdocumentationfortheitemcurrentlyunderthecursor.Thedocumentationisopenedinahorizontallysplitbuffer.</p><p>5.5.`g:jedi#rename_command` *g:jedi#rename_command*Function:`jedi#rename()`Default:r Renamevariables</p><p>JedivimdeletesthewordcurrentlyunderthecursorandputsVimininsertmode,wheretheuserisexpectedtoenterthenewvariablename.Uponleavinginsertmode,jedivimthenrenamesalloccurencesoftheoldvariablenamewiththenewone.Thenumberofperformedrenamesisdisplayedinthecommandline.</p><p>5.6.`g:jedi#usages_command` *g:jedi#usages_command*Function:`jedi#usages()`Default:n Showusagesofaname.</p></li><li><p>10/4/13 jedi-vim/doc/jedi-vim.txt at master davidhalter/jedi-vim</p><p>https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt 5/7</p><p>268269270271272</p><p>273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320</p><p>321322323324325326327328329330331332333334335336337338</p><p>Thequickfixwindowispopulatedwithalistofallnameswhichpointtothedefinitionofthenameunderthecursor.</p><p>5.7.Openmodulebyname *:Pyimport*Function:`jedi#py_import(args)`Default::Pyimport e.g.`:Pyimportos`showsos.pyinVIM.</p><p>SimulateanimportandopenthatmoduleinVIM.</p><p>==============================================================================6.Configuration *jedivimconfiguration*</p><p>Note:Youcurrentlyhavetosettheseoptionsinyour.vimrc.Settingtheminanftplugin(e.g.~/.vim/ftplugin/python/jedivimsettings.vim)willnotworkbecausejedivimisnotsetupasanfiletypeplugin,butasa"regular"plugin.</p><p>6.1.`g:jedi#auto_initialization` *g:jedi#auto_initialization*</p><p>Uponinitialization,jedivimperformsthefollowingsteps:</p><p>1.Setthecurrentbuffers'omnifunc'toitsowncompletionfunction`jedi#complete`2.Createmappingstocommandsspecifiedin|jedivimmappings|3.Call`jedi#configure_call_signatures()`if`g:jedi#show_call_signatures`isset</p><p>Youcandisablethedefaultinitializationroutinebysettingthisoptionto0.Bewarethatyouhavetoperformtheabovestepsyourself,though.</p><p>Options:0or1Default:1(Performautomaticinitialization)</p><p>6.2.`g:jedi#auto_vim_configuration` *g:jedi#auto_vim_configuration*</p><p>Jedivimsets'completeopt'to`menuone,longest,preview`bydefault.Italsoremapstoininsertmode.Ifyouwanttokeepyourownconfiguration,disablethissetting.</p><p>Options:0or1Default:1(Set'completeopt'andmappingasdescribedabove)</p><p>6.3.`g:jedi#popup_on_dot` *g:jedi#popup_on_dot*</p><p>Jedivimautomaticallystartscompletionupontypingaperiodininsertmode.</p><p>However,whenworkingwithlargemodules,thiscanslowdownyourtypingflowsinceyouhavetowaitforjeditoparsethemoduleandshowthecompletion</p><p>menu.Bydisablingthissetting,completionisonlystartedwhenyoumanuallypressthecompletionkey.</p><p>Options:0or1Default:1(Startcompletionontypingaperiod)</p><p>6.4.`g:jedi#popup_select_first` *g:jedi#popup_select_first*</p><p>Uponstartingcompletion,jedivimcanautomaticallyselectthefirstentrythatpopsup(withoutactuallyinsertingit).</p><p>Thisleadstoabettertypingflow:Asyoutypemorecharacters,theentriesinthecompletionmenuarenarroweddown.Iftheyarenarroweddownenough,youcanjustpresstoinsertthefirstmatch.</p><p>Options:0or1Default:1(Automaticallyselectfirstcompletionentry)</p></li><li><p>10/4/13 jedi-vim/doc/jedi-vim.txt at master davidhalter/jedi-vim</p><p>https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt 6/7</p><p>338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368</p><p>369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409</p><p>Default:1(Automaticallyselectfirstcompletionentry)</p><p>6.5.`g:jedi#auto_close_doc` *g:jedi#auto_close_doc*</p><p>Whendoingcompletion,jedivimshowsthedocstringofthecurrentlyselectediteminapreviewwindow.Bydefault,thiswindowisbeingclosedafterinsertionofacompletionitem.</p><p>Setthisto1toleavethepreviewwindowopenevenafterleavinginsertmode.Thiscouldbeusefulifyouwanttobrowselongerdocstrings.</p><p>Options:0or1Default:1(Automaticallyclosepreviewwindowuponleavinginsertmode)</p><p>6.6.`g:jedi#show_call_signatures` *g:jedi#show_call_signatures*</p><p>Jedivimcandisplayasmallwindowdetailingtheargumentsofthecurrentlycompletedfunctionandhighlightingthecurrentlyselectedargument.Thiscanbedisabledbysettingthisoptionto0.</p><p>Options:0or1Default:1(Showcallsignatureswindow)</p><p>Note:Thissettingisignoredif|g:jedi#auto_initialization|issetto0.Inthatcase,ifyouwanttoseecallsignatures,youhavetosetitupmanuallybycallingafunctioninyourconfigurationfile:&gt;</p><p>calljedi#configure_call_signatures()</p><p>6.7.`g:jedi#use_tabs_not_buffers` *g:jedi#use_tabs_not_buffers*</p><p>Bydefault,jedivimopensanewtabifyouusethe"goto","showdefinition",or"relatednames"commands.Whenyousetthisoptionto0,theyopeninthecurrentbufferinstead.</p><p>Options:0or1Default:1(Commandoutputisputinanewtab)</p><p>6.8.`g:jedi#squelch_py_warning` *g:jedi#squelch_py_warning*</p><p>WhenVimhasnotbeencompiledwith+python,jedivimshowsawarningtothateffectandabortsloadingitself.Setthisto1tosuppressthatwarning.</p><p>Options:0or1Default:0(Warningisshown)</p><p>6.9.`g:jedi#completions_enable` *g:jedi#completions_enable*</p><p>Ifyoudon'twantJedicompletion,butalltheotherfeatures,youcandisableitinfavorofanothercompletionengine(thatprobablyalsousesJedi,likeYCM).</p><p>Options:0or1Default:1</p><p>6.10.`g:jedi#use_splits_not_buffers` *g:jedi#use_splits_not_buffers*</p><p>Ifyouwanttoopennewsplitfor"goto",youcouldsetthisoptiontothedirectionwhichyouwanttoopenasplitwith.</p><p>Options:top,left,rightorbottomDefault:""(notenabledbydefault)</p><p>==============================================================================7.Testing *jedivimtesting*</p></li><li><p>10/4/13 jedi-vim/doc/jedi-vim.txt at master davidhalter/jedi-vim</p><p>https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi...</p></li></ul>