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

Twig commentary #28

Open
Herz3h opened this issue Jul 10, 2020 · 4 comments
Open

Twig commentary #28

Herz3h opened this issue Jul 10, 2020 · 4 comments

Comments

@Herz3h
Copy link

Herz3h commented Jul 10, 2020

I'm using this plugin for twig tempaltes which are very similar to jinja ones. But I struggle to use vim-commentary (tpope's plugin) with twig template. When I type gcc (to comment a single line):

Consider this example:

{% block stylesheets %}
    <link rel="stylesheet" href="{{ asset('documents.css') }}">
{% endblock %}

Cursor being at second line, pressing gcc, preprends ## to the line and give this result:

{% block stylesheets %}
##    <link rel="stylesheet" href="{{ cached_asset('js-lib/modele-workflow-save.css') }}">
{% endblock %}

Which is not valid syntax for twig file, instead it should use

{# .... comment here .... #}

How do I change this behavior ?

@Glench
Copy link
Owner

Glench commented Jul 15, 2020

It looks like you can use vim-commentary's setting to change the comment behavior: https://github.com/tpope/vim-commentary#faq

@Herz3h
Copy link
Author

Herz3h commented Jul 15, 2020

I have tried that but it prefixes the line with # giving:

# .... comment here ....

Which is not valid commentary :/

@Glench
Copy link
Owner

Glench commented Jul 15, 2020 via email

@thanegill
Copy link

@Herz3h This is what you want:

autocmd FileType jinja setlocal commentstring={#\ %s\ #}

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

3 participants