Jedi Vim Doc Jedi Vim

Download Jedi Vim Doc Jedi Vim

Post on 26-Oct-2015

107 views

Category:

Documents

4 download

DESCRIPTION

jedi

TRANSCRIPT

  • 10/4/13 jedi-vim/doc/jedi-vim.txt at master davidhalter/jedi-vim

    https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt 1/7

    davidhalter6daysagoresolvemergeconflictinauthors

    4contributors

    zennro

    67 910 73Watch Star Forkdavidhalter / jedivimPUBLIC

    masterbranch: jedivim/doc/jedivim.txt

    file 431lines(314sloc) 17.425kb

    123456789

    1011121314151617181920212223242526272829303132

    333435363738394041424344454647484950515253545556

    *jedivim.txt*ForVimversion7.3Lastchange:2013/3/1____________________________.______.~|||____||\||\\//|||\/|~||||__|..|||_____\\//|||\/|~..|||__||||||||______\/||||\/||~|`'|||____|''|||\/||||||~\______/|_______||_______/|__|\__/|__||__||__|~

    jedivimawesomePythonautocompletionwithVim

    ==============================================================================Contents *jedivimcontents*

    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|

    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|

    ==============================================================================1.Introduction *jedivimintroduction*

    JedivimisaisaVimbindingtotheawesomePythonautocompletionlibraryj`edi`.Amongjedi's(and,therefore,jedivim's)featuresare:

    CompletionforawidearrayofPythonfeatures(see|jedivimsupport|)RobustindealingwithsyntaxerrorsandwrongindentationParsescomplexmodule/function/classstructuresInfersfunctionargumentsfromSphinx/Epydocstrings

    Edit Raw Blame History Delete

    Explore Gist Blog HelpSearchortypeacommandThisrepository

  • 10/4/13 jedi-vim/doc/jedi-vim.txt at master davidhalter/jedi-vim

    https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt 2/7

    56575859606162636465666768697071727374757677787980

    81828384858687888990919293949596979899

    100101102103104105106107108109110111112113114115116117118119120121122123124125126127

    Doesn'texecutePythoncodeSupportsVirtualenvSupportsPython2.5+and3.2+

    Byleveragingthislibrary,jedivimaddsthefollowingcapabilitiestoVim:

    Displayingfunction/classbodies"Gotodefinition"commandDisplayingdocstringsRenamingandrefactoringLookinguprelatednames

    ==============================================================================2.Installation *jediviminstallation*

    2.0.Requirements *jediviminstallationrequirements*

    Firstofall,jedivimrequiresVimtobecompiledwiththe`+python`option.

    Thejedilibraryhastobeinstalledforjedivimtoworkproperly.Youcaninstallitfirst,byusinge.g.yourdistribution'spackagemanager,orbyusingpip:>

    pipinstalljedi

    However,youcanalsoinstallitasagitsubmoduleifyoudon'twanttousejediforanythingbutthisplugin.Howtodothisisdetailedbelow.

    2.1.Installingmanually *jediviminstallationmanually*

    1a.GetthelatestrepositoryfromGithub:>

    gitclonehttp://github.com/davidhalter/jedivimpath/to/bundles/jedivim

    1b.Ifyouwanttoinstalljediasasubmoduleinstead,issuethiscommand:>

    gitclonerecursivehttp://github.com/davidhalter/jedivim

    2.Putthepluginfilesintotheirrespectivefoldersinyourvimruntimedirectory(usually~/.vim).Besuretopayattentiontothedirectorystructure!3.UpdatetheVimhelptagswith>

    :helptags/doc

    2.1.InstallingusingPathogen *jediviminstallationpathogen*

    Pathogensimplifiesinstallationconsiderably.

    1.aClonethegitrepositoryintoyourbundlesdirectory:>

    gitclonehttp://github.com/davidhalter/jedivimpath/to/bundles/jedivim

    1b.Again,ifyouwanttoinstalljediasasubmodule,usethiscommandinstead:>

    gitclonerecursivehttp://github.com/davidhalter/jedivim

    2.3.InstallingusingVundle *jediviminstallationvundle*

    1.Vundleautomaticallydownloadssubrepositoriesasgitsubmodules,soyouwillautomaticallygetthejedilibrarywiththejedivimplugin.AddthefollowingtotheBundlessectioninyour.vimrcfile:>

    Bundle'git://github.com/davidhalter/jedivim'

    2.IssuethefollowingcommandinVim:>

  • 10/4/13 jedi-vim/doc/jedi-vim.txt at master davidhalter/jedi-vim

    https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt 3/7

    127128

    129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176

    177178179180181182183184185186187188189190191192193194195196197

    :BundleInstall

    Helptagsaregeneratedautomatically,soyoushouldbegoodtogo.

    ==============================================================================3.SupportedPythonfeatures *jedivimsupport*

    TheJedilibrarydoesallthehardworkbehindthescenes.ItsupportscompletionofalargenumberofPythonfeatures,amongthem:

    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...

    Note:Thislistisnotnecessarilyuptodate.Foracompletelistoffeatures,pleaserefertotheJedidocumentationathttp://jedi.jedidjah.ch.

    ==============================================================================4.Usage *jedivimusage*

    Withthedefaultsettings,autocompletioncanbetriggeredbytyping.Thefirstentrywillautomaticallybeselected,soyoucanpresstoinsertitintoyourcodeorkeeptypingandnarrowdownyourcompletionoptions.Theusualand/keybindingsworkaswell.Autocompletionisalsotriggeredbytypingaperiodininsertmode.SinceperiodsrarelyoccurinPythoncodeoutsideofmethod/importlookups,thisishandytohave(butcanbedisabled).

    Whenitencountersanewmodule,jedimighttakeafewsecondstoparsethatmodule'scontents.Afterwards,thecontentsarecachedandcompletionwillbe

    almostinstantaneous.

    ==============================================================================5.KeyBindings *jedivimkeybindings*

    Allkeybindingscanbemappedbysettingtheappropriateglobaloption.Forexample,tosetthekeybindingforstartingomnicompletiontoinsteadof,addthefollowingsettingtoyour.vimrcfile:>

    letg:jedi#completions_command=""

    Note:Ifyouhave|g:jedi#auto_initialization|setto0,youhavetocreateamappingyourselfbycallingafunction:>

    "Usingforomnicompletioninoremap"User(bydefault)forrenamingnnoremapr:calljedi#rename()"etc.

    Note:Youcansetcommandsto'',whichmeansthattheyareemptyandnot

  • 10/4/13 jedi-vim/doc/jedi-vim.txt at master davidhalter/jedi-vim

    https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt 4/7

    197198199200201202203204205206207208209210211212213214215216217218219220221222223224

    225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268

    Note:Youcansetcommandsto'',whichmeansthattheyareemptyandnotassigned.It'saneasywayto"disable"functionalityofjedivim.

    5.1.`g:jedi#completions_command` *g:jedi#completions_command*Function:n/aseeaboveDefault: Startcompletion

    Performsautocompletion(oromnicompletion,tobeprecise).

    Note:Ifyouwanttouseforcompletion,pleaseinstallSupertab:https://github.com/ervandew/supertab.

    5.2.`g:jedi#goto_assignments_command`*g:jedi#goto_assignments_command*Function:`jedi#goto_assignments()`Default:g Gotodefinition

    Thisfunctionfindsthefirstdefinitionofthefunction/classunderthecursor.ItproducesanerrorifthedefinitionisnotinaPythonfile.

    5.3.`g:jedi#goto_definitions_command`*g:jedi#goto_definitions_command*Function:`jedi#goto_definitions()`Default:d Gotooriginaldefinition

    Thiscommandtriestofindtheoriginaldefinitionofthefunction/classunderthecursor.Justlikethe`jedi#goto_assignments()`function,itdoesnotwork

    ifthedefinitionisn'tinaPythonsourcefile.

    Thedifferencebetween`jedi#goto_assignments()`and`jedi#goto_definitions()`isthattheformerdoesn'tperformrecursivelookups.Take,forexample,thefollowingmodulestructure:>

    #file1.py:fromfile2importfoo

    #file2.py:fromfile3importbarasfoo

    #file3.pydefbar():pass

    The`jedi#goto_definitions()`functionwilltakeyoutothe"fromfile2importfoo"statementinfile1.py,whilethe`jedi#goto_definitions()`functionwilltakeyouallthewaytothe"defbar():"lineinfile3.py.

    5.4.`g:jedi#documentation_command` *g:jedi#documentation_command*Function:`jedi#show_documentation()`Default: Showpydocdocumentation

    Thisshowsthepydocdocumentationfortheitemcurrentlyunderthecursor.Thedocumentationisopenedinahorizontallysplitbuffer.

    5.5.`g:jedi#rename_command` *g:jedi#rename_command*Function:`jedi#rename()`Default:r Renamevariables

    JedivimdeletesthewordcurrentlyunderthecursorandputsVimininsertmode,wheretheuserisexpectedtoenterthenewvariablename.Uponleavinginsertmode,jedivimthenrenamesalloccurencesoftheoldvariablenamewiththenewone.Thenumberofperformedrenamesisdisplayedinthecommandline.

    5.6.`g:jedi#usages_command` *g:jedi#usages_command*Function:`jedi#usages()`Default:n Showusagesofaname.

  • 10/4/13 jedi-vim/doc/jedi-vim.txt at master davidhalter/jedi-vim

    https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt 5/7

    268269270271272

    273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320

    321322323324325326327328329330331332333334335336337338

    Thequickfixwindowispopulatedwithalistofallnameswhichpointtothedefinitionofthenameunderthecursor.

    5.7.Openmodulebyname *:Pyimport*Function:`jedi#py_import(args)`Default::Pyimport e.g.`:Pyimportos`showsos.pyinVIM.

    SimulateanimportandopenthatmoduleinVIM.

    ==============================================================================6.Configuration *jedivimconfiguration*

    Note:Youcurrentlyhavetosettheseoptionsinyour.vimrc.Settingtheminanftplugin(e.g.~/.vim/ftplugin/python/jedivimsettings.vim)willnotworkbecausejedivimisnotsetupasanfiletypeplugin,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

    Youcandisablethedefaultinitializationroutinebysettingthisoptionto0.Bewarethatyouhavetoperformtheabovestepsyourself,though.

    Options:0or1Default:1(Performautomaticinitialization)

    6.2.`g:jedi#auto_vim_configuration` *g:jedi#auto_vim_configuration*

    Jedivimsets'completeopt'to`menuone,longest,preview`bydefault.Italsoremapstoininsertmode.Ifyouwanttokeepyourownconfiguration,disablethissetting.

    Options:0or1Default:1(Set'completeopt'andmappingasdescribedabove)

    6.3.`g:jedi#popup_on_dot` *g:jedi#popup_on_dot*

    Jedivimautomaticallystartscompletionupontypingaperiodininsertmode.

    However,whenworkingwithlargemodules,thiscanslowdownyourtypingflowsinceyouhavetowaitforjeditoparsethemoduleandshowthecompletion

    menu.Bydisablingthissetting,completionisonlystartedwhenyoumanuallypressthecompletionkey.

    Options:0or1Default:1(Startcompletionontypingaperiod)

    6.4.`g:jedi#popup_select_first` *g:jedi#popup_select_first*

    Uponstartingcompletion,jedivimcanautomaticallyselectthefirstentrythatpopsup(withoutactuallyinsertingit).

    Thisleadstoabettertypingflow:Asyoutypemorecharacters,theentriesinthecompletionmenuarenarroweddown.Iftheyarenarroweddownenough,youcanjustpresstoinsertthefirstmatch.

    Options:0or1Default:1(Automaticallyselectfirstcompletionentry)

  • 10/4/13 jedi-vim/doc/jedi-vim.txt at master davidhalter/jedi-vim

    https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt 6/7

    338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368

    369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409

    Default:1(Automaticallyselectfirstcompletionentry)

    6.5.`g:jedi#auto_close_doc` *g:jedi#auto_close_doc*

    Whendoingcompletion,jedivimshowsthedocstringofthecurrentlyselectediteminapreviewwindow.Bydefault,thiswindowisbeingclosedafterinsertionofacompletionitem.

    Setthisto1toleavethepreviewwindowopenevenafterleavinginsertmode.Thiscouldbeusefulifyouwanttobrowselongerdocstrings.

    Options:0or1Default:1(Automaticallyclosepreviewwindowuponleavinginsertmode)

    6.6.`g:jedi#show_call_signatures` *g:jedi#show_call_signatures*

    Jedivimcandisplayasmallwindowdetailingtheargumentsofthecurrentlycompletedfunctionandhighlightingthecurrentlyselectedargument.Thiscanbedisabledbysettingthisoptionto0.

    Options:0or1Default:1(Showcallsignatureswindow)

    Note:Thissettingisignoredif|g:jedi#auto_initialization|issetto0.Inthatcase,ifyouwanttoseecallsignatures,youhavetosetitupmanuallybycallingafunctioninyourconfigurationfile:>

    calljedi#configure_call_signatures()

    6.7.`g:jedi#use_tabs_not_buffers` *g:jedi#use_tabs_not_buffers*

    Bydefault,jedivimopensanewtabifyouusethe"goto","showdefinition",or"relatednames"commands.Whenyousetthisoptionto0,theyopeninthecurrentbufferinstead.

    Options:0or1Default:1(Commandoutputisputinanewtab)

    6.8.`g:jedi#squelch_py_warning` *g:jedi#squelch_py_warning*

    WhenVimhasnotbeencompiledwith+python,jedivimshowsawarningtothateffectandabortsloadingitself.Setthisto1tosuppressthatwarning.

    Options:0or1Default:0(Warningisshown)

    6.9.`g:jedi#completions_enable` *g:jedi#completions_enable*

    Ifyoudon'twantJedicompletion,butalltheotherfeatures,youcandisableitinfavorofanothercompletionengine(thatprobablyalsousesJedi,likeYCM).

    Options:0or1Default:1

    6.10.`g:jedi#use_splits_not_buffers` *g:jedi#use_splits_not_buffers*

    Ifyouwanttoopennewsplitfor"goto",youcouldsetthisoptiontothedirectionwhichyouwanttoopenasplitwith.

    Options:top,left,rightorbottomDefault:""(notenabledbydefault)

    ==============================================================================7.Testing *jedivimtesting*

  • 10/4/13 jedi-vim/doc/jedi-vim.txt at master davidhalter/jedi-vim

    https://github.com/davidhalter/jedi-vim/blob/master/doc/jedi-vim.txt 7/7

    409410411412413414415416

    417418419420421422423424425426427428429430

    jedivimisbeingtestedwithacombinationofvspechttps://github.com/kana/vimvspecandpy.testhttp://pytest.org/.

    Thetestsareinthetestsubdirectory,youcanrunthemcalling::

    py.test

    Thetestsareautomaticallyrunwith`travis`_.

    ==============================================================================8.Contributing *jedivimcontributing*

    WelovePullRequests!Readtheinstructionsin`CONTRIBUTING.md`.

    ==============================================================================9.License *jedivimlicense*

    JedivimislicensedwiththeMITlicense.

    vim:textwidth=78tabstop=8filetype=help:norightleft:

    Status API Training Shop Blog About2013GitHub,Inc. Terms Privacy Security Contact

Recommended

View more >