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

Incorrect highlighting, when file are open from [g]vim menu #20

Open
Sloun opened this issue Apr 24, 2013 · 18 comments
Open

Incorrect highlighting, when file are open from [g]vim menu #20

Sloun opened this issue Apr 24, 2013 · 18 comments

Comments

@Sloun
Copy link

Sloun commented Apr 24, 2013

I can't get working html.vim plugin if I open vim first, and then open some file (e.g. open test.html or via NERDTree). In this situation I have this: http://s18.postimg.org/miqsywm8p/Selection_2013_04_24_03_21.png

But if I open file via terminal (gvim test.html) plugin works perfectly: http://s24.postimg.org/sxoaypr45/Selection_2013_04_24_03_22.png

vim version: 7.3.547 (Debian testing)

Thank you.

@gregsexton
Copy link
Owner

If you do in Vim :set runtimepath? in both cases, what do you get? Sounds like in the first case the file isn't getting picked up.

@Sloun
Copy link
Author

Sloun commented May 3, 2013

Sorry for late reply. In case when plugin works well I get this:
runtimepath=/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/.vim/after
In other case:
runtimepath=/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,/.vim/after
It's identical.

@gregsexton
Copy link
Owner

I'm sorry, I have no idea. My best guess would be that you have a file somewhere that is checking whether vim is running as gvim and then setting b:did_ftplugin so that the html.vim file does not load. You should try moving all of your files out and adding them back in to narrow down where the problem is.

@gregsexton
Copy link
Owner

Sorry, by 'all your files', I mean all of your ~/.vim files.

@Sloun
Copy link
Author

Sloun commented May 5, 2013

This trouble is identical in vim and gvim. Also, I've put plugin in ~/.vim/plugin directory. Because if I move it in ~/.vim/ftplugin it doesn't work at all. I've recreated home directory for user, problem is still here.
Test ~/.vim directory:
/home/all/makeuser/.vim
├── doc
│   └── tags
├── ftplugin
├── .netrwhist
├── plugin
│   ├── html.vim
│   └── xml.vim
└── .VimballRecord

3 directories, 5 files

And .vimrc:
makeuser@localhost:~$ cat ~/.vimrc
syntax on
set nu
color elflord

@gregsexton
Copy link
Owner

It should work in the ftplugin folder. Try removing the following lines from the top of the html.vim file to see if this resolves the problem:

if exists("b:did_ftplugin")
    finish
endif

@Sloun
Copy link
Author

Sloun commented May 20, 2013

Unfortunately, that's didn't help.

@Sloun Sloun closed this as completed May 20, 2013
@Sloun
Copy link
Author

Sloun commented May 20, 2013

Maybe it's some bug in debian build of vim, I dont know at all.

@Sloun Sloun reopened this May 20, 2013
@gregsexton
Copy link
Owner

How do you open a file once vim is running? If you describe the steps maybe that will help. Also, try :set ft? when it is working and when it isn't to compare the differences.

@kitzberger
Copy link

Having the same issue here. As soon as I load a file into vim not opening it right away as cli parameter from the shell, the plugin doesn't work anymore.

For example via calling :tabedit file2.html.

Would really appreciate a fix for this. Thanks for a great plugin ;-)

@gregsexton
Copy link
Owner

Are there any similarities with your setup and the one described above?

I can't reproduce this. You guys are going to have to debug it. See if you can narrow down the problem by temporarily removing other plugins, commenting out guard lines of code as I suggested above etc. @Sloun, did you resolve this issue?

@kitzberger
Copy link

Modifying line 10 did the trick for me:

  9 augroup matchhtmlparen
 10     autocmd! CursorMoved,CursorMovedI,WinEnter <buffer> call s:Highlight_Matching_Pair()
 11 augroup END

I'm not that familiar with vim autocommands, so I honestly have no idea what side effects this may cause. I substituted [buffer] by an asterisk and it works like a charm, even with NERDtree.

Oh, btw. I noticed some weird behavior as well: having a tag highlighted in the first buffer and then opening a copy in a second buffer leads to the same tag being highlighted in the second buffer. But nothing happens when repositioning the cursor. In the first buffer all works fine, when I switch back to that....

@gregsexton
Copy link
Owner

By substituting an asterisk, this function will be being called for every buffer you open. It suggests that this block is called at least once but not for every buffer. Do you always start vim/gvim with a file argument?

@Sloun
Copy link
Author

Sloun commented Mar 2, 2014

@gregsexton Unfortunately, no. The issue is still here.
@kitzberger Thanks for some fix, I'll try to use it.

@kitzberger
Copy link

@gregsexton Yes, in most cases I do start vim with a file argument.

Out of curiousity: why don't we wanna call the auto command for every buffer? We certainly want the highlighting to work for every buffer, right?

@gregsexton
Copy link
Owner

If you don't start with a file argument and open files from within Vim, does the issue still occur?

Not every buffer has tags. With an asterisk it will be applied to every buffer regardless of whether this is appropriate. You could substitute for something like *.html but that defeats being able to symlink the file to provide the functionality for other file types.

@kitzberger
Copy link

Yes, the plugin's only working as long as I open the file as an argument.

Maybe a white list variable for file extensions that do usually contain tags to substitute that asterisk?

@skylite21
Copy link

Having the same problem
I would use the :tabedit and open another html file, but there are no highlights in the new tab, only in the first.

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

No branches or pull requests

4 participants