Indentation issue when expanding a single line tag.
ar1a opened this issue · 8 comments
When using Something like webmode, having <a>|cursor here|</a>
and pressing enter turns it into this
<a>
|cursor here|
</a>
yet in vue mode, it'll just do
<a>
|cursor here|</a>
Which templating submode are you using? This mode doesn't handle the specifics of indentation; it only delegates it to the submode you're in.
modeline says vue[vue-html]
vue-html-mode is just a small shim over sgml-mode for vue templates, so that's to be expected. Perhaps this issue would be best solved by a personal macro bound to your enter key? It should be doable in around 5 lines.
Is there a way to use other modes in place of vue-html-mode?
Also, someone else would have to write the macro. I am far from a lisp expert :(
Yes, you can customize vue-modes
. Just change all instances of vue-html-mode
to your preferred submode. I haven't tested web-mode as a submode for templating, however, so ymmv.
Here's a quick sketch of what your macro should look like - maybe fiddling around with it would give you the desired result if web-mode doesn't work out.
(define-key vue-html-mode-map (kbd "RET") #'(lambda () (newline) (newline) (forward-line -1) (indent-for-tab-command)))
I'm a bit confused how I would set https://github.com/AdamNiederer/vue-mode/blob/master/vue-mode.el#L44-L45 without rewriting the entire array.
Sorry :x once again, lisp noobie
Paste this into your scratch buffer, place your cursor just past the end paren, and press C-x C-e
to evaluate it.
(require 'vue-mode)
Then run M-x customize
, search for "vue modes", edit the array, and then hit "Apply" or "Apply and Save"
alright, web mode seems to work ok.
A bug i noticied already, ill make an issue.