mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
parent
79b92da0d2
commit
bddce4b0ff
6
runtime/autoload/dist/ft.vim
vendored
6
runtime/autoload/dist/ft.vim
vendored
@ -1,7 +1,7 @@
|
||||
" Vim functions for file type detection
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2022 Jan 28
|
||||
" Last Change: 2022 Jan 31
|
||||
|
||||
" These functions are moved here from runtime/filetype.vim to make startup
|
||||
" faster.
|
||||
@ -67,7 +67,7 @@ func dist#ft#FTasmsyntax()
|
||||
endif
|
||||
endfunc
|
||||
|
||||
func dist#ft#FTbas()
|
||||
func dist#ft#FTbas(alt = '')
|
||||
if exists("g:filetype_bas")
|
||||
exe "setf " . g:filetype_bas
|
||||
return
|
||||
@ -88,6 +88,8 @@ func dist#ft#FTbas()
|
||||
setf qb64
|
||||
elseif match(lines, '\cVB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)') > -1
|
||||
setf vb
|
||||
elseif a:alt != ''
|
||||
exe 'setf ' .. a:alt
|
||||
else
|
||||
setf basic
|
||||
endif
|
||||
|
@ -771,6 +771,15 @@ You can set the indent for the first line after <script> and <style>
|
||||
"auto" auto indent (same indent as the blocktag)
|
||||
"inc" auto indent + one indent step
|
||||
|
||||
You can set the indent for attributes after an open <tag line: >
|
||||
|
||||
:let g:html_indent_attribute = 1
|
||||
<
|
||||
VALUE MEANING ~
|
||||
1 auto indent, one indent step more than <tag
|
||||
2 auto indent, two indent steps (default)
|
||||
> 2 auto indent, more indent steps
|
||||
|
||||
Many tags increase the indent for what follows per default (see "Add Indent
|
||||
Tags" in the script). You can add further tags with: >
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
" Vim support file to detect file types
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2022 Jan 29
|
||||
" Last Change: 2022 Jan 31
|
||||
|
||||
" Listen very carefully, I will say this only once
|
||||
if exists("did_load_filetypes")
|
||||
@ -2050,7 +2050,7 @@ au BufRead,BufNewFile *.hw,*.module,*.pkg
|
||||
\ endif
|
||||
|
||||
" Visual Basic (also uses *.bas) or FORM
|
||||
au BufNewFile,BufRead *.frm call dist#ft#FTVB("form")
|
||||
au BufNewFile,BufRead *.frm call dist#ft#FTbas('form')
|
||||
|
||||
" SaxBasic is close to Visual Basic
|
||||
au BufNewFile,BufRead *.sba setf vb
|
||||
|
@ -1,7 +1,7 @@
|
||||
" Vim indent script for HTML
|
||||
" Maintainer: Bram Moolenaar
|
||||
" Original Author: Andy Wokula <anwoku@yahoo.de>
|
||||
" Last Change: 2021 Jun 13
|
||||
" Last Change: 2022 Jan 31
|
||||
" Version: 1.0 "{{{
|
||||
" Description: HTML indent script with cached state for faster indenting on a
|
||||
" range of lines.
|
||||
@ -149,6 +149,15 @@ func HtmlIndent_CheckUserSettings()
|
||||
let b:html_indent_line_limit = 200
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists('b:html_indent_attribute')
|
||||
let b:hi_attr_indent = b:html_indent_attribute
|
||||
elseif exists('g:html_indent_attribute')
|
||||
let b:hi_attr_indent = g:html_indent_attribute
|
||||
else
|
||||
let b:hi_attr_indent = 2
|
||||
endif
|
||||
|
||||
endfunc "}}}
|
||||
|
||||
" Init Script Vars
|
||||
@ -946,11 +955,11 @@ func s:InsideTag(foundHtmlString)
|
||||
let idx = match(text, '<' . s:tagname . '\s\+\zs\w')
|
||||
endif
|
||||
if idx == -1
|
||||
" after just "<tag" indent two levels more
|
||||
" after just "<tag" indent two levels more by default
|
||||
let idx = match(text, '<' . s:tagname . '$')
|
||||
if idx >= 0
|
||||
call cursor(lnum, idx + 1)
|
||||
return virtcol('.') - 1 + shiftwidth() * 2
|
||||
return virtcol('.') - 1 + shiftwidth() * b:hi_attr_indent
|
||||
endif
|
||||
endif
|
||||
if idx > 0
|
||||
|
@ -1,4 +1,4 @@
|
||||
" vim: set ft=html sw=4 :
|
||||
" vim: set ft=html sw=4 ts=8 :
|
||||
|
||||
|
||||
" START_INDENT
|
||||
@ -41,6 +41,11 @@ dd text
|
||||
dt text
|
||||
</dt>
|
||||
</dl>
|
||||
<div
|
||||
class="test"
|
||||
style="color: yellow">
|
||||
text
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -50,6 +55,7 @@ dt text
|
||||
% START_INDENT
|
||||
% INDENT_EXE let g:html_indent_style1 = "inc"
|
||||
% INDENT_EXE let g:html_indent_script1 = "zero"
|
||||
% INDENT_EXE let g:html_indent_attribute = 1
|
||||
% INDENT_EXE call HtmlIndent_CheckUserSettings()
|
||||
<html>
|
||||
<body>
|
||||
@ -61,6 +67,11 @@ div#d2 { color: green; }
|
||||
var v1 = "v1";
|
||||
var v2 = "v2";
|
||||
</script>
|
||||
<div
|
||||
class="test"
|
||||
style="color: yellow">
|
||||
text
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
% END_INDENT
|
||||
|
@ -1,4 +1,4 @@
|
||||
" vim: set ft=html sw=4 :
|
||||
" vim: set ft=html sw=4 ts=8 :
|
||||
|
||||
|
||||
" START_INDENT
|
||||
@ -41,6 +41,11 @@ div#d2 { color: green; }
|
||||
dt text
|
||||
</dt>
|
||||
</dl>
|
||||
<div
|
||||
class="test"
|
||||
style="color: yellow">
|
||||
text
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -50,6 +55,7 @@ div#d2 { color: green; }
|
||||
% START_INDENT
|
||||
% INDENT_EXE let g:html_indent_style1 = "inc"
|
||||
% INDENT_EXE let g:html_indent_script1 = "zero"
|
||||
% INDENT_EXE let g:html_indent_attribute = 1
|
||||
% INDENT_EXE call HtmlIndent_CheckUserSettings()
|
||||
<html>
|
||||
<body>
|
||||
@ -61,6 +67,11 @@ div#d2 { color: green; }
|
||||
var v1 = "v1";
|
||||
var v2 = "v2";
|
||||
</script>
|
||||
<div
|
||||
class="test"
|
||||
style="color: yellow">
|
||||
text
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
% END_INDENT
|
||||
|
@ -789,7 +789,7 @@ local extension = {
|
||||
ex = function() vim.fn["dist#ft#ExCheck"]() end,
|
||||
exu = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
|
||||
exw = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
|
||||
frm = function() vim.fn["dist#ft#FTVB"]("form") end,
|
||||
frm = function() vim.fn["dist#ft#FTbas"]("form") end,
|
||||
fs = function() vim.fn["dist#ft#FTfs"]() end,
|
||||
h = function() vim.fn["dist#ft#FTheader"]() end,
|
||||
htm = function() vim.fn["dist#ft#FThtml"]() end,
|
||||
|
Loading…
Reference in New Issue
Block a user