Commit: runtime(lua): fix whitespace style issues in lua ftplugin

5 views
Skip to first unread message

Christian Brabandt

unread,
Apr 7, 2025, 8:15:30 AM4/7/25
to vim...@googlegroups.com
runtime(lua): fix whitespace style issues in lua ftplugin

Commit: https://github.com/vim/vim/commit/2ffb4d0298426f6c57f3ec3caae4480024e4372d
Author: Christian Brabandt <c...@256bit.org>
Date: Mon Apr 7 14:07:28 2025 +0200

runtime(lua): fix whitespace style issues in lua ftplugin

related: https://github.com/vim/vim/issues/17049

Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/ftplugin/lua.vim b/runtime/ftplugin/lua.vim
index 87f54ddb6..33471cc64 100644
--- a/runtime/ftplugin/lua.vim
+++ b/runtime/ftplugin/lua.vim
@@ -1,13 +1,14 @@
" Vim filetype plugin file.
-" Language: Lua
-" Maintainer: Doug Kearns <dougk...@gmail.com>
-" Previous Maintainer: Max Ischenko <m...@ukr.net>
-" Contributor: Dorai Sitaram <ds...@gte.com>
-" C.D. MacEachern <craig.danie...@gmail.com>
-" Tyler Miller <tmi...@proton.me>
-" Phạm Bình An <phambinh...@gmail.com>
-" @konfekt
-" Last Change: 2025 Apr 04
+
+" Language: Lua
+" Maintainer: Doug Kearns <dougk...@gmail.com>
+" Previous Maintainer: Max Ischenko <m...@ukr.net>
+" Contributor: Dorai Sitaram <ds...@gte.com>
+" C.D. MacEachern <craig.danie...@gmail.com>
+" Tyler Miller <tmi...@proton.me>
+" Phạm Bình An <phambinh...@gmail.com>
+" @konfekt
+" Last Change: 2025 Apr 04

if exists("b:did_ftplugin")
finish
@@ -42,11 +43,11 @@ let b:undo_ftplugin = "setl cms< com< def< fo< inc< inex< sua<"
if exists("loaded_matchit") && !exists("b:match_words")
let b:match_ignorecase = 0
let b:match_words =
- \ '\<\%(do\|function\|if\)\>:' ..
- \ '\<\%(return\|else\|elseif\)\>:' ..
- \ '\<end\>,' ..
- \ '\<repeat\>:\<until\>,' ..
- \ '\%(--\)\=\[\(=*\)\[:] ]'
+ \ '\<\%(do\|function\|if\)\>:' ..
+ \ '\<\%(return\|else\|elseif\)\>:' ..
+ \ '\<end\>,' ..
+ \ '\<repeat\>:\<until\>,' ..
+ \ '\%(--\)\=\[\(=*\)\[:] ]'
let b:undo_ftplugin ..= " | unlet! b:match_words b:match_ignorecase"
endif

@@ -88,15 +89,15 @@ function s:LuaInclude(fname) abort
endfunction

let s:patterns = [
- \ ['do', 'end'],
- \ ['if\s+.+\s+then', 'end'],
- \ ['repeat', 'until\s+.+'],
- \ ['for\s+.+\s+do', 'end'],
- \ ['while\s+.+\s+do', 'end'],
- \ ['function.+', 'end'],
- \ ['return\s+function.+', 'end'],
- \ ['local\s+function\s+.+', 'end'],
- \ ]
+ \ ['do', 'end'],
+ \ ['if\s+.+\s+then', 'end'],
+ \ ['repeat', 'until\s+.+'],
+ \ ['for\s+.+\s+do', 'end'],
+ \ ['while\s+.+\s+do', 'end'],
+ \ ['function.+', 'end'],
+ \ ['return\s+function.+', 'end'],
+ \ ['local\s+function\s+.+', 'end'],
+ \ ]

function s:LuaFold() abort
if b:lua_lasttick == b:changedtick
@@ -114,17 +115,17 @@ function s:LuaFold() abort
let tagopen = ' ^\s*' .. t[0] ..'\s*$'
let tagend = ' ^\s*' .. t[1] ..'\s*$'
if line =~# tagopen
- call add(foldlist, t)
- let open = 1
- break
+ call add(foldlist, t)
+ let open = 1
+ break
elseif line =~# tagend
- if len(foldlist) > 0 && line =~# foldlist[-1][1]
- call remove(foldlist, -1)
- let end = 1
- else
- let foldlist = []
- endif
- break
+ if len(foldlist) > 0 && line =~# foldlist[-1][1]
+ call remove(foldlist, -1)
+ let end = 1
+ else
+ let foldlist = []
+ endif
+ break
endif
endfor
let prefix = ""
@@ -160,17 +161,17 @@ def s:LuaFold(): string
var tagopen = ' ^\s*' .. t[0] .. '\s*$'
var tagend = ' ^\s*' .. t[1] .. '\s*$'
if line =~# tagopen
- add(foldlist, t)
- open = 1
- break
+ add(foldlist, t)
+ open = 1
+ break
elseif line =~# tagend
- if len(foldlist) > 0 && line =~# foldlist[-1][1]
- end = 1
- remove(foldlist, -1)
- else
- foldlist = []
- endif
- break
+ if len(foldlist) > 0 && line =~# foldlist[-1][1]
+ end = 1
+ remove(foldlist, -1)
+ else
+ foldlist = []
+ endif
+ break
endif
endfor
var prefix = ""
@@ -183,4 +184,5 @@ enddef

let &cpo = s:cpo_save
unlet s:cpo_save
+
" vim: nowrap sw=2 sts=2 ts=8 noet:
Reply all
Reply to author
Forward
0 new messages