bronson / vim-trailing-whitespace

Highlights trailing whitespace in red and provides :FixWhitespace to fix it.
453 stars 62 forks source link

add autocmd pattern for vimfiler #16

Closed mopp closed 4 years ago

mopp commented 8 years ago

Hi bronson ! Thank you for great plugin. However, this plugin could not work well with Shougo/vimfiler It seems that exist autocmds in your script are not issued. Then, I appended filetype autocmd pattern. and it works well. Thanks

bronson commented 8 years ago

I don't quite understand... You're saying that, if you view a file with vimfiler, the extra whitespace isn't shown? Or is it that if you open and edit a file with vimfiler, the space isn't shown?

If the former, that doesn't seem like too big a deal. :) You're not going to do anything about the whitespace until you edit it anyway.

I'm slightly concerned about firing on the FileType event... That seems redundant with BufNew and BufRead, and might be called more often than one would expect.

Finally, if we were to address the redundancy... I'm not sure we want to just delete BufNew and BufRead because I think sometimes the FileType event won't fire when opening a file (if Vim doesn't recognize the file's filetype).

mopp commented 8 years ago

I'm sorry for few explanation. In my environment, I did mean that the extra whitespace in a buffer of vimfiler is NOT shown. Here is my vimrc I don't want the extra whitespaces to appear in the buffer. And it happens only in the case of opening the buffer with :VimFilerExplorer command Also it is only first time. (:VimFilerExplorer -> (The extra whitespaces is highlighted) -> Close the buffer -> :VimFilerExplorer -> Everything works well) In the other cases, for example :VimFiler command, it does not happen.

I agree with you about the redundant. However, It seems that VimFiler does not fire BufNew and BufRead when I open the buffer. So, I could not solve this problem without appending FileType event.

If you don't want to merge this pull request for the redundant. it's ok. And I will open the buffer twice :) Thanks.

bronson commented 8 years ago

Gotcha, that makes sense. That's really crazy that it's only the first time.

It would be good to understand this better before settling on a fix. Are there any other events that would be more appropriate?

Maybe contact the VimFiler guys for a hint? They might know offhand what's going on.

mopp commented 8 years ago

Ok, I will find a solution later. And you can close this PR. Thank you for your kind :)

lucerion commented 8 years ago

I fixed this issue with vimfiler (and not only vimfiler) some times ago (see #10), but now for vimfiler it reproduces again :( Please, change BufRead to BufReadPre and remove filetype in your PR. It should works.

lucerion commented 8 years ago

Sorry, I tested it and BufReadPre doesn't work in combination with BufNew.

bronson commented 4 years ago

Just checking: is there a change to make here? (one that keeps the plugin reasonably clean!)

mopp commented 4 years ago

@bronson Hi Thank you for notifying me.

I've used vim-trailing-whitespace still, but active development on vimfiler.vim has stopped. defx.nvim is a new one, and I also use it. This issue does not occur with defx.nvim. So, you can close :pray:

bronson commented 4 years ago

Right on. Open if you see it again. Thanks!