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

Commitaa9d049

Browse files
committed
Prepare to python3 support
1 parent7f9e3ad commitaa9d049

File tree

10 files changed

+45
-41
lines changed

10 files changed

+45
-41
lines changed

‎AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Contributors:
1111
* Denis Kasak (dkasak);
1212
* Steve Losh (sjl);
1313
* nixon;
14+
* lawrenceakka;
1415
* tramchamploo;
1516
* Benjamin Ruston (bruston);
1617
* Robert David Grant (bgrant);

‎autoload/pymode.vim

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ fun! pymode#Default(name, default) "{{{
1212
endfunction"}}}
1313

1414

15-
fun!pymode#Execute(expression)"{{{
16-
" DESC: Execute an expression in the default python interpreter
17-
"
18-
execute'python'.a:expression
19-
endfunction"}}}
20-
21-
2215
fun!pymode#Option(name)"{{{
2316

2417
let name='b:pymode_' .a:name

‎autoload/pymode/breakpoint.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
" Quick set or delete a breakpoints
12
fun!pymode#breakpoint#Set(lnum)"{{{
23
letline=getline(a:lnum)
34
ifstrridx(line,g:pymode_breakpoint_cmd)!=-1
@@ -8,7 +9,7 @@ fun! pymode#breakpoint#Set(lnum) "{{{
89
normalk
910
endif
1011

11-
" Save file
12+
" Save file without any events
1213
if &modifiable&& &modified |noautocmdwrite |endif
1314

1415
endfunction"}}}

‎autoload/pymode/doc.vim

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ fun! pymode#doc#Show(word) "{{{
55
ifa:word==''
66
echoerr"No name/symbol under cursor!"
77
else
8-
callpymode#Execute("import StringIO")
9-
callpymode#Execute("sys.stdout, _ = StringIO.StringIO(), sys.stdout")
10-
callpymode#Execute("help('".a:word."')")
11-
callpymode#Execute("sys.stdout, out = _, sys.stdout.getvalue()")
8+
Pythonimport StringIO
9+
Python sys.stdout, _= StringIO.StringIO(), sys.stdout
10+
Pythonhelp(vim.eval('a:word'))
1211
callpymode#TempBuffer()
13-
callpymode#Execute("vim.current.buffer.append(str(out).splitlines(), 0)")
12+
Pythonvim.current.buffer.append(str(out).splitlines(),0)
1413
wincmdp
1514
endif
1615
endfunction"}}}

‎autoload/pymode/lint.vim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ fun! pymode#lint#Check() "{{{
1414

1515
letg:pymode_lint_buffer=bufnr('%')
1616

17-
callpymode#Execute("from pymode import lint")
18-
callpymode#Execute("lint.check_file()")
17+
Pythonfrom pymodeimport lint
18+
Pythonlint.check_file()
1919

2020
endfunction" }}}
2121

@@ -100,8 +100,8 @@ fun! pymode#lint#Auto() "{{{
100100
return0
101101
endtry
102102
endif
103-
callpymode#Execute("from pymode import auto")
104-
callpymode#Execute("auto.fix_current_file()")
103+
Pythonfrom pymodeimport auto
104+
Pythonauto.fix_current_file()
105105
cclose
106106
edit
107107
callpymode#WideMessage("AutoPep8 done.")

‎autoload/pymode/path.vim

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
fun!pymode#path#Activate(plugin_root)"{{{
2-
3-
python << EOF
4-
import sys,vim, os
5-
6-
curpath=vim.eval("getcwd()")
7-
libpath= os.path.join(vim.eval("a:plugin_root"),'pylibs')
8-
9-
sys.path= [libpath, curpath]+vim.eval("g:pymode_paths")+ sys.path
10-
EOF
11-
12-
endfunction"}}}
1+
fun!pymode#path#Activate(plugin_root)"{{{
2+
3+
Python << EOF
4+
import sys,vim, os
5+
6+
pymode_lib='pylibs'
7+
8+
if sys.version>= (3,0,0):
9+
pymode_lib='pylibs3'
10+
11+
curpath=vim.eval("getcwd()")
12+
libpath= os.path.join(vim.eval("a:plugin_root"), pymode_lib)
13+
14+
sys.path= [libpath, curpath]+vim.eval("g:pymode_paths")+ sys.path
15+
EOF
16+
17+
endfunction"}}}

‎autoload/pymode/queue.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
fun!pymode#queue#Poll()"{{{
22

33
" Check current tasks
4-
callpymode#Execute("from pymode import queue")
5-
callpymode#Execute("queue.check_task()")
4+
Pythonfrom pymodeimport queue
5+
Pythonqueue.check_task()
66

77
" Update interval
88
ifmode()=='i'

‎autoload/pymode/virtualenv.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fun! pymode#virtualenv#Activate() "{{{
1212

1313
calladd(g:pymode_virtualenv_enabled,$VIRTUAL_ENV)
1414

15-
python << EOF
15+
Python << EOF
1616
import sys,vim, os
1717

1818
ve_dir=vim.eval('$VIRTUAL_ENV')

‎ftplugin/python/init-pymode.vim

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if pymode#Default('g:pymode', 1) || !g:pymode
1313
endif
1414

1515
" DESC: Check python support
16-
if!has('python')
16+
if!has('python')&&!has('python3')
1717
letg:pymode_virtualenv=0
1818
letg:pymode_path=0
1919
letg:pymode_lint=0
@@ -23,6 +23,11 @@ if !has('python')
2323
letg:pymode_run=0
2424
endif
2525

26+
ifhas('python')
27+
command! -nargs=1 Pythonpython<args>
28+
elseifhas('python3')
29+
command! -nargs=1 Pythonpython3<args>
30+
end
2631

2732
" Virtualenv {{{
2833

@@ -122,9 +127,9 @@ if !pymode#Default("g:pymode_lint", 1) || g:pymode_lint
122127
letg:pymode_lint_config=expand("<sfile>:p:h:h:h") ."/pylint.ini"
123128
endif
124129

125-
callpymode#Execute("from pymode import queue")
130+
Pythonfrom pymodeimport queue
126131

127-
auVimLeavePre*callpymode#Execute("queue.stop_queue()")
132+
auVimLeavePre*Pythonqueue.stop_queue()
128133

129134
endif
130135

@@ -149,7 +154,7 @@ if !pymode#Default("g:pymode_breakpoint", 1) || g:pymode_breakpoint
149154

150155
if!pymode#Default("g:pymode_breakpoint_cmd","import pdb; pdb.set_trace() # XXX BREAKPOINT")&&has("python")
151156

152-
python << EOF
157+
Python << EOF
153158
fromimpimport find_module
154159

155160
for modulein ('pudb','ipdb'):
@@ -244,7 +249,7 @@ if !pymode#Default("g:pymode_rope", 1) || g:pymode_rope
244249
callpymode#Default("g:pymode_rope_always_show_complete_menu",0)
245250

246251
" DESC: Init Rope
247-
callpymode#Execute("import ropevim")
252+
Pythonimport ropevim
248253

249254
fun!RopeCodeAssistInsertMode()"{{{
250255
callRopeCodeAssist()
@@ -255,7 +260,7 @@ if !pymode#Default("g:pymode_rope", 1) || g:pymode_rope
255260
ifisdirectory(getcwd() .'/.ropeproject')
256261
" In order to pass it the quiet kwarg I need to open the project
257262
" using python and not vim, which should be no major issue
258-
callpymode#Execute("ropevim._interface.open_project(quiet=True)")
263+
Pythonropevim._interface.open_project(quiet=True)
259264
return""
260265
endif
261266
endfunction"}}}
@@ -267,7 +272,7 @@ if !pymode#Default("g:pymode_rope", 1) || g:pymode_rope
267272

268273
fun!RopeOmni(findstart, base)"{{{
269274
ifa:findstart
270-
callpymode#Execute("ropevim._interface._find_start()")
275+
Pythonropevim._interface._find_start()
271276
returng:pymode_offset
272277
else
273278
callRopeOmniComplete()

‎ftplugin/python/pymode.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
runtime ftplugin/python/init-pymode.vim
22

3-
ifpymode#Default('g:pymode',1)||!g:pymode
3+
if!g:pymode
44
finish
55
endif
66

@@ -76,7 +76,7 @@ if pymode#Option('lint')
7676
" DESC: Run queue
7777
let &l:updatetime=g:pymode_updatetime
7878
auCursorHold<buffer>callpymode#queue#Poll()
79-
auBufLeave<buffer>callpymode#Execute("queue.stop_queue()")
79+
auBufLeave<buffer>Pythonqueue.stop_queue()
8080

8181
endif
8282

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp