-
-
Notifications
You must be signed in to change notification settings - Fork 766
Expand file tree
/
Copy pathsigns.vim
More file actions
57 lines (45 loc) · 1.79 KB
/
signs.vim
File metadata and controls
57 lines (45 loc) · 1.79 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
let g:PymodeSigns = {}
fun! pymode#tools#signs#init() "{{{
call g:PymodeSigns.setup()
endfunction "}}}
fun! g:PymodeSigns.enabled() "{{{
return (g:pymode_lint_signs && has('signs'))
endfunction "}}}
fun! g:PymodeSigns.setup() "{{{
if self.enabled()
execute 'sign define PymodeW text=' . g:pymode_lint_todo_symbol . " texthl=Todo"
execute 'sign define PymodeD text=' . g:pymode_lint_docs_symbol . " texthl=String"
execute 'sign define PymodeC text=' . g:pymode_lint_comment_symbol . " texthl=Comment"
execute 'sign define PymodeR text=' . g:pymode_lint_visual_symbol . " texthl=Visual"
execute 'sign define PymodeE text=' . g:pymode_lint_error_symbol . " texthl=Error"
execute 'sign define PymodeI text=' . g:pymode_lint_info_symbol . " texthl=Info"
execute 'sign define PymodeF text=' . g:pymode_lint_pyflakes_symbol . " texthl=Info"
endif
let self._sign_ids = []
let self._next_id = 10000
let self._messages = {}
endfunction "}}}
fun! g:PymodeSigns.refresh(loclist) "{{{
if self.enabled()
call self.clear()
call self.place(a:loclist)
endif
endfunction "}}}
fun! g:PymodeSigns.clear() "{{{
let ids = copy(self._sign_ids)
for i in ids
execute "sign unplace " . i
call remove(self._sign_ids, index(self._sign_ids, i))
endfor
endfunction "}}}
fun! g:PymodeSigns.place(loclist) "{{{
let seen = {}
for issue in a:loclist.loclist()
if !has_key(seen, issue.lnum)
let seen[issue.lnum] = 1
call add(self._sign_ids, self._next_id)
execute printf('sign place %d line=%d name=%s buffer=%d', self._next_id, issue.lnum, "Pymode".issue.type[0], issue.bufnr)
let self._next_id += 1
endif
endfor
endfunction "}}}