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

Commit16c0a71

Browse files
committed
Working on 1.0.0
1 parentba984dd commit16c0a71

File tree

276 files changed

+19576
-3906
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+19576
-3906
lines changed

‎.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
.vimrc
99
Gemfile.lock
1010
VimFlavor.lock
11+
_
1112
tags
1213
test.py
1314
todo.txt

‎Changelog.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
Changelog
22
=========
33

4+
## 2013-??-??
5+
-------------
6+
* Update indentation support
7+
* Python3 support
8+
* Variables changes:
9+
'pymode_run_key' -> 'pymode_run_bind'
10+
'pymode_lint_write' -> 'pymode_lint_on_write'
11+
'pymode_lint_onfly' -> 'pymode_lint_on_fly'
12+
'pymode_lint_message' -> 'pymode_lint_status'
13+
'pymode_lint_checker' -> 'pymode_lint_checkers'
14+
415
## 2013-10-29 0.6.19
516
--------------------
617
* Added `g:pymode_rope_autocomplete_map` option;

‎Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ clean:
44

55
.PHONY: test
66
test:
7+
bundle install
78
raketest
89

910
.PHONY: pylama

‎after/ftplugin/python.vim

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,49 @@
1-
" Fix omnifunc
2-
ifg:pymode&&g:pymode_rope&&g:pymode_rope_vim_completion
3-
setlocalomnifunc=RopeOmni
1+
if!g:pymode
2+
finish
43
endif
54

6-
" Motion {{{
7-
8-
if!pymode#Default('g:pymode_motion',1)||g:pymode_motion
9-
10-
nnoremap<buffer>]]:<C-U>call pymode#motion#move('^\(class\\|def\)\s', '')<CR>
11-
nnoremap<buffer>[[:<C-U>call pymode#motion#move('^\(class\\|def\)\s', 'b')<CR>
12-
nnoremap<buffer>]C:<C-U>call pymode#motion#move('^\(class\\|def\)\s', '')<CR>
13-
nnoremap<buffer>[C:<C-U>call pymode#motion#move('^\(class\\|def\)\s', 'b')<CR>
14-
nnoremap<buffer>]M:<C-U>call pymode#motion#move('^\s*def\s', '')<CR>
15-
nnoremap<buffer>[M:<C-U>call pymode#motion#move('^\s*def\s', 'b')<CR>
16-
17-
onoremap<buffer>]]:<C-U>call pymode#motion#move('^\(class\\|def\)\s', '')<CR>
18-
onoremap<buffer>[[:<C-U>call pymode#motion#move('^\(class\\|def\)\s', 'b')<CR>
19-
onoremap<buffer>]C:<C-U>call pymode#motion#move('^\(class\\|def\)\s', '')<CR>
20-
onoremap<buffer>[C:<C-U>call pymode#motion#move('^\(class\\|def\)\s', 'b')<CR>
21-
onoremap<buffer>]M:<C-U>call pymode#motion#move('^\s*def\s', '')<CR>
22-
onoremap<buffer>[M:<C-U>call pymode#motion#move('^\s*def\s', 'b')<CR>
23-
24-
vnoremap<buffer>]]:call pymode#motion#vmove('^\(class\\|def\)\s', '')<CR>
25-
vnoremap<buffer>[[:call pymode#motion#vmove('^\(class\\|def\)\s', 'b')<CR>
26-
vnoremap<buffer>]M:call pymode#motion#vmove('^\s*def\s', '')<CR>
27-
vnoremap<buffer>[M:call pymode#motion#vmove('^\s*def\s', 'b')<CR>
28-
29-
onoremap<buffer>C:<C-U>call pymode#motion#select('^\s*class\s', 0)<CR>
30-
onoremap<buffer>aC:<C-U>call pymode#motion#select('^\s*class\s', 0)<CR>
31-
onoremap<buffer>iC:<C-U>call pymode#motion#select('^\s*class\s', 1)<CR>
32-
vnoremap<buffer>aC:<C-U>call pymode#motion#select('^\s*class\s', 0)<CR>
33-
vnoremap<buffer>iC:<C-U>call pymode#motion#select('^\s*class\s', 1)<CR>
34-
35-
onoremap<buffer>M:<C-U>call pymode#motion#select('^\s*def\s', 0)<CR>
36-
onoremap<buffer>aM:<C-U>call pymode#motion#select('^\s*def\s', 0)<CR>
37-
onoremap<buffer>iM:<C-U>call pymode#motion#select('^\s*def\s', 1)<CR>
38-
vnoremap<buffer>aM:<C-U>call pymode#motion#select('^\s*def\s', 0)<CR>
39-
vnoremap<buffer>iM:<C-U>call pymode#motion#select('^\s*def\s', 1)<CR>
5+
ifg:pymode_motion
6+
7+
nnoremap<buffer>]]:<C-U>call pymode#motion#move('^\(class\\|def\)\s', '')<CR>
8+
nnoremap<buffer>[[:<C-U>call pymode#motion#move('^\(class\\|def\)\s', 'b')<CR>
9+
nnoremap<buffer>]C:<C-U>call pymode#motion#move('^\(class\\|def\)\s', '')<CR>
10+
nnoremap<buffer>[C:<C-U>call pymode#motion#move('^\(class\\|def\)\s', 'b')<CR>
11+
nnoremap<buffer>]M:<C-U>call pymode#motion#move('^\s*def\s', '')<CR>
12+
nnoremap<buffer>[M:<C-U>call pymode#motion#move('^\s*def\s', 'b')<CR>
13+
14+
onoremap<buffer>]]:<C-U>call pymode#motion#move('^\(class\\|def\)\s', '')<CR>
15+
onoremap<buffer>[[:<C-U>call pymode#motion#move('^\(class\\|def\)\s', 'b')<CR>
16+
onoremap<buffer>]C:<C-U>call pymode#motion#move('^\(class\\|def\)\s', '')<CR>
17+
onoremap<buffer>[C:<C-U>call pymode#motion#move('^\(class\\|def\)\s', 'b')<CR>
18+
onoremap<buffer>]M:<C-U>call pymode#motion#move('^\s*def\s', '')<CR>
19+
onoremap<buffer>[M:<C-U>call pymode#motion#move('^\s*def\s', 'b')<CR>
20+
21+
vnoremap<buffer>]]:call pymode#motion#vmove('^\(class\\|def\)\s', '')<CR>
22+
vnoremap<buffer>[[:call pymode#motion#vmove('^\(class\\|def\)\s', 'b')<CR>
23+
vnoremap<buffer>]M:call pymode#motion#vmove('^\s*def\s', '')<CR>
24+
vnoremap<buffer>[M:call pymode#motion#vmove('^\s*def\s', 'b')<CR>
25+
26+
onoremap<buffer>C:<C-U>call pymode#motion#select('^\s*class\s', 0)<CR>
27+
onoremap<buffer>aC:<C-U>call pymode#motion#select('^\s*class\s', 0)<CR>
28+
onoremap<buffer>iC:<C-U>call pymode#motion#select('^\s*class\s', 1)<CR>
29+
vnoremap<buffer>aC:<C-U>call pymode#motion#select('^\s*class\s', 0)<CR>
30+
vnoremap<buffer>iC:<C-U>call pymode#motion#select('^\s*class\s', 1)<CR>
31+
32+
onoremap<buffer>M:<C-U>call pymode#motion#select('^\s*def\s', 0)<CR>
33+
onoremap<buffer>aM:<C-U>call pymode#motion#select('^\s*def\s', 0)<CR>
34+
onoremap<buffer>iM:<C-U>call pymode#motion#select('^\s*def\s', 1)<CR>
35+
vnoremap<buffer>aM:<C-U>call pymode#motion#select('^\s*def\s', 0)<CR>
36+
vnoremap<buffer>iM:<C-U>call pymode#motion#select('^\s*def\s', 1)<CR>
4037
38+
endif
39+
40+
ifg:pymode_rope&&g:pymode_rope_completion
41+
42+
setlocalomnifunc=pymode#rope#completions
43+
44+
exe"inoremap <silent> <buffer>" .g:pymode_rope_completion_bind ." <C-R>=pymode#rope#complete()<CR>"
45+
iftolower(g:pymode_rope_completion_bind)=='<c-space>'
46+
exe"inoremap <silent> <buffer> <Nul> <C-R>=pymode#rope#complete()<CR>"
4147
endif
4248

43-
" }}}
49+
end

‎after/indent/python.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ setlocal shiftwidth=4
1010
setlocalshiftround
1111
setlocalexpandtab
1212
setlocalautoindent
13-
setlocalindentexpr=pymode#indent#Indent(v:lnum)
13+
setlocalindentexpr=pymode#indent#get_indent(v:lnum)
1414
setlocalindentkeys=!^F,o,O,<:>,0),0],0},=elif,=except

‎autoload/pymode.vim

Lines changed: 60 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,49 @@
1-
"Python-mode base functions
1+
"Pymode core functions
22

3-
4-
fun!pymode#Default(name, default)"{{{
5-
" DESC: Set default value if it not exists
6-
"
3+
" DESC: Check variable and set default value if it not exists
4+
fun!pymode#default(name, default)"{{{
75
if!exists(a:name)
86
let {a:name}=a:default
97
return0
108
endif
119
return1
1210
endfunction"}}}
1311

12+
" DESC: Import python libs
13+
fun!pymode#init(plugin_root, paths)"{{{
1414

15-
fun!pymode#Option(name)"{{{
16-
17-
let name='b:pymode_' .a:name
18-
ifexists(name)
19-
returneval(name)
15+
ifg:pymode_python=='disable'
16+
ifg:pymode_warning
17+
callpymode#error("Pymode requires vim compiled with +python. Most of features will be disabled.")
18+
endif
19+
return
2020
endif
2121

22-
let name='g:pymode_' .a:name
23-
returneval(name)
22+
PymodePythonimport sys,vim
23+
PymodePython sys.path.insert(0,vim.eval('a:plugin_root'))
24+
PymodePython sys.path=vim.eval('a:paths')+ sys.path
25+
26+
endfunction"}}}
2427

28+
" DESC: Show wide message
29+
fun!pymode#wide_message(msg)"{{{
30+
letx=&ruler |lety=&showcmd
31+
setnorulernoshowcmd
32+
redraw
33+
echohlDebug |echostrpart("[Pymode]" .a:msg,0, &columns-1) |echohlnone
34+
let &ruler=x |let &showcmd=y
2535
endfunction"}}}
2636

37+
" DESC: Show error
38+
fun!pymode#error(msg)"{{{
39+
execute"normal\<Esc>"
40+
echohlErrorMsg
41+
echomsg"[Pymode]: error:" .a:msg
42+
echohl None
43+
endfunction"}}}
2744

28-
fun!pymode#QuickfixOpen(onlyRecognized, holdCursor, maxHeight, minHeight, jumpError)"{{{
29-
" DESC: Open quickfix window
30-
"
45+
" DESC: Open quickfix window
46+
fun!pymode#quickfix_open(onlyRecognized, holdCursor, maxHeight, minHeight, jumpError)"{{{
3147
let numErrors=len(filter(getqflist(),'v:val.valid'))
3248
let numOthers=len(getqflist())- numErrors
3349
if numErrors >0|| (!a:onlyRecognized&& numOthers >0)
@@ -43,153 +59,47 @@ fun! pymode#QuickfixOpen(onlyRecognized, holdCursor, maxHeight, minHeight, jumpE
4359
endif
4460
redraw
4561
if numOthers >0
46-
echoprintf('Quickfix: %d(+%d)', numErrors, numOthers)
62+
callpymode#wide_message(printf('Quickfix: %d(+%d)', numErrors, numOthers))
4763
else
48-
echoprintf('Quickfix: %d', numErrors)
49-
endif
50-
endfunction"}}}
51-
52-
53-
fun!pymode#PlaceSigns(bnum)"{{{
54-
" DESC: Place error signs
55-
"
56-
ifhas('signs')
57-
callpymode#Default('b:pymode_signs', [])
58-
59-
for iteminb:pymode_signs
60-
executeprintf('sign unplace %d buffer=%d', item.lnum, item.bufnr)
61-
endfor
62-
letb:pymode_signs= []
63-
64-
if!pymode#Default("g:pymode_lint_signs_always_visible",0)||g:pymode_lint_signs_always_visible
65-
callRopeShowSignsRulerIfNeeded()
66-
endif
67-
68-
for iteminfilter(getqflist(),'v:val.bufnr != ""')
69-
calladd(b:pymode_signs, item)
70-
executeprintf('sign place %d line=%d name=%s buffer=%d', item.lnum, item.lnum,"Pymode".item.type, item.bufnr)
71-
endfor
72-
73-
endif
74-
endfunction"}}}
75-
76-
77-
fun!pymode#CheckProgram(name,append)"{{{
78-
" DESC: Check program is executable or redifined by user.
79-
"
80-
let name='g:' .a:name
81-
ifpymode#Default(name,a:name)
82-
return1
83-
endif
84-
if!executable(eval(l:name))
85-
echoerr"Can't find '".eval(name)."'. Please set".name .", or extend $PATH,".a:append
86-
return0
64+
callpymode#wide_message(printf('Quickfix: %d', numErrors))
8765
endif
88-
return1
8966
endfunction"}}}
9067

91-
92-
fun!pymode#TempBuffer()"{{{
93-
" DESC: Open temp buffer.
94-
"
95-
pclose |botright8new
68+
" DESC: Open temp buffer.
69+
fun!pymode#tempbuffer_open(name)"{{{
70+
pclose
71+
exe"botright 8new" .a:name
9672
setlocalbuftype=nofilebufhidden=deletenoswapfilenowrappreviewwindow
9773
redraw
9874
endfunction"}}}
9975

100-
101-
fun!pymode#ShowStr(str)"{{{
102-
" DESC: Open temp buffer with `str`.
103-
"
104-
letg:pymode_curbuf=bufnr("%")
105-
callpymode#TempBuffer()
106-
put!=a:str
107-
wincmdp
108-
redraw
109-
endfunction"}}}
110-
111-
112-
fun!pymode#ShowCommand(cmd)"{{{
113-
" DESC: Run command and open temp buffer with result
114-
"
115-
callpymode#TempBuffer()
116-
try
117-
silentexec'r!' .a:cmd
118-
catch/.*/
119-
close
120-
echoerr'Command fail:'.a:cmd
121-
endtry
122-
redraw
123-
normal gg
124-
wincmdp
125-
endfunction"}}}
126-
127-
128-
fun!pymode#WideMessage(msg)"{{{
129-
" DESC: Show wide message
130-
131-
letx=&ruler |lety=&showcmd
132-
setnorulernoshowcmd
133-
redraw
134-
echohlDebug |echostrpart(a:msg,0, &columns-1) |echohlnone
135-
let &ruler=x |let &showcmd=y
136-
endfunction"}}}
137-
138-
139-
fun!pymode#BlockStart(lnum,...)"{{{
140-
let pattern=a:0 ?a:1 :'^\s*\(@\|class\s.*:\|def\s\)'
141-
let lnum=a:lnum+1
142-
letindent=100
143-
while lnum
144-
let lnum=prevnonblank(lnum-1)
145-
let test=indent(lnum)
146-
letline=getline(lnum)
147-
ifline=~'^\s*#'" Skip comments
148-
continue
149-
elseif!test" Zero-level regular line
150-
return lnum
151-
elseif test>=indent" Skip deeper or equal lines
152-
continue
153-
" Indent is strictly less at this point: check for def/class
154-
elseifline=~ pattern&&line!~'^\s*@'
155-
return lnum
156-
endif
157-
letindent=indent(lnum)
158-
endwhile
159-
return0
160-
endfunction"}}}
161-
162-
163-
fun!pymode#BlockEnd(lnum,...)"{{{
164-
letindent=a:0 ?a:1 :indent(a:lnum)
165-
let lnum=a:lnum
166-
while lnum
167-
let lnum=nextnonblank(lnum+1)
168-
ifgetline(lnum)=~'^\s*#' |continue
169-
elseif lnum&&indent(lnum)<=indent
170-
return lnum-1
171-
endif
172-
endwhile
173-
returnline('$')
76+
" DESC: Remove unused whitespaces
77+
fun!pymode#trim_whitespaces()"{{{
78+
let cursor_pos=getpos('.')
79+
silent!%s/\s\+$//
80+
callsetpos('.', cursor_pos)
17481
endfunction"}}}
17582

17683

177-
fun!pymode#Modeline()"{{{
178-
letmodeline=getline(prevnonblank('$'))
179-
ifmodeline=~'^#\s\+pymode:'
180-
forexinsplit(modeline,':')[1:]
181-
let [name, value]=split(ex,'=')
182-
let {'b:pymode_'.name}= value
183-
endfor
84+
fun!pymode#save()"{{{
85+
if &modifiable&& &modified
86+
try
87+
noautocmdwrite
88+
catch/E212/
89+
callpymode#error("File modified and I can't save it. Cancel code checking.")
90+
return0
91+
endtry
18492
endif
93+
return1
18594
endfunction"}}}
18695

187-
188-
fun!pymode#TrimWhiteSpace()"{{{
189-
let cursor_pos=getpos('.')
190-
silent!%s/\s\+$//
191-
callsetpos('.', cursor_pos)
96+
fun!pymode#reload_buf_by_nr(nr)"{{{
97+
let cur=bufnr("")
98+
try
99+
exe"buffer" .a:nr
100+
catch/E86/
101+
return
102+
endtry
103+
exe"e!"
104+
exe"buffer" . cur
192105
endfunction"}}}
193-
194-
195-
" vim:fdm=marker:fdl=0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp