From cccb21df3b4c6fe0aaa99743c418aa973aeebad0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 04:10:59 +0200 Subject: Merging upstream version 2:9.1.0374. Signed-off-by: Daniel Baumann --- runtime/indent/asm.vim | 29 ++++++++++++++++ runtime/indent/astro.vim | 88 ++++++++++++++++++++++++++++++++++++++++++++++++ runtime/indent/json5.vim | 11 ++++++ 3 files changed, 128 insertions(+) create mode 100644 runtime/indent/asm.vim create mode 100644 runtime/indent/astro.vim create mode 100644 runtime/indent/json5.vim (limited to 'runtime/indent') diff --git a/runtime/indent/asm.vim b/runtime/indent/asm.vim new file mode 100644 index 0000000..4efa766 --- /dev/null +++ b/runtime/indent/asm.vim @@ -0,0 +1,29 @@ +" Vim indent file +" Language: asm +" Maintainer: Philip Jones +" Upstream: https://github.com/philj56/vim-asm-indent +" Last Change: 2017-Jul-01 +" 2024 Apr 25 by Vim Project (undo_indent) + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal indentexpr=s:getAsmIndent() +setlocal indentkeys=<:>,!^F,o,O + +let b:undo_indent = "indentexpr< indentkeys<" + +function! s:getAsmIndent() + let line = getline(v:lnum) + let ind = shiftwidth() + + " If the line is a label (starts with ':' terminated keyword), + " then don't indent + if line =~ '^\s*\k\+:' + let ind = 0 + endif + + return ind +endfunction diff --git a/runtime/indent/astro.vim b/runtime/indent/astro.vim new file mode 100644 index 0000000..25a2aa0 --- /dev/null +++ b/runtime/indent/astro.vim @@ -0,0 +1,88 @@ +" Vim indent file (experimental). +" Language: Astro +" Author: Wuelner Martínez +" Maintainer: Wuelner Martínez +" URL: https://github.com/wuelnerdotexe/vim-astro +" Last Change: 2022 Aug 07 +" Based On: Evan Lecklider's vim-svelte +" Changes: See https://github.com/evanleck/vim-svelte +" Credits: See vim-svelte on github + +" Only load this indent file when no other was loaded yet. +if exists('b:did_indent') + finish +endif + +let b:html_indent_script1 = 'inc' +let b:html_indent_style1 = 'inc' + +" Embedded HTML indent. +runtime! indent/html.vim +let s:html_indent = &l:indentexpr +unlet b:did_indent + +let b:did_indent = 1 + +setlocal indentexpr=GetAstroIndent() +setlocal indentkeys=<>>,/,0{,{,},0},0),0],0\,<<>,,!^F,*,o,O,e,; + +let b:undo_indent = 'setl inde< indk<' + +" Only define the function once. +if exists('*GetAstroIndent') + finish +endif + +let s:cpoptions_save = &cpoptions +setlocal cpoptions&vim + +function! GetAstroIndent() + let l:current_line_number = v:lnum + + if l:current_line_number == 0 + return 0 + endif + + let l:current_line = getline(l:current_line_number) + + if l:current_line =~ '^\s*', '', '', 'bW') && + \ l:previous_line =~ ';$' && l:current_line !~ '}' + return l:previous_line_indent + endif + + if synID(l:previous_line_number, match( + \ l:previous_line, '\S' + \ ) + 1, 0) == hlID('htmlTag') && synID(l:current_line_number, match( + \ l:current_line, '\S' + \ ) + 1, 0) != hlID('htmlEndTag') + let l:indents_match = l:indent == l:previous_line_indent + let l:previous_closes = l:previous_line =~ '/>$' + + if l:indents_match && + \ !l:previous_closes && l:previous_line =~ '<\(\u\|\l\+:\l\+\)' + return l:previous_line_indent + shiftwidth() + elseif !l:indents_match && l:previous_closes + return l:previous_line_indent + endif + endif + + return l:indent +endfunction + +let &cpoptions = s:cpoptions_save +unlet s:cpoptions_save +" vim: ts=8 diff --git a/runtime/indent/json5.vim b/runtime/indent/json5.vim new file mode 100644 index 0000000..5977a4b --- /dev/null +++ b/runtime/indent/json5.vim @@ -0,0 +1,11 @@ +" Vim indent file +" Language: JSON5 +" Maintainer: The Vim Project +" Last Change: 2024-03-26 + +if exists("b:did_indent") + finish +endif + +" Same as jsonc indenting for now +runtime! indent/jsonc.vim -- cgit v1.2.3