forked from aniani/vim
patch 9.0.1766: Runtime: Missing QML support
Problem: Runtime: Missing QML support Solution: Add QML support to Vim closes: #12810 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: ChaseKnowlden <haroldknowlden@gmail.com>
This commit is contained in:
parent
a055b441f5
commit
bedc69f9d6
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
@ -192,6 +192,7 @@ runtime/ftplugin/ps1xml.vim @heaths
|
||||
runtime/ftplugin/pymanifest.vim @ObserverOfTime
|
||||
runtime/ftplugin/python.vim @tpict
|
||||
runtime/ftplugin/qb64.vim @dkearns
|
||||
runtime/ftplugin/qml.vim @ChaseKnowlden
|
||||
runtime/ftplugin/r.vim @jalvesaq
|
||||
runtime/ftplugin/racket.vim @benknoble
|
||||
runtime/ftplugin/readline.vim @dkearns
|
||||
@ -284,6 +285,7 @@ runtime/indent/postscr.vim @mrdubya
|
||||
runtime/indent/prolog.vim @dkearns
|
||||
runtime/indent/ps1.vim @heaths
|
||||
runtime/indent/qb64.vim @dkearns
|
||||
runtime/indent/qml.vim @ChaseKnowlden
|
||||
runtime/indent/r.vim @jalvesaq
|
||||
runtime/indent/racket.vim @benknoble
|
||||
runtime/indent/rapid.vim @KnoP-01
|
||||
@ -443,6 +445,7 @@ runtime/syntax/ps1xml.vim @heaths
|
||||
runtime/syntax/psl.vim @danielkho
|
||||
runtime/syntax/pymanifest.vim @ObserverOfTime
|
||||
runtime/syntax/qb64.vim @dkearns
|
||||
runtime/syntax/qml.vim @ChaseKnowlden
|
||||
runtime/syntax/r.vim @jalvesaq
|
||||
runtime/syntax/racket.vim @benknoble
|
||||
runtime/syntax/raml.vim @in3d
|
||||
|
@ -1708,6 +1708,9 @@ au BufNewFile,BufRead *.ptl,*.pyi,SConstruct setf python
|
||||
" QL
|
||||
au BufRead,BufNewFile *.ql,*.qll setf ql
|
||||
|
||||
" QML
|
||||
au BufRead,BufNewFile *.qml,*.qbs setf qml
|
||||
|
||||
" QMLdir
|
||||
au BufRead,BufNewFile qmldir setf qmldir
|
||||
|
||||
|
31
runtime/ftplugin/qml.vim
Normal file
31
runtime/ftplugin/qml.vim
Normal file
@ -0,0 +1,31 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: QML
|
||||
" Maintainer: Chase Knowlden <haroldknowlden@gmail.com>
|
||||
" Last Change: 2023 Aug 16
|
||||
|
||||
if exists( 'b:did_ftplugin' )
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let s:cpoptions_save = &cpoptions
|
||||
set cpoptions&vim
|
||||
|
||||
" command for undo
|
||||
let b:undo_ftplugin = "setlocal formatoptions< comments< commentstring<"
|
||||
|
||||
if (has("gui_win32") || has("gui_gtk")) && !exists( 'b:browsefilter' )
|
||||
let b:browsefilter =
|
||||
\ 'QML Files (*.qml,*.qbs)\t*.qml;*.qbs\n' .
|
||||
\ 'All Files\t*\n'
|
||||
endif
|
||||
|
||||
" Set 'comments' to format dashed lists in comments.
|
||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
|
||||
setlocal commentstring=//%s
|
||||
|
||||
setlocal formatoptions-=t
|
||||
setlocal formatoptions+=croql
|
||||
|
||||
let &cpoptions = s:cpoptions_save
|
||||
unlet s:cpoptions_save
|
59
runtime/indent/qml.vim
Normal file
59
runtime/indent/qml.vim
Normal file
@ -0,0 +1,59 @@
|
||||
" Vim indent file
|
||||
" Language: QML
|
||||
" Maintainer: Chase Knowlden <haroldknowlden@gmail.com>
|
||||
" Last Change: 2023 Aug 16
|
||||
"
|
||||
" Improved JavaScript indent script.
|
||||
|
||||
" Indent script in place for this already?
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
let b:undo_indent = "setlocal indentexpr< indentkeys<"
|
||||
|
||||
setlocal indentexpr=s:GetQmlIndent()
|
||||
setlocal indentkeys=0{,0},0),0],:,!^F,o,O,e,*<Return>,=*/
|
||||
|
||||
" Only define functions once per session
|
||||
if exists("*s:GetQmlIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Clean up a line of code by removing trailing '//' and '/* */' comments, and trimming
|
||||
" whitespace
|
||||
function! s:Trim(line)
|
||||
return substitute(substitute(substitute(a:line, '// .*', '', ''), '/\* .* \*/', '', ''), '^\s*\|\s*$', '', 'g')
|
||||
endfunction
|
||||
|
||||
function! s:GetQmlIndent()
|
||||
let num = v:lnum
|
||||
let line = s:Trim(getline(num))
|
||||
|
||||
let pnum = prevnonblank(num - 1)
|
||||
if pnum == 0
|
||||
return 0
|
||||
endif
|
||||
let pline = s:Trim(getline(pnum))
|
||||
|
||||
let ind = indent(pnum)
|
||||
|
||||
" bracket/brace/paren blocks
|
||||
if pline =~ '[{[(]$'
|
||||
let ind += &sw
|
||||
endif
|
||||
if line =~ '^[}\])]'
|
||||
let ind -= &sw
|
||||
endif
|
||||
|
||||
" '/*' comments
|
||||
if pline =~ '^/\*.*\*/'
|
||||
" no indent for single-line form
|
||||
elseif pline =~ '^/\*'
|
||||
let ind += 1
|
||||
elseif pline =~ '^\*/'
|
||||
let ind -= 1
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
1130
runtime/syntax/qml.vim
Normal file
1130
runtime/syntax/qml.vim
Normal file
File diff suppressed because it is too large
Load Diff
@ -551,6 +551,7 @@ def s:GetFilenameChecks(): dict<list<string>>
|
||||
pyrex: ['file.pyx', 'file.pxd'],
|
||||
python: ['file.py', 'file.pyw', '.pythonstartup', '.pythonrc', 'file.ptl', 'file.pyi', 'SConstruct'],
|
||||
ql: ['file.ql', 'file.qll'],
|
||||
qml: ['file.qml', 'file.qbs'],
|
||||
qmldir: ['qmldir'],
|
||||
quake: ['anybaseq2/file.cfg', 'anyid1/file.cfg', 'quake3/file.cfg', 'baseq2/file.cfg', 'id1/file.cfg', 'quake1/file.cfg', 'some-baseq2/file.cfg', 'some-id1/file.cfg', 'some-quake1/file.cfg'],
|
||||
quarto: ['file.qmd'],
|
||||
|
@ -695,6 +695,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1766,
|
||||
/**/
|
||||
1765,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user