ElmCast / elm-vim

Elm plugin for Vim
BSD 3-Clause "New" or "Revised" License
572 stars 102 forks source link

Ensure vim hooks are registered only once #110

Closed jwoudenberg closed 7 years ago

jwoudenberg commented 7 years ago

I noticed that the longer vim ran, the slower the elm-format upon save functionality seemed to become. It turns out the cause of this is that for every .elm file that is opened, a new set of BufWrite hooks is registered. This means that after navigating around the project a bit, saving a file is going to invoke elm-format multiple times in succession, which is slow and pointless.

This PR fixes that by always clearing the relevant commit hooks before registering them again.

jschomay commented 7 years ago

This has bugged me forever, thanks for finding it! Anxious for it to be merged.