-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathropevim.txt
347 lines (264 loc) · 13.1 KB
/
ropevim.txt
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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
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
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
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
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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
*ropevim.rst* *Ropevim* Rope in VIM
Note: this documentation is pulled from different project and perhaps we
haven’t find all issues yet. Please, if you see something wrong, file a ticket
to https://github.com/python-rope/ropevim/issues issue tracker. Thank you!
==============================================================================
CONTENTS *Rope contents*
1.Refactoring Dialog......................|RopeRefactoringDialog|
2.Finding Files...........................|RopeFindingFiles|
3.Code Assist.............................|RopeCodeAssist|
4.Enabling Autoimport.....................|RopeEnablingAutoimport|
5.Filtering Resources.....................|RopeFilteringResources|
6.Finding Occurrences.....................|RopeFindOccurrences|
7.Dialog Batchset Command.................|RopeDialogBatchsetCommand|
8.Variables...............................|RopeVariables|
9.Keybindings.............................|RopeKeys|
==============================================================================
1. Refactoring Dialog ~
*RopeRefactoringDialog*
Ropevim refactorings use a special kind of dialog. Depending on the
refactoring, you'll be asked about the essential information a
refactoring needs to know (like the new name in rename refactoring).
Next you'll see the base prompt of a refactoring dialog that shows
something like "Choose what to do". By entering the name of a
refactoring option you can set its value. After setting each option
you'll be returned back to the base prompt. Finally, you can ask rope
to perform, preview or cancel the refactoring.
See |RopeKeys| section and try the refactorings yourself.
==============================================================================
2. Finding Files ~
*RopeFindingFiles*
*:RopeFindFile*
*:RopeFindFileOtherWindow*
By using |:RopeFindFile| ("<C-x> p f" by default), you can search for
files in your project. When you complete the minibuffer you'll see
all files in the project; files are shown as their reversed paths.
For instance ``projectroot/docs/todo.txt`` is shown like
``todo.txt<docs``. This way you can find files faster in your
project. |:RopeFindFileOtherWindow| ("<C-x> p 4 f") opens the
file in the other window.
==============================================================================
3. Code Assist ~
*RopeCodeAssist*
*:RopeCodeAssist*
*:RopeLuckyAssist*
*'ropevim_vim_completion'*
*'ropevim_extended_complete'*
|:RopeCodeAssist| command (<C-Space>) will let you select from a list
of completions. |:RopeLuckyAssist| command (<C-?>) does not ask
anything; instead, it inserts the first proposal.
You can tell ropevim to use vim's complete function in insert mode;
Add: >
let ropevim_vim_completion=1
<
to your '~/.vimrc' file.
Note:
That when this variable is set, autoimport completions no longer
work since they need to insert an import to the top of the module,
too.
By default autocomplete feature will use plain list of proposed completion
items. You can enable showing extended information about completion
proposals by setting : >
let ropevim_extended_complete=1
<
Completion menu list will show the proposed name itself, one letter which
shows where this proposal came from (it can be "L" for locals, "G" for
globals, "B" for builtins, or empty string if such scope definition is not
applicable), a short object type description (such as "func", "param",
"meth" and so forth) and a first line of proposed object's docstring (if it
has one). For function's keyword parameters the last field shows "*" symbol
if this param is required or "= <default value>" if it is not.
==============================================================================
4. Enabling Autoimport ~
*RopeEnablingAutoimport*
*:RopeAutoImport*
*:RopeGenerateAutoimportCache*
Rope can propose and automatically import global names in other
modules. Rope maintains a cache of global names for each project. It
updates the cache only when modules are changed; if you want to cache
all your modules at once, use |:RopeGenerateAutoimportCache|. It
will cache all of the modules inside the project plus those whose
names are listed in |'ropevim_autoimport_modules'| list: >
" add the name of modules you want to autoimport
let g:ropevim_autoimport_modules = ["os", "shutil"]
<
Now if you are in a buffer that contains: >
rmtree
<
and you execute |:RopeAutoImport| you'll end up with: >
from shutil import rmtree
rmtree
<
Also |:RopeCodeAssist| and |:RopeLuckyAssist| propose auto-imported
names by using "name : module" style. Selecting them will import
the module automatically.
==============================================================================
5. Filtering Resources ~
*RopeFilteringResources*
Some refactorings, restructuring and find occurrences take an option
called resources. This option can be used to limit the resources on
which a refactoring should be applied.
It uses a simple format: each line starts with either '+' or '-'.
Each '+' means include the file (or its children if it's a folder)
that comes after it. '-' has the same meaning for exclusion. So
using: >
+rope
+ropetest
-rope/contrib
<
means include all python files inside ``rope`` and ``ropetest``
folders and their subfolder, but those that are in ``rope/contrib``.
Or: >
-ropetest
-setup.py
<
means include all python files inside the project but ``setup.py`` and
those under ``ropetest`` folder.
==============================================================================
6. Finding Occurrences ~
*RopeFindOccurrences*
The find occurrences command ("<C-c> f" by default) can be used to
find the occurrences of a python name. If ``unsure`` option is
``yes``, it will also show unsure occurrences; unsure occurrences are
indicated with a ``?`` mark in the end.
Note:
That ropevim uses the quickfix feature of vim for
marking occurrence locations.
==============================================================================
7. Dialog Batchset Command ~
*RopeDialogBatchsetCommand*
When you use ropevim dialogs there is a command called ``batchset``.
It can set many options at the same time. After selecting this
command from dialog base prompt, you are asked to enter a string.
``batchset`` strings can set the value of configs in two ways. The
single line form is like this: >
name1 value1
name2 value2
<
That is the name of config is followed its value. For multi-line
values you can use: >
name1
line1
line2
name2
line3
<
Each line of the definition should start with a space or a tab.
Note:
That blank lines before the name of config definitions are ignored.
``batchset`` command is useful when performing refactorings with long
configs, like restructurings: >
pattern ${pycore}.create_module(${project}.root, ${name})
goal generate.create_module(${project}, ${name})
imports
from rope.contrib import generate
args
pycore: type=rope.base.pycore.PyCore
project: type=rope.base.project.Project
<
.. ignore the two-space indents
This is a valid ``batchset`` string for restructurings.
Just for the sake of completeness, the reverse of the above
restructuring can be: >
pattern ${create_module}(${project}, ${name})
goal ${project}.pycore.create_module(${project}.root, ${name})
args
create_module: name=rope.contrib.generate.create_module
project: type=rope.base.project.Project
<
==============================================================================
8. Variables ~
*RopeVariables*
*'ropevim_codeassist_maxfixes'* The maximum number of syntax errors
to fix for code assists.
The default value is `1`.
*'ropevim_local_prefix'* The prefix for ropevim refactorings.
Defaults to `<C-c> r`.
*'ropevim_global_prefix'* The prefix for ropevim project commands
Defaults to `<C-x> p`.
*'ropevim_enable_shortcuts'* Shows whether to bind ropevim shortcuts keys.
Defaults to `1`.
*'ropevim_guess_project'* If non-zero, ropevim tries to guess and
open the project that contains the file on which
a ropevim command is performed when no project
is already open.
*'ropevim_enable_autoimport'* Shows whether to enable autoimport.
*'ropevim_autoimport_modules'* The name of modules whose global names should
be cached. |:RopeGenerateAutoimportCache| reads
this list and fills its cache.
*'ropevim_autoimport_underlineds'* If set, autoimport will cache names starting
with underlines, too.
*'ropevim_goto_def_newwin'* If set, ropevim will open a new buffer
for "go to definition" result if the definition
found is located in another file. By default the
file is open in the same buffer.
Values: '' -- same buffer, 'new' --
horizontally split, 'vnew' --
vertically split
*'ropevim_open_files_in_tabs'* If non-zero, ropevim will open files in tabs.
This is disabled by default, and it is now
*deprecated* in favor of
'ropevim_goto_def_newwin' set to 'tabnew'.
==============================================================================
9. Keybinding ~
*RopeKeys*
Uses almost the same keybinding as ropemacs.
Note:
That global commands have a `<C-x> p` prefix and local commands
have a ``<C-c> r`` prefix.
You can change that (see |RopeVariables| section).
================ ============================
Key Command
================ ============================
C-x p o |:RopeOpenProject|
C-x p k |:RopeCloseProject|
C-x p f |:RopeFindFile|
C-x p 4 f |:RopeFindFileOtherWindow|
C-x p u |:RopeUndo|
C-x p r |:RopeRedo|
C-x p c |:RopeProjectConfig|
C-x p n [mpfd] |:RopeCreate|(Module|Package|File|Directory)
|:RopeWriteProject|
C-c r r |:RopeRename|
C-c r l |:RopeExtractVariable|
C-c r m |:RopeExtractMethod|
C-c r i |:RopeInline|
C-c r v |:RopeMove|
C-c r x |:RopeRestructure|
C-c r u |:RopeUseFunction|
C-c r f |:RopeIntroduceFactory|
C-c r s |:RopeChangeSignature|
C-c r 1 r |:RopeRenameCurrentModule|
C-c r 1 v |:RopeMoveCurrentModule|
C-c r 1 p |:RopeModuleToPackage|
C-c r o |:RopeOrganizeImports|
C-c r n [vfcmp] |:RopeGenerate|(Variable|Function|Class|Module|Package)
C-c r a / |:RopeCodeAssist|
C-c r a g |:RopeGotoDefinition|
C-c r a d |:RopeShowDoc|
C-c r a f |:RopeFindOccurrences|
C-c r a ? |:RopeLuckyAssist|
C-c r a j |:RopeJumpToGlobal|
C-c r a c |:RopeShowCalltip|
|:RopeAnalyzeModule|
|:RopeAutoImport|
|:RopeGenerateAutoimportCache|
=============== ============================
==============================================================================
10. Shortcuts ~
*RopeShortcuts*
Some commands are used very frequently; specially the commands in
code-assist group. You can define your own shortcuts like this: >
:noremap <C-c>g :call RopeGotoDefinition()
<
================ ============================
Key Command
================ ============================
<C-Space> |:RopeCodeAssist|
<C-?> |:RopeLuckyAssist|
<C-c> g |:RopeGotoDefinition|
<C-c> d |:RopeShowDoc|
<C-c> f |:RopeFindOccurrences|
================ ============================
------------------------------------------------------------------------------
vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:ft=help:norl: