Update runtime files
This commit is contained in:
21
runtime/autoload/dist/vimindent.vim
vendored
21
runtime/autoload/dist/vimindent.vim
vendored
@ -2,7 +2,7 @@ vim9script
|
||||
|
||||
# Language: Vim script
|
||||
# Maintainer: github user lacygoill
|
||||
# Last Change: 2022 Sep 24
|
||||
# Last Change: 2022 Oct 15
|
||||
|
||||
# NOTE: Whenever you change the code, make sure the tests are still passing:
|
||||
#
|
||||
@ -156,7 +156,7 @@ const ASSIGNS_HEREDOC: string = $'^\%({COMMENT}\)\@!.*\%({HEREDOC_OPERATOR}\)\s\
|
||||
|
||||
# CD_COMMAND {{{3
|
||||
|
||||
const CD_COMMAND: string = $'[lt]\=cd!\=\s\+-{END_OF_COMMAND}'
|
||||
const CD_COMMAND: string = $'\<[lt]\=cd!\=\s\+-{END_OF_COMMAND}'
|
||||
|
||||
# HIGHER_ORDER_COMMAND {{{3
|
||||
|
||||
@ -178,7 +178,7 @@ const HIGHER_ORDER_COMMAND: string = $'\%(^\|{BAR_SEPARATION}\)\s*\<\%(' .. patt
|
||||
|
||||
# MAPPING_COMMAND {{{3
|
||||
|
||||
const MAPPING_COMMAND: string = '\%(\<sil\%[ent]!\=\s\+\)\=[nvxsoilct]\=\%(nore\|un\)map!\=\s'
|
||||
const MAPPING_COMMAND: string = '\%(\<sil\%[ent]!\=\s\+\)\=\<[nvxsoilct]\=\%(nore\|un\)map!\=\s'
|
||||
|
||||
# NORMAL_COMMAND {{{3
|
||||
|
||||
@ -222,7 +222,7 @@ END
|
||||
|
||||
const ENDS_BLOCK_OR_CLAUSE: string = '^\s*\%(' .. patterns->join('\|') .. $'\){END_OF_COMMAND}'
|
||||
.. $'\|^\s*cat\%[ch]\%(\s\+\({PATTERN_DELIMITER}\).*\1\)\={END_OF_COMMAND}'
|
||||
.. $'\|^\s*elseif\=\s\+\%({OPERATOR}\)\@!'
|
||||
.. $'\|^\s*elseif\=\>\%({OPERATOR}\)\@!'
|
||||
|
||||
# STARTS_CURLY_BLOCK {{{3
|
||||
|
||||
@ -354,7 +354,7 @@ const LINE_CONTINUATION_AT_SOL: string = '^\s*\%('
|
||||
const RANGE_AT_SOL: string = '^\s*:\S'
|
||||
# }}}1
|
||||
# Interface {{{1
|
||||
export def Expr(lnum: number): number # {{{2
|
||||
export def Expr(lnum = v:lnum): number # {{{2
|
||||
# line which is indented
|
||||
var line_A: dict<any> = {text: getline(lnum), lnum: lnum}
|
||||
# line above, on which we'll base the indent of line A
|
||||
@ -409,6 +409,7 @@ export def Expr(lnum: number): number # {{{2
|
||||
line_A->CacheBracketBlock()
|
||||
endif
|
||||
if line_A.lnum->IsInside('BracketBlock')
|
||||
var is_in_curly_block: bool = IsInCurlyBlock()
|
||||
for block: dict<any> in b:vimindent.block_stack
|
||||
if line_A.lnum <= block.startlnum
|
||||
continue
|
||||
@ -416,8 +417,7 @@ export def Expr(lnum: number): number # {{{2
|
||||
if !block->has_key('startindent')
|
||||
block.startindent = Indent(block.startlnum)
|
||||
endif
|
||||
if !block.is_curly_block
|
||||
&& !b:vimindent.block_stack[0].is_curly_block
|
||||
if !is_in_curly_block
|
||||
return BracketBlockIndent(line_A, block)
|
||||
endif
|
||||
endfor
|
||||
@ -520,7 +520,7 @@ enddef
|
||||
|
||||
def g:GetVimIndent(): number # {{{2
|
||||
# for backward compatibility
|
||||
return Expr(v:lnum)
|
||||
return Expr()
|
||||
enddef
|
||||
# }}}1
|
||||
# Core {{{1
|
||||
@ -997,6 +997,11 @@ def IsRightBelow(lnum: number, syntax: string): bool # {{{3
|
||||
&& lnum > b:vimindent.endlnum
|
||||
enddef
|
||||
|
||||
def IsInCurlyBlock(): bool # {{{3
|
||||
return b:vimindent.block_stack
|
||||
->indexof((_, block: dict<any>): bool => block.is_curly_block) >= 0
|
||||
enddef
|
||||
|
||||
def IsInThisBlock(line_A: dict<any>, lnum: number): bool # {{{3
|
||||
var pos: list<number> = getcurpos()
|
||||
cursor(lnum, [lnum, '$']->col())
|
||||
|
||||
@ -1791,8 +1791,10 @@ fun! s:NetrwOptionsRestore(vt)
|
||||
" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>"))
|
||||
if !exists("{a:vt}netrw_optionsave")
|
||||
" call Decho("case ".a:vt."netrw_optionsave : doesn't exist",'~'.expand("<slnum>"))
|
||||
" call Decho("..doing filetype detect anyway")
|
||||
filetype detect
|
||||
if !isdirectory(expand('%'))
|
||||
" call Decho("..doing filetype detect anyway")
|
||||
filetype detect
|
||||
endif
|
||||
" call Decho("..settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>"))
|
||||
" call Decho("..ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>"))
|
||||
" call Dret("s:NetrwOptionsRestore : ".a:vt."netrw_optionsave doesn't exist")
|
||||
@ -1904,9 +1906,11 @@ fun! s:NetrwOptionsRestore(vt)
|
||||
" were having their filetype detect-generated settings overwritten by
|
||||
" NetrwOptionRestore.
|
||||
if &ft != "netrw"
|
||||
" call Decho("before: filetype detect (ft=".&ft.")",'~'.expand("<slnum>"))
|
||||
filetype detect
|
||||
" call Decho("after : filetype detect (ft=".&ft.")",'~'.expand("<slnum>"))
|
||||
if !isdirectory(expand('%'))
|
||||
" call Decho("before: filetype detect (ft=".&ft.")",'~'.expand("<slnum>"))
|
||||
filetype detect
|
||||
" call Decho("after : filetype detect (ft=".&ft.")",'~'.expand("<slnum>"))
|
||||
endif
|
||||
endif
|
||||
" call Decho("(s:NetrwOptionsRestore) lines=".&lines)
|
||||
" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>"))
|
||||
|
||||
Reference in New Issue
Block a user