justinmk / vim-sneak

The missing motion for Vim :athletic_shoe:
http://www.vim.org/scripts/script.php?script_id=4809
MIT License
3.25k stars 88 forks source link

No highlighting after exiting Goyo #108

Closed mon10a closed 10 years ago

mon10a commented 10 years ago

Justin,

Not sure if this is Sneak's issue or Goyo's, but I thought I would start here.

I just started using Goyo (Writeroom for Vim) and Sneak in Streak mode works fine while I am in full screen mode, but after leaving full screen the highlights don't show up at all. I am using your April 11 version of Sneak.

Thanks.

m

justinmk commented 10 years ago

Could have something to do with sneak storing the highlight id in a window-local (w:) variable.

after leaving full screen the highlights don't show up at all

For regular sneak too? Does syntax-highlighting still work at that point?

mon10a commented 10 years ago

Same problem for regular sneak.

Syntax highlighting (markdown for me) is off at that point. However, it usually comes back on with a cursor move.

justinmk commented 10 years ago

Could you do a quick test? Comment out this line: https://github.com/justinmk/vim-sneak/blob/master/autoload/sneak/streak.vim#L151

Then restart vim and see if the problem continues.

mon10a commented 10 years ago

Did not solve the problem (or seem to do anything). Happy to try other things.

justinmk commented 10 years ago

That's a good thing, it eliminates some complication. @junegunn Have you seen this issue?

junegunn commented 10 years ago

@justinmk Nope, but I just tested it, and it is reproducible. But you don't need Goyo to see the problem, just change color scheme between sneaks.

justinmk commented 10 years ago

@junegunn Thanks, that helps a lot! I expected :ownsyntax to cause problems with changing colorschemes, but now I'm stumped.

mon10a commented 10 years ago

Is there a way to reload sneak-streak to fix the highlighting without restarting Vim?

justinmk commented 10 years ago

Yes I think so (or rather I think I have a solution), I'll look into it today. Promise :)

justinmk commented 10 years ago

@mon10a This should be fixed now, let me know how it goes.

Note: if you have custom SneakFoo highlight definitions, then you must add them on autocmd ColorScheme *.

mon10a commented 10 years ago

Works! Thanks!

Out of curiosity, what was wrong?

m

justinmk commented 10 years ago

Colorschemes always clear existing highlights when they are loaded, so the plugin highlights were getting cleared, but not restored. So, sneak now listens to autocmd ColorScheme *, and re-initializes the highlight definitions if that event is raised.