aserebryakov / filestyle

filestyle is a Vim plugin that highlights unwanted whitespace and characters.
http://www.vim.org/scripts/script.php?script_id=5065
Apache License 2.0
30 stars 5 forks source link

Fix 'undefined variable filestyle_activate' #13

Closed kovetskiy closed 9 years ago

kovetskiy commented 9 years ago

When I open any file, I get this message:

Error detected while processing function FileStyleCheck:
line    1:
E121: Undefined variable: b:filestyle_active

I fixed it through the get() function

aserebryakov commented 9 years ago

Does it happen all the time? Which plugins do you use? (I tested it on Vim with a really little number of plugins)

aserebryakov commented 9 years ago

I got the same issue if I open Vim (without filename) and e.g. open :help after it.

kovetskiy commented 9 years ago

Yep, it happens every time.

https://github.com/kovetskiy/dotfiles/blob/master/.vimrc

aserebryakov commented 9 years ago

As I see it now, FileStyleActivate() function is not called for some reason. Probably, I need to add another one evend listening.

aserebryakov commented 9 years ago

Listening of the event VimEnter fixed the issue in case of no file opened. Can you please let me know if it also resolves the issue for you?

diff --git a/plugin/filestyle.vim b/plugin/filestyle.vim
index 68572e4..273fee8 100644
--- a/plugin/filestyle.vim
+++ b/plugin/filestyle.vim
@@ -25,7 +25,7 @@ if !exists('g:filestyle_plugin')
   "Defining auto commands
   augroup filestyle_auto_commands
     autocmd!
-    autocmd BufReadPost,BufNewFile * call FileStyleActivate()
+    autocmd BufReadPost,BufNewFile,VimEnter * call FileStyleActivate()
     autocmd FileType * call FileStyleCheckFiletype()
     autocmd WinEnter * call FileStyleCheck()
   augroup end
kovetskiy commented 9 years ago

Nope, that does not resolve my problem.

You can try open any buffer like Unite/FuzzyFinder/Tagbar and get this message.

aserebryakov commented 9 years ago

May I ask you run Vim with the following option:

vim -V20DebugLog

and upload the log saved as DebugLog?

kovetskiy commented 9 years ago

lolwut ahaha

okay...

https://www.dropbox.com/s/09jbi2r8o075h17/DebugLog?dl=0

aserebryakov commented 9 years ago

Thanks, I would like to know which events are not covered.