forked from python-mode/python-mode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlint.vim
More file actions
103 lines (76 loc) · 2.19 KB
/
lint.vim
File metadata and controls
103 lines (76 loc) · 2.19 KB
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
PymodePython from pymode.lint import code_check
call pymode#tools#signs#init()
call pymode#tools#loclist#init()
fun! pymode#lint#auto() "{{{
if !pymode#save()
return 0
endif
PymodePython from pymode import auto
PymodePython auto()
cclose
call g:PymodeSigns.clear()
edit
call pymode#wide_message("AutoPep8 done.")
endfunction "}}}
fun! pymode#lint#show_errormessage() "{{{
let loclist = g:PymodeLocList.current()
if loclist.is_empty()
return
endif
let l = line('.')
if l == b:pymode_error_line
return
endif
let b:pymode_error_line = l
if has_key(loclist._messages, l)
call pymode#wide_message(loclist._messages[l])
else
echo
endif
endfunction "}}}
fun! pymode#lint#toggle() "{{{
let g:pymode_lint = g:pymode_lint ? 0 : 1
if g:pymode_lint
call pymode#wide_message("Code checking is enabled.")
else
call pymode#wide_message("Code checking is disabled.")
end
endfunction "}}}
fun! pymode#lint#check() "{{{
" DESC: Run checkers on current file.
"
let loclist = g:PymodeLocList.current()
let b:pymode_error_line = -1
call loclist.clear()
call pymode#wide_message('Code checking is running ...')
PymodePython code_check()
if loclist.is_empty()
call pymode#wide_message('Code checking is completed. No errors found.')
endif
call g:PymodeSigns.refresh(loclist)
if g:pymode_lint_cwindow
call loclist.show()
endif
call pymode#lint#show_errormessage()
call pymode#wide_message('Found errors and warnings: ' . len(loclist._loclist))
endfunction " }}}
fun! pymode#lint#tick_queue() "{{{
python import time
python print time.time()
if mode() == 'i'
if col('.') == 1
call feedkeys("\<Right>\<Left>", "n")
else
call feedkeys("\<Left>\<Right>", "n")
endif
else
call feedkeys("f\e", "n")
endif
endfunction "}}}
fun! pymode#lint#stop() "{{{
au! pymode CursorHold <buffer>
endfunction "}}}
fun! pymode#lint#start() "{{{
au! pymode CursorHold <buffer> call pymode#lint#tick_queue()
call pymode#lint#tick_queue()
endfunction "}}}