Giter VIP home page Giter VIP logo

vim-jinja2-syntax's Introduction

This is the latest version of the Jinja2 syntax file for vim with the ability to detect either HTML or Jinja.

There are two reasons I made this repository:

  • The version of this vim addon is out-of-date on vimscripts.

  • I wanted to manage this syntax file with vim-addons-manager or whatever other vim plugins managers there are.

If the plugin is overzealous in detecting the Jinja syntax, send me the template it shouldn't have matched.

vim-jinja2-syntax's People

Contributors

alexrnl avatar averms avatar bcmyers avatar blueyed avatar csilivestru avatar davewongillies avatar davidism avatar derekdreery avatar evanhammer avatar faceleg avatar farrokhi avatar florianb avatar francoisfreitag avatar georgexsh avatar glench avatar jobicoppola avatar konishchevdmitry avatar mattboehm avatar nicksloan avatar ningsuhen avatar poppyschmo avatar threewholefish avatar yuex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-jinja2-syntax's Issues

Indent file has incorrect spacing when enter after certain lines

I'm not really sure how to explain this one but when I click "enter/return" after certain characters it goes to position 200 on the next line.

For example with the following snippet:

{% block content %}
{{ Content | safe }}
{% endblock %}

If I click return after the first %} or the first }} it will put me on the next line at position 200 (so it's indenting 200 spaces). But if I click return after the last %} it goes to the next line as normal.

My solution, for now, is to just not use the indent file but it would be nice to have it indent properly. I don't understand the script enough to see what is causing this to happen though.

I'm using Astro Vim's default settings and this is the only additional plugin I've added. All the highlighting is working correctly.

Twig commentary

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 ?

Matchit: multiline tags and `else` statement

Hi ๐Ÿ™‚

When a tag is stretches on multiple lines for readability, it is no longer detected by the plugin matchit/match-up

{% for very_long in dict
   if true and not false %}
[...]
{% endfor %}

I tried to change the variable b:match_words by adding a \_ with no luck though:
'{%[-+]\? *\%(end\)\@!\(\w\+\)\>\_.\{-}%}:{%-\? *end\1\>.\{-}%}'

There is also some improvement that could be done on this plugin. The else statement is not paired with if/endif.

folding

Is it possible to add folding? When working with large templates that have nested blocks, I would like to fold outer blocks so that I can see the overall structure.

Not sure if this is related or not - but is it possible to add tagbar support so that you can view the outline of the document more easily?

support $vimruntimepath/bundle

I'd like to use it like a vim "bundle" using pathogen, but I am not able to easily find out what would have to be added, to would make installation work like this:

  • Install some vim plugin manager supporting a directory bundle in $vimruntimepath (e.g. ~/.vim/bundle/). Pathogen is just one of those.
  • cd ~/.vim/bundle
  • git clone https://github.com/Glench/Vim-Jinja2-Syntax.git

and all is done.

Who might help out?

:enhancement

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.