mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-10 04:23:51 -05:00
Update
This commit is contained in:
@@ -86,28 +86,20 @@ else
|
||||
endfunction
|
||||
endif
|
||||
|
||||
" Does the given pattern match at the cursor's position?
|
||||
function s:MatchCursor(pattern)
|
||||
return searchpos(a:pattern, 'cnz', line('.')) == [line('.'), col('.')]
|
||||
" Does the given pattern match at the given position?
|
||||
function! s:MatchAt(lnum, col, pattern) abort
|
||||
let idx = a:col - 1
|
||||
return match(getline(a:lnum), a:pattern, idx) == idx
|
||||
endfunction
|
||||
|
||||
" Does the given pattern match at the given position?
|
||||
function s:MatchAt(lnum, col, pattern)
|
||||
let pos = getcurpos()
|
||||
|
||||
try
|
||||
call cursor(a:lnum, a:col)
|
||||
let result = s:MatchCursor(a:pattern)
|
||||
finally
|
||||
call setpos('.', pos)
|
||||
endtry
|
||||
|
||||
return result
|
||||
" Does the given pattern match at the cursor's position?
|
||||
function! s:MatchCursor(pattern) abort
|
||||
return s:MatchAt(line('.'), col('.'), a:pattern)
|
||||
endfunction
|
||||
|
||||
" Is the cell at the given position part of a tag? If so, return the
|
||||
" position of the opening delimiter.
|
||||
function s:MatchECR(...)
|
||||
function! s:MatchECR(...) abort
|
||||
if a:0
|
||||
let lnum = a:1
|
||||
let col = a:2
|
||||
@@ -133,7 +125,7 @@ endfunction
|
||||
" If the cell at the given position is part of a control tag, return the
|
||||
" respective positions of the opening and closing delimiters for that
|
||||
" tag.
|
||||
function s:MatchECRControl(...)
|
||||
function! s:MatchECRControl(...) abort
|
||||
let pos = getcurpos()
|
||||
|
||||
if a:0
|
||||
@@ -175,7 +167,7 @@ endfunction
|
||||
|
||||
" Determine whether or not the control tag at the given position starts
|
||||
" an indent.
|
||||
function s:ECRIndent(...)
|
||||
function! s:ECRIndent(...) abort
|
||||
if a:0
|
||||
if type(a:1) == 0
|
||||
let [open, close] = s:MatchECRControl(a:1, a:2)
|
||||
@@ -237,7 +229,7 @@ endfunction
|
||||
|
||||
" Determine if the control tag at the given position ends an indent or
|
||||
" not.
|
||||
function s:ECRDedent(...)
|
||||
function! s:ECRDedent(...) abort
|
||||
if a:0
|
||||
if type(a:1) == 0
|
||||
let [open, close] = s:MatchECRControl(a:1, a:2)
|
||||
@@ -297,7 +289,7 @@ function s:ECRDedent(...)
|
||||
endfunction
|
||||
|
||||
" Find and match a control tag in the given line, if one exists.
|
||||
function s:FindECRControl(...)
|
||||
function! s:FindECRControl(...) abort
|
||||
let lnum = a:0 ? a:1 : line('.')
|
||||
|
||||
let open = { 'lnum': 0, 'col': 0 }
|
||||
@@ -324,7 +316,7 @@ endfunction
|
||||
" This takes two arguments: the first is the line to start searching
|
||||
" from (exclusive); the second is the line to stop searching at
|
||||
" (inclusive).
|
||||
function s:FindPrevECRControl(...)
|
||||
function! s:FindPrevECRControl(...) abort
|
||||
if a:0 == 0
|
||||
let start = line('.')
|
||||
let stop = 1
|
||||
@@ -369,7 +361,7 @@ endfunction
|
||||
" GetEcrystalIndent {{{1
|
||||
" =================
|
||||
|
||||
function GetEcrystalIndent() abort
|
||||
function! GetEcrystalIndent() abort
|
||||
let prev_lnum = prevnonblank(v:lnum - 1)
|
||||
|
||||
if b:ecrystal_indent_multiline
|
||||
@@ -461,7 +453,7 @@ endfunction
|
||||
" GetEcrystalFold {{{1
|
||||
" ===============
|
||||
|
||||
function GetEcrystalFold() abort
|
||||
function! GetEcrystalFold() abort
|
||||
let fold = '='
|
||||
|
||||
let col = crystal#indent#Match(v:lnum, s:ecr_control_open)
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rst') == -1
|
||||
|
||||
" Vim indent file
|
||||
" Language: reStructuredText Documentation Format
|
||||
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2011-08-03
|
||||
" Vim reST indent file
|
||||
" Language: reStructuredText Documentation Format
|
||||
" Maintainer: Marshall Ward <marshall.ward@gmail.com>
|
||||
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2020-03-31
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
|
||||
Reference in New Issue
Block a user