Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 4 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 36 additions and 37 deletions.
  1. +36 −37 autoload/DynamicSigns.vim
View
73 autoload/DynamicSigns.vim
@@ -200,7 +200,7 @@ fu! <sid>ReturnSignDef() "{{{1
redir END
let b = split(a, "\n")[2:]
call map(b, 'split(v:val)[1]')
- return b
+ return filter(b, 'v:val=~''^\(Sign\)\|\(\d\+$\)''')
endfu
fu! <sid>ReturnSigns(buffer) "{{{1
@@ -230,16 +230,14 @@ fu! <sid>AuCmd(arg) "{{{1
if a:arg
augroup Signs
autocmd!
- exe "au InsertLeave * :call <sid>UpdateWindowSigns('".
- \ ignore. "')"
- exe "au GUIEnter,BufWritePost * :call <sid>UpdateWindowSigns('".
- \ ignore. "')"
+ au InsertLeave * :call <sid>UpdateWindowSigns(ignore)
+ au GUIEnter,BufWritePost,BufWinEnter,VimEnter *
+ \ call <sid>UpdateWindowSigns(ignore)
exe s:SignQF ?
\ "au QuickFixCmdPost * :call DynamicSigns#QFSigns()" : ''
- au BufWinEnter,VimEnter * :call DynamicSigns#Update()
if exists("s:Sign_CursorHold") && s:Sign_CursorHold
- exe "au CursorHold,CursorHoldI * call <sid>UpdateWindowSigns('".
- \ ignore. "')"
+ au CursorHold,CursorHoldI *
+ \ call <sid>UpdateWindowSigns(ignore)
endif
augroup END
else
@@ -335,6 +333,10 @@ fu! <sid>PlaceSigns(...) "{{{1
if !<sid>DoSigns()
return
endif
+ let bookmarks = {}
+ if s:BookmarkSigns
+ let bookmarks = <sid>GetMarks()
+ endif
let first = !exists("a:1") ? 1 : a:1
let last = !exists("a:2") ? line('$') : a:2
let range = range(first, last)
@@ -361,7 +363,7 @@ fu! <sid>PlaceSigns(...) "{{{1
" Place marks "{{{3
if match(s:ignore, 'marks') == -1 &&
- \ <sid>PlaceBookmarks(line)
+ \ <sid>PlaceBookmarks(line, get(bookmarks, line, '-1'))
continue
endif
@@ -434,8 +436,8 @@ fu! <sid>DefineSigns() "{{{1
endif
" Mixed Indentation Error
- let def = printf("sign define SignWSError text=X texthl=%s linehl=%s %s",
- \ s:id_hl.Error, s:id_hl.Error,
+ let def = printf("sign define SignWSError text=X texthl=%s %s",
+ \ s:id_hl.Error,
\ (icon ? "icon=". s:i_path. "error.bmp" : ''))
call <sid>DefineSignsIcons(def)
@@ -592,6 +594,9 @@ endfu
fu! <sid>DoSigns() "{{{1
if !s:MixedIndentation &&
\ get(s:CacheOpts, 'MixedIndentation', 0) > 0
+ if exists("s:MixedIndentationHL")
+ call matchdelete(s:MixedIndentationHL)
+ endif
let index = match(s:Signs,
\ 'id='.s:sign_prefix.'\d\+.*name=SignWSError')
while index > -1
@@ -803,12 +808,20 @@ fu! <sid>PlaceMixedWhitespaceSign(line) "{{{1
if exists("s:MixedIndentation") &&
\ s:MixedIndentation == 1
- let a=matchstr(getline(a:line), '^\s\+\ze\S')
+ let line = getline(a:line)
+ let pat1 = '\%(^\s\+\%(\t \)\|\%( \t\)\)'
+ let pat2 = '\%(\S\zs\s\+$\)'
+ "highlight non-breaking space, etc...
+ let pat3 = '\%([\x0b\x0c\u00a0\u1680\u180e\u2000-\u200a\u2028\u202f\u205f\u3000\ufeff]\)'
+
+ let pat = pat1. '\|'. pat2. '\|'. pat3
+ if !exists("s:MixedIndentationHL")
+ let s:MixedIndentationHL =
+ \ matchadd('Error', pat)
+ endif
let oldSign = match(s:Signs, 'line='.a:line.
\ '.*name=SignWSError')
- if (match(a, '\%(\t \)\|\%( \t\)') > -1
- \ || match(getline(a:line), '\s\+$') > -1)
-
+ if match(line, pat) > -1
if oldSign < 0
exe "sign place " s:sign_prefix. a:line. " line=". a:line.
\ " name=SignWSError buffer=" . bufnr('')
@@ -937,19 +950,17 @@ fu! <sid>PlaceAlternatingSigns(line) "{{{1
return 1
endfu
-fu! <sid>PlaceBookmarks(line) "{{{1
+fu! <sid>PlaceBookmarks(line, mark) "{{{1
" Place signs for bookmarks
if exists("s:BookmarkSigns") &&
- \ s:BookmarkSigns == 1
+ \ a:mark != '-1' && s:BookmarkSigns == 1
let oldSign = match(s:Signs, 'line='. a:line.
\ '\D.*name=SignBookmark')
- let bookmarks = <sid>GetMarks()
- if get(bookmarks, a:line, -1) > -1
- if oldSign < 0
- exe "sign place " s:sign_prefix. a:line. " line=". a:line.
- \ " name=SignBookmark". bookmarks[a:line]. " buffer=".
- \ bufnr('')
+ if oldSign < 0
+ exe "sign place " s:sign_prefix. a:line. " line=". a:line.
+ \ " name=SignBookmark". a:mark. " buffer=".
+ \ bufnr('')
endif
return 1
elseif oldSign >= 0
@@ -1105,20 +1116,8 @@ endfu
fu! DynamicSigns#CleanUp() "{{{1
" only delete signs, that have been set by this plugin
call <sid>UnPlaceSigns()
- for item in range(1,10)
- exe "sil! sign undefine " item
- endfor
- " Remove SignWSError Sign
- sil! sign undefine SignWSError
- " Remove Custom Signs
- for sign in ['OK', 'Warning', 'Error', 'Info', 'Add', 'Arrow', 'Flag',
- \ 'Delete', 'Stop']
- exe "sil! sign undefine SignCustom". sign
- endfor
- for sign in s:Bookmarks
- exe "sil! sign undefine SignBookmark".sign
- endfor
- for sign in ['SignQF', 'SignAdded', 'SignChanged', 'SignDeleted']
+ " undefine all signs
+ for sign in s:SignDef
exe "sil! sign undefine" sign
endfor
call <sid>AuCmd(0)

No commit comments for this range

Something went wrong with that request. Please try again.