ropevim.txt 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. *ropevim.txt* *Ropevim* Rope in VIM
  2. ==============================================================================
  3. CONTENTS *Rope contents*
  4. 1.Refactoring Dialog......................|RopeRefactoringDialog|
  5. 2.Finding Files...........................|RopeFindingFiles|
  6. 3.Code Assist.............................|RopeCodeAssist|
  7. 4.Enabling Autoimport.....................|RopeEnablingAutoimport|
  8. 5.Filtering Resources.....................|RopeFilteringResources|
  9. 6.Finding Occurrences.....................|RopeFindOccurrences|
  10. 7.Dialog Batchset Command.................|RopeDialogBatchsetCommand|
  11. 8.Variables...............................|RopeVariables|
  12. 9.Keybindings.............................|RopeKeys|
  13. ==============================================================================
  14. 1. Refactoring Dialog ~
  15. *RopeRefactoringDialog*
  16. Ropevim refactorings use a special kind of dialog. Depending on the
  17. refactoring, you'll be asked about the essential information a
  18. refactoring needs to know (like the new name in rename refactoring).
  19. Next you'll see the base prompt of a refactoring dialog that shows
  20. something like "Choose what to do". By entering the name of a
  21. refactoring option you can set its value. After setting each option
  22. you'll be returned back to the base prompt. Finally, you can ask rope
  23. to perform, preview or cancel the refactoring.
  24. See |RopeKeys| section and try the refactorings yourself.
  25. ==============================================================================
  26. 2. Finding Files ~
  27. *RopeFindingFiles*
  28. *:RopeFindFile*
  29. *:RopeFindFileOtherWindow*
  30. By using |:RopeFindFile| ("<C-x> p f" by default), you can search for
  31. files in your project. When you complete the minibuffer you'll see
  32. all files in the project; files are shown as their reversed paths.
  33. For instance ``projectroot/docs/todo.txt`` is shown like
  34. ``todo.txt<docs``. This way you can find files faster in your
  35. project. |:RopeFindFileOtherWindow| ("<C-x> p 4 f") opens the
  36. file in the other window.
  37. ==============================================================================
  38. 3. Code Assist ~
  39. *RopeCodeAssist*
  40. *:RopeCodeAssist*
  41. *:RopeLuckyAssist*
  42. *'pymode_rope_vim_completion'*
  43. *'pymode_rope_extended_complete'*
  44. |:RopeCodeAssist| command (<M-/>) will let you select from a list
  45. of completions. |:RopeLuckyAssist| command (<M-?>) does not ask
  46. anything; instead, it inserts the first proposal.
  47. You can tell ropevim to use vim's complete function in insert mode;
  48. Add: >
  49. let pymode_rope_vim_completion=1
  50. <
  51. to your '~/.vimrc' file.
  52. Note:
  53. That when this variable is set, autoimport completions no longer
  54. work since they need to insert an import to the top of the module,
  55. too.
  56. By default autocomplete feature will use plain list of proposed completion
  57. items. You can enable showing extended information about completion
  58. proposals by setting : >
  59. let pymode_rope_extended_complete=1
  60. <
  61. Completion menu list will show the proposed name itself, one letter which
  62. shows where this proposal came from (it can be "L" for locals, "G" for
  63. globals, "B" for builtins, or empty string if such scope definition is not
  64. applicable), a short object type description (such as "func", "param",
  65. "meth" and so forth) and a first line of proposed object's docstring (if it
  66. has one). For function's keyword parameters the last field shows "*" symbol
  67. if this param is required or "= <default value>" if it is not.
  68. ==============================================================================
  69. 4. Enabling Autoimport ~
  70. *RopeEnablingAutoimport*
  71. *:RopevimAutoImport*
  72. *:RopeGenerateAutoimportCache*
  73. Rope can propose and automatically import global names in other
  74. modules. Rope maintains a cache of global names for each project. It
  75. updates the cache only when modules are changed; if you want to cache
  76. all your modules at once, use |:RopeGenerateAutoimportCache|. It
  77. will cache all of the modules inside the project plus those whose
  78. names are listed in |'pymode_rope_autoimport_modules'| list: >
  79. " add the name of modules you want to autoimport
  80. let g:pymode_rope_autoimport_modules = ["os", "shutil"]
  81. <
  82. Now if you are in a buffer that contains: >
  83. rmtree
  84. <
  85. and you execute |:RopevimAutoImport| you'll end up with: >
  86. from shutil import rmtree
  87. rmtree
  88. <
  89. Also |:RopeCodeAssist| and |:RopeLuckyAssist| propose auto-imported
  90. names by using "name : module" style. Selecting them will import
  91. the module automatically.
  92. ==============================================================================
  93. 5. Filtering Resources ~
  94. *RopeFilteringResources*
  95. Some refactorings, restructuring and find occurrences take an option
  96. called resources. This option can be used to limit the resources on
  97. which a refactoring should be applied.
  98. It uses a simple format: each line starts with either '+' or '-'.
  99. Each '+' means include the file (or its children if it's a folder)
  100. that comes after it. '-' has the same meaning for exclusion. So
  101. using: >
  102. +rope
  103. +ropetest
  104. -rope/contrib
  105. <
  106. means include all python files inside ``rope`` and ``ropetest``
  107. folders and their subfolder, but those that are in ``rope/contrib``.
  108. Or: >
  109. -ropetest
  110. -setup.py
  111. <
  112. means include all python files inside the project but ``setup.py`` and
  113. those under ``ropetest`` folder.
  114. ==============================================================================
  115. 6. Finding Occurrences ~
  116. *RopeFindOccurrences*
  117. The find occurrences command ("<C-c> f" by default) can be used to
  118. find the occurrences of a python name. If ``unsure`` option is
  119. ``yes``, it will also show unsure occurrences; unsure occurrences are
  120. indicated with a ``?`` mark in the end.
  121. Note:
  122. That ropevim uses the quickfix feature of vim for
  123. marking occurrence locations.
  124. ==============================================================================
  125. 7. Dialog Batchset Command ~
  126. *RopeDialogBatchsetCommand*
  127. When you use ropevim dialogs there is a command called ``batchset``.
  128. It can set many options at the same time. After selecting this
  129. command from dialog base prompt, you are asked to enter a string.
  130. ``batchset`` strings can set the value of configs in two ways. The
  131. single line form is like this: >
  132. name1 value1
  133. name2 value2
  134. <
  135. That is the name of config is followed its value. For multi-line
  136. values you can use: >
  137. name1
  138. line1
  139. line2
  140. name2
  141. line3
  142. <
  143. Each line of the definition should start with a space or a tab.
  144. Note:
  145. That blank lines before the name of config definitions are ignored.
  146. ``batchset`` command is useful when performing refactorings with long
  147. configs, like restructurings: >
  148. pattern ${pycore}.create_module(${project}.root, ${name})
  149. goal generate.create_module(${project}, ${name})
  150. imports
  151. from rope.contrib import generate
  152. args
  153. pycore: type=rope.base.pycore.PyCore
  154. project: type=rope.base.project.Project
  155. <
  156. .. ignore the two-space indents
  157. This is a valid ``batchset`` string for restructurings.
  158. Just for the sake of completeness, the reverse of the above
  159. restructuring can be: >
  160. pattern ${create_module}(${project}, ${name})
  161. goal ${project}.pycore.create_module(${project}.root, ${name})
  162. args
  163. create_module: name=rope.contrib.generate.create_module
  164. project: type=rope.base.project.Project
  165. <
  166. ==============================================================================
  167. 8. Variables ~
  168. *RopeVariables*
  169. *'pymode_rope_codeassist_maxfixes'* The maximum number of syntax errors
  170. to fix for code assists.
  171. The default value is `1`.
  172. *'pymode_rope_local_prefix'* The prefix for ropevim refactorings.
  173. Defaults to `<C-c> r`.
  174. *'pymode_rope_global_prefix'* The prefix for ropevim project commands
  175. Defaults to `<C-x> p`.
  176. *'pymode_rope_enable_shortcuts'* Shows whether to bind ropevim shortcuts keys.
  177. Defaults to `1`.
  178. *'pymode_rope_guess_project'* If non-zero, ropevim tries to guess and
  179. open the project that contains the file on which
  180. a ropevim command is performed when no project
  181. is already open.
  182. *'pymode_rope_enable_autoimport'* Shows whether to enable autoimport.
  183. *'pymode_rope_autoimport_modules'* The name of modules whose global names should
  184. be cached. |:RopeGenerateAutoimportCache| reads
  185. this list and fills its cache.
  186. *'pymode_rope_autoimport_underlineds'* If set, autoimport will cache names starting
  187. with underlines, too.
  188. *'pymode_rope_goto_def_newwin'* If set, ropevim will open a new buffer
  189. for "go to definition" result if the definition
  190. found is located in another file. By default the
  191. file is open in the same buffer.
  192. Values: '' -- same buffer, 'new' --
  193. horizontally split, 'vnew' --
  194. vertically split
  195. *'pymode_rope_always_show_complete_menu'* If set, rope autocompletion menu
  196. always show.
  197. ==============================================================================
  198. 9. Keybinding ~
  199. *RopeKeys*
  200. Uses almost the same keybinding as ropemacs.
  201. Note:
  202. That global commands have a `<C-x> p` prefix and local commands
  203. have a ``<C-c> r`` prefix.
  204. You can change that (see |RopeVariables| section).
  205. ================ ============================
  206. Key Command
  207. ================ ============================
  208. C-x p o |:RopeOpenProject|
  209. C-x p k |:RopeCloseProject|
  210. C-x p f |:RopeFindFile|
  211. C-x p 4 f |:RopeFindFileOtherWindow|
  212. C-x p u |:RopeUndo|
  213. C-x p r |:RopeRedo|
  214. C-x p c |:RopeProjectConfig|
  215. C-x p n [mpfd] |:RopeCreate|(Module|Package|File|Directory)
  216. |:RopeWriteProject|
  217. C-c r r |:RopeRename|
  218. C-c r l |:RopeExtractVariable|
  219. C-c r m |:RopeExtractMethod|
  220. C-c r i |:RopeInline|
  221. C-c r v |:RopeMove|
  222. C-c r x |:RopeRestructure|
  223. C-c r u |:RopeUseFunction|
  224. C-c r f |:RopeIntroduceFactory|
  225. C-c r s |:RopeChangeSignature|
  226. C-c r 1 r |:RopeRenameCurrentModule|
  227. C-c r 1 v |:RopeMoveCurrentModule|
  228. C-c r 1 p |:RopeModuleToPackage|
  229. C-c r o |:RopeOrganizeImports|
  230. C-c r n [vfcmp] |:RopeGenerate|(Variable|Function|Class|Module|Package)
  231. C-c r a / |:RopeCodeAssist|
  232. C-c r a g |:RopeGotoDefinition|
  233. C-c r a d |:RopeShowDoc|
  234. C-c r a f |:RopeFindOccurrences|
  235. C-c r a ? |:RopeLuckyAssist|
  236. C-c r a j |:RopeJumpToGlobal|
  237. C-c r a c |:RopeShowCalltip|
  238. |:RopeAnalyzeModule|
  239. |:RopeAutoImport|
  240. |:RopeGenerateAutoimportCache|
  241. =============== ============================
  242. ==============================================================================
  243. 10. Shortcuts ~
  244. *RopeShortcuts*
  245. Some commands are used very frequently; specially the commands in
  246. code-assist group. You can define your own shortcuts like this: >
  247. :map <C-c>g :call RopeGotoDefinition()
  248. <
  249. ================ ============================
  250. Key Command
  251. ================ ============================
  252. <C-Space> |:RopeCodeAssist|
  253. <C-?> |:RopeLuckyAssist|
  254. <C-c> g |:RopeGotoDefinition|
  255. <C-c> d |:RopeShowDoc|
  256. <C-c> f |:RopeFindOccurrences|
  257. ================ ============================
  258. ------------------------------------------------------------------------------
  259. vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:ft=help:norl: