Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitedb5b3b

Browse files
committed
Merge branch 'release/0.7.4b'
2 parents6acddb2 +efe4bb3 commitedb5b3b

File tree

12 files changed

+410
-251
lines changed

12 files changed

+410
-251
lines changed

‎Changelog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Changelog
22
=========
33

4-
## 2013-12-02 0.7.3b
4+
## 2013-12-02 0.7.4b
55
--------------------
66
* Update indentation support;
77
* Python3 support;

‎autoload/pymode/lint.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ fun! pymode#lint#auto() "{{{
1111
PymodePython from pymodeimport auto
1212
PymodePythonauto()
1313
cclose
14+
callg:PymodeSigns.clear()
1415
edit
1516
callpymode#wide_message("AutoPep8 done.")
1617
endfunction"}}}

‎autoload/pymode/rope.vim

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,11 @@ endfunction
5353

5454

5555
fun!pymode#rope#find_it()
56-
letl:output= []
56+
let loclist=g:PymodeLocList.current()
57+
let loclist._title="Occurrences"
5758
callpymode#wide_message('Finding Occurrences ...')
5859
PymodePython rope.find_it()
59-
callpymode#wide_message('')
60-
if!empty(l:output)
61-
let loclist=g:PymodeLocList.current()
62-
let loclist._loclist=l:output
63-
let loclist._title="Occurrences"
64-
call loclist.show()
65-
end
60+
call loclist.show()
6661
endfunction
6762

6863

‎autoload/pymode/tools/loclist.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fun! g:PymodeLocList.show() "{{{
7474
executemax([min([line("$"),g:pymode_quickfix_maxheight]),g:pymode_quickfix_minheight]) ."wincmd _"
7575
if num!=winnr()
7676
callsetwinvar(winnr(),'quickfix_title',self._title .' <' .self._name .'>')
77-
wincmdp
77+
exe num ."wincmdw"
7878
endif
7979
end
8080
endfunction"}}}

‎doc/pymode.txt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
(__) (__) (__) (_) (_)(_____)(_)\_) (_/\/\_)(_____)(____/(____)~
77

88

9-
Version: 0.7.3b
9+
Version: 0.7.4b
1010

1111
==============================================================================
1212
CONTENTS*pymode-contents*
@@ -358,25 +358,25 @@ Turn on the rope script *'g:pymode_rope'*
358358
*:PymodeRopeRegenerate* -- Regenerate the project cache
359359

360360
Rope uses a folder inside projects for holding project configuration and data.
361-
Its default name is`.ropeproject` If the folder doesnt exists in current
362-
working directory, parent folders will be checked.
361+
Its default name is`.ropeproject`.
363362

364363
Currently it is used for things such as:
365364

366-
*There is aconfig.py file in this folderin which you can change project
367-
configurations. Havelook at the default config.py file (s created when it
365+
*Theconfig.py file in this foldercontains project configuration. Have
366+
alook at the default config.py file (which is created when it
368367
does not exist) for more information.
369368
* It can be used for saving project history, so that the next time you open the
370369
project you can undo past changes.
371-
* It can be usedfor saving objectinformationto help ropeobjectinference.
372-
* It can be usedfor savingglobalnames cache which is usedin auto-import.
370+
* It can be usedto saveinformationaboutobjectinferences.
371+
* It can be usedto save aglobalname cache, which is usedfor auto-import.
373372

374-
If ``.ropeproject`` is not found in the current directory, rope will walk
375-
upwards looking for a ``.ropeproject`` in every dir of the parent path. If
376-
rope finds ``.ropeproject`` in a parent dir, it sets the project for all child
377-
dirs and the scan may be slow for so many dirs and files.
373+
If`.ropeproject` is not found in the current directory, rope will look
374+
recursively for it in parent folders.
375+
Warning: If rope finds`.ropeproject` in a parent dir, it will use it with
376+
all its child directories, which may slow scanning down (because of many,
377+
possibly unrelated, files)
378378

379-
Enablesearch|.ropeproject| in parent's directories
379+
Enablesearching for|.ropeproject| in parent directories
380380
*'g:pymode_rope_lookup_project'*
381381
>
382382
let g:pymode_rope_lookup_project = 1
@@ -385,7 +385,7 @@ Enable search |.ropeproject| in parent's directories
385385
Show documentation for element under cursor~
386386

387387
Show documentation for object under cursor.*'g:pymode_rope_show_doc_bind'*
388-
Leave emptyfor disable key binding.
388+
Leave emptyto disable the key binding.
389389
>
390390
let g:pymode_rope_show_doc_bind = '<C-c>d'
391391
@@ -397,18 +397,18 @@ Regenerate project cache on every save (if file has been modified)
397397
4.1 Completion~
398398
*pymode-completion*
399399

400-
By default youcould typing<Ctrl-Space> for autocompletion. Will be
400+
By default youcan use<Ctrl-Space> for autocompletion. Will be
401401
automatically selected first entry and you can press<Return> to insert in
402402
your code.<C-X><C-O> and<C-P>/<C-N> works too.
403403

404-
Autocompletion is also called by typing a period in|Insert| mode.
404+
Autocompletion is also called by typing a period in|Insert| mode by default.
405405

406406

407407
Turn on code completion support in the plugin*'g:pymode_rope_completion'*
408408
>
409409
let g:pymode_rope_completion = 1
410410
411-
Turn on autocompletion whenyoutyping a period
411+
Turn on autocompletion when typing a period
412412
*'g:pymode_rope_complete_on_dot'*
413413
>
414414
let g:pymode_rope_complete_on_dot = 1
@@ -417,8 +417,8 @@ Keymap for autocomplete *'g:pymode_rope_completion_bind'*
417417
>
418418
let g:pymode_rope_completion_bind = '<C-Space>'
419419
420-
Extended autocompletion (rope could complete objectswich hasnt be imported)
421-
from project*'g:pymode_rope_autoimport'*
420+
Extended autocompletion (rope could complete objectswhich have not been
421+
imported)from project*'g:pymode_rope_autoimport'*
422422
>
423423
let g:pymode_rope_autoimport = 1
424424

‎plugin/pymode.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
" vi:fdl=1
2-
letg:pymode_version="0.7.3b"
2+
letg:pymode_version="0.7.4b"
33

44
com! PymodeVersionechomsg"Current python-mode version:" .g:pymode_version
55
com! PymodeTroubleshootingcallpymode#troubleshooting#test()

‎pymode/environment.py

Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
""" Define interfaces. """
2+
3+
from __future__importprint_function
4+
5+
importvim
6+
importjson
7+
importtime
8+
importos.path
9+
10+
from .utilsimportPY2
11+
12+
13+
classVimPymodeEnviroment(object):
14+
15+
""" Vim User interface. """
16+
17+
prefix='[Pymode]'
18+
19+
def__init__(self):
20+
self.current=vim.current
21+
self.options=dict(encoding=vim.eval('&enc'))
22+
self.options['debug']=self.var('g:pymode_debug',True)
23+
24+
@property
25+
defcurdir(self):
26+
""" Return current working directory. """
27+
28+
returnself.var('getcwd()')
29+
30+
@property
31+
defcurbuf(self):
32+
""" Return current buffer. """
33+
34+
returnself.current.buffer
35+
36+
@property
37+
defcursor(self):
38+
""" Return current window position.
39+
40+
:return tuple: (row, col)
41+
42+
"""
43+
returnself.current.window.cursor
44+
45+
@property
46+
defsource(self):
47+
""" Return source of current buffer. """
48+
49+
return"\n".join(self.lines)
50+
51+
@property
52+
deflines(self):
53+
""" Iterate by lines in current file.
54+
55+
:return list:
56+
57+
"""
58+
ifnotPY2:
59+
returnself.curbuf
60+
61+
return [l.decode(self.options.get('encoding'))forlinself.curbuf]
62+
63+
defvar(self,name,to_bool=False):
64+
""" Get vim variable.
65+
66+
:return vimobj:
67+
68+
"""
69+
70+
value=vim.eval(name)
71+
72+
ifto_bool:
73+
try:
74+
value=bool(int(value))
75+
exceptValueError:
76+
value=value
77+
returnvalue
78+
79+
defmessage(self,msg,history=False):
80+
""" Show message to user. """
81+
82+
ifhistory:
83+
returnvim.command('echom "%s"'%str(msg))
84+
85+
returnvim.command('call pymode#wide_message("%s")'%str(msg))
86+
87+
defuser_input(self,msg,default=''):
88+
""" Return user input or default.
89+
90+
:return str:
91+
92+
"""
93+
msg='%s %s '% (self.prefix,msg)
94+
95+
ifdefault!='':
96+
msg+='[%s] '%default
97+
98+
try:
99+
vim.command('echohl Debug')
100+
input_str=vim.eval('input("%s> ")'%msg)
101+
vim.command('echohl none')
102+
exceptKeyboardInterrupt:
103+
input_str=''
104+
105+
returninput_strordefault
106+
107+
defuser_confirm(self,msg,yes=False):
108+
""" Get user confirmation.
109+
110+
:return bool:
111+
112+
"""
113+
default='yes'ifyeselse'no'
114+
action=self.user_input(msg,default)
115+
returnactionand'yes'.startswith(action)
116+
117+
defuser_input_choices(self,msg,*options):
118+
""" Get one of many options.
119+
120+
:return str: A choosen option
121+
122+
"""
123+
choices= ['%s %s'% (self.prefix,msg)]
124+
choices+= [
125+
"%s. %s"% (num,opt)fornum,optinenumerate(options,1)]
126+
try:
127+
input_str=int(
128+
vim.eval('inputlist(%s)'%self.prepare_value(choices)))
129+
except (KeyboardInterrupt,ValueError):
130+
input_str=0
131+
132+
ifnotinput_str:
133+
self.message('Cancelled!')
134+
returnFalse
135+
136+
try:
137+
returnoptions[input_str-1]
138+
except (IndexError,ValueError):
139+
self.error('Invalid option: %s'%input_str)
140+
returnself.user_input_choices(msg,*options)
141+
142+
deferror(self,msg):
143+
""" Show error to user. """
144+
vim.command('call pymode#error("%s")'%str(msg))
145+
146+
defdebug(self,msg,*args):
147+
""" Print debug information. """
148+
149+
ifself.options.get('debug'):
150+
print("%s %s [%s]"% (
151+
int(time.time()),msg,', '.join([str(a)forainargs])))
152+
153+
defstop(self,value=None):
154+
""" Break Vim function. """
155+
156+
cmd='return'
157+
ifvalue:
158+
cmd+=' '+self.prepare_value(value)
159+
vim.command(cmd)
160+
161+
defcatch_exceptions(self,func):
162+
""" Decorator. Make execution more silence.
163+
164+
:return func:
165+
166+
"""
167+
168+
def_wrapper(*args,**kwargs):
169+
try:
170+
returnfunc(*args,**kwargs)
171+
except (Exception,vim.error)ase:# noqa
172+
ifself.options.get('debug'):
173+
raise
174+
self.error(e)
175+
returnNone
176+
return_wrapper
177+
178+
defrun(self,name,*args):
179+
""" Run vim function. """
180+
181+
vim.command('call %s(%s)'% (name,", ".join([
182+
self.prepare_value(a)forainargs
183+
])))
184+
185+
deflet(self,name,value):
186+
""" Set variable. """
187+
cmd='let %s = %s'% (name,self.prepare_value(value))
188+
self.debug(cmd)
189+
vim.command(cmd)
190+
191+
defprepare_value(self,value):
192+
""" Decode bstr to vim encoding.
193+
194+
:return unicode string:
195+
196+
"""
197+
198+
value=json.dumps(value)
199+
ifPY2:
200+
value=value.decode('utf-8').encode(self.options.get('encoding'))
201+
202+
returnvalue
203+
204+
defget_offset_params(self,cursor=None,base=""):
205+
""" Calculate current offset.
206+
207+
:return tuple: (source, offset)
208+
209+
"""
210+
row,col=cursororenv.cursor
211+
source=""
212+
offset=0
213+
fori,lineinenumerate(self.lines,1):
214+
ifi==row:
215+
source+=line[:col]+base
216+
offset=len(source)
217+
source+=line[col:]
218+
else:
219+
source+=line
220+
source+='\n'
221+
env.debug('Get offset',baseorNone,row,col,offset)
222+
returnsource,offset
223+
224+
defgoto_line(self,line):
225+
""" Go to line. """
226+
227+
vim.command('normal %sggzz'%line)
228+
229+
defgoto_file(self,path,cmd='e',force=False):
230+
""" Function description. """
231+
232+
ifforceoros.path.abspath(path)!=self.curbuf.name:
233+
self.debug('read',path)
234+
vim.command("%s %s"% (cmd,path))
235+
236+
defgoto_buffer(self,bufnr):
237+
""" Open buffer. """
238+
ifstr(bufnr)!='-1':
239+
vim.command('buffer %s'%bufnr)
240+
241+
242+
env=VimPymodeEnviroment()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp