tpope / vim-commentary

commentary.vim: comment stuff out

Home Page:http://www.vim.org/scripts/script.php?script_id=3695

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid matlab comments

lindhe opened this issue · comments

It seems to think that matlab files are some other language. When I toggle comment it palces a /* ... */, when it really should place % for single line comments or %{ ... %} for block comments.

FAQ

Huh. Why is that? Why not incorporate "every" filetype?

The question you should be asking is why the matlab filetype doesn't set 'commentstring'. And the person you should be asking is the matlab filetype maintainer.

OK. How do I find out who that is?

Look in ftplugin/matlab.vim.

I can't find such a repo. Do you mean the ~/.vim/after/ftplugin/matlab.vim file on my system? I don't have one. You was talking about a filetype maintainer, I assume you mean the maintainer of some repository.

:e $VIMRUNTIME/ftplugin/matlab.vim

I tried to put setlocal commentstring=%\ %s inside matlab.vim but it doesn't work.
autocmd FileType matlab setlocal commentstring=%\ %s works inside vimrc but I would like to implement it inside the plugin. How can I do so ?

Thanks :)

That should work, assuming you have the correct matlab.vim. What's the full path to that file?

I have tried to put it inside syntax/matlab.vim and inside ftplugin/matlab.vim, no success.

You can see this repository with the code https://github.com/tdehaeze/matlab-vim

I include it using Plug 'tdehaeze/matlab-vim'

the file ftplugin/matlab.vim from that repository is still missing the required :setlocal commentstring=%\ %s.
After that it just works. Note, if you only want that single change, its usually easier to add ~/.vim/after/ftplugin/matlab.vim (create missing directories) and add that single statement there.

BTW: Has anybody actually suggested to the maintainer of the official Vim ftplugin file the change to add the commentstring setting?

Indeed it's working now. My problem was I had 2 plugins having syntax/matlab.vim files and the second plugin was overwriting the first (the one I tried to correct).

The official Vim ftplugin file has been last updated the "19 May 2010" and its author is not active...

I updated my repo containing the vim plugin : https://github.com/tdehaeze/matlab-vim

BTW: this setting does not belong into the syntax file but into the ftplugin file.
We are talking about the ftplugin from the official vim runtime folder.
That one was last updated in December 2014 so there is a chance it is still maintained.

I opened a merge request. I'll let you know if its accepted.

as has been said before, that is the wrong approach. First try to contact the maintainer of the file. Only if you don't get a response, you should open a PR on vim/vim repository