-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Only colorize visible area #20
base: master
Are you sure you want to change the base?
Conversation
min() comparing to if-condition, has almost the same perfermance,(in fact, min() is tiny faster than if-condition in most test cases), and min() looks more clear
Faster for large file
WIP,请先别合并。 |
嗯,期待~ |
请问为什么要
|
force highlight on WinEnter and don't clear for other windows
" A hack for colorizing after opening a folding | ||
if ( winheight('.') - line('w$') + line('w0') ) > 1 | ||
autocmd CursorHold * silent call colorizer#ColorHighlight(1) | ||
endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
比较关键的改动是这以上的十几行。
那个是强制更新时用的。比如说颜色高亮出问题了,先清一遍,再重新高亮。 |
历时太久,很多细节我也不记得了。我有空看看你的修改。 |
好的,我觉得可以将其删掉。 |
@@ -305,7 +312,8 @@ function! colorizer#ColorHighlight(update, ...) "{{{1 | |||
autocmd CursorMoved,CursorMovedI * silent call s:CursorMoved() | |||
endif | |||
" rgba handles differently, so need updating | |||
autocmd GUIEnter * silent call colorizer#ColorHighlight(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个不需要了吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我认为不需要。因为后面还有BufEnter
。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:gui
命令并不会触发 BufEnter 的呀。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:gui 命令并不会触发 BufEnter 的呀。
我并没有查到相关都文档说明这个。而且:gui
还是会高亮的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
但是不会高亮带 alpha 值的颜色,比如 rgba(255,0,255,0.5)
这种。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯,alpha值会被漏掉。
可惜没有一个 |
嗯,或者一个 |
@lilydjwg ,Hi 依云,今天浏览vim的doc,发现有个 diff --git a/autoload/colorizer.vim b/autoload/colorizer.vim
index 82bd3de..a974292 100644
--- a/autoload/colorizer.vim
+++ b/autoload/colorizer.vim
@@ -308,9 +308,7 @@ function! colorizer#ColorHighlight(update, ...) "{{{1
autocmd CursorMoved,CursorMovedI * silent call s:CursorMoved()
endif
" rgba handles differently, so need updating
- autocmd GUIEnter * silent call colorizer#ColorHighlight(1)
- autocmd BufEnter * silent call colorizer#ColorHighlight(1)
- autocmd WinEnter * silent call colorizer#ColorHighlight(1)
+ autocmd Syntax * silent call colorizer#ColorHighlight(1)
autocmd ColorScheme * let s:force_group_update=1 | silent call colorizer#ColorHighlight(1)
augroup END
endfunction 至少切换 |
@UncleBill 这个是在 |
问题:打开或进入大文件
buffer
会特别卡。解决:只处理当前的可见范围。