Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autocmd should be attached to local buffer, not globally #18

Closed
vits opened this issue May 17, 2012 · 1 comment
Closed

autocmd should be attached to local buffer, not globally #18

vits opened this issue May 17, 2012 · 1 comment
Labels

Comments

@vits
Copy link

vits commented May 17, 2012

Current implementation causes problems working with multiple buffers. To reproduce open any CSS file in gvim (could be empty) and after that open or create new buffer with different filetype, for example b.txt and type anything like CSS color, like #123.

You get this:

Error detected while processing function <SNR>21_PreviewCSSColorInLine..<SNR>21_MatchColorValue:
line    3:
E121: Undefined variable: b:color_pattern

This happens becaus autocmd in css.vim attaches function calls to all buffers. Fix this by changing lines to

autocmd CursorMoved  <buffer> silent call s:PreviewCSSColorInLine()
autocmd CursorMovedI <buffer> silent call s:PreviewCSSColorInLine()
@ap ap closed this as completed in 5929e9f May 17, 2012
@ap
Copy link
Owner

ap commented May 17, 2012

D’oh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants