diff options
| author | Jan-Jaap Korpershoek <jjkorpershoek96@gmail.com> | 2019-11-03 12:12:11 +0100 |
|---|---|---|
| committer | Jan-Jaap Korpershoek <jjkorpershoek96@gmail.com> | 2019-11-03 12:25:02 +0100 |
| commit | fcc8ed5df3de7f6ac8b56734ad09bcbb9207a48a (patch) | |
| tree | 2a92111a02ba2db0e80e28aad4f988ebba703d79 /rc/filetype | |
| parent | ec31d839724cfd0f8431c04509f1f1d2b5fa1290 (diff) | |
[html] Fix indentation when entering a newline while in the middle of a tag
Example:
```
<tag>|</tag>
```
Then press enter
Old behaviour:
```
<tag>
</tag>
```
New behaviour:
```
<tag>
</tag>
```
I also added a test for it
Diffstat (limited to 'rc/filetype')
| -rw-r--r-- | rc/filetype/html.kak | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/rc/filetype/html.kak b/rc/filetype/html.kak index 4a86e21b..33e65a9b 100644 --- a/rc/filetype/html.kak +++ b/rc/filetype/html.kak @@ -80,8 +80,8 @@ define-command -hidden html-indent-on-new-line %{ try %{ execute-keys -draft <semicolon> K <a-&> } # filter previous line try %{ execute-keys -draft k : html-trim-indent <ret> } - # indent after lines ending with opening tag - try %{ execute-keys -draft k <a-x> <a-k> <lt>(?!area)(?!base)(?!br)(?!col)(?!command)(?!embed)(?!hr)(?!img)(?!input)(?!keygen)(?!link)(?!menuitem)(?!meta)(?!param)(?!source)(?!track)(?!wbr)(?!/)(?!>)[a-zA-Z0-9_-]+[^>]*?>$ <ret> j <a-gt> } } + # indent after lines ending with opening tag except when it starts with a closing tag + try %{ execute-keys -draft k <a-x> <a-k> <lt>(?!area)(?!base)(?!br)(?!col)(?!command)(?!embed)(?!hr)(?!img)(?!input)(?!keygen)(?!link)(?!menuitem)(?!meta)(?!param)(?!source)(?!track)(?!wbr)(?!/)(?!>)[a-zA-Z0-9_-]+[^>]*?>$ <ret>j<a-x><a-K>^\s*<lt>/<ret><a-gt> } } } ] |
