vim-ragtag icon indicating copy to clipboard operation
vim-ragtag copied to clipboard

Better support for django

Open sassanh opened this issue 9 years ago • 2 comments

Thanks for creating this useful extension.

There are some issues using it for django templates, suppose that I'm in the middle of a line containing this:

<div class="{% if some_conditions %}{{ some_class }}else

now I expect pressing <C-X>_ to make it:

<div class="{% if some_conditions %}{{ some_class }}{% else %}

but unfortunately currently it makes it:

{% <div class="{% if some_conditions %}{{ some_class }}else %}

it applies to other similar shortcuts like <C-X>+, is it possible to fix it? (this pattern of coding in django templates is pretty common and there are lots of code with this pattern in django admin templates for example)

sassanh avatar Nov 22 '15 21:11 sassanh

It's working as designed. I'm guessing changing it to add this special case would be pretty hard, and I'm not even sure it would be universally applicable?

tpope avatar Nov 24 '15 19:11 tpope

I see, but for example <C-X><SPACE> is a bit better as it's using iW motion instead of I (referring to line 71 of ragtag.vim for <C-X><SPACE> and line 143 on same file for <C-X>+ as an example of using I) maybe using iw motion solves the whole issue as iW would make my above example generate this:

<div class="{% if some_conditions %}{{ some_class {%}}else %}

which is a little bit better and iw makes it:

<div class="{% if some_conditions %}{{ some_class }}{% else %}

which is the desired code.

Actually it's not only for django tags, suppose this case: you're typing

<div>some text</div>div

now if you press <C-X><SPACE> you expect to get

<div>some text</div><div>{cursor here}</div>

but you get

<p <class="text-error">div></class="text-error">div>

changing iW to iw and changing I to bi in ragtag.vim solved this for me I don't get it when iW and I motions would be better choices for iw.

sassanh avatar Nov 25 '15 02:11 sassanh