diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-05-20 16:59:09 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-05-20 16:59:09 +0200 |
commit | a688c66a049b12e7b19f6ab4cb27c5a24dc3d52c (patch) | |
tree | 4f21330aa69ea67c4b32ad89918034e375bd1e1c /indent | |
parent | 0a7c62b3b22a75f91245a718c1409e4216ae61c8 (diff) | |
download | vim-polyglot-a688c66a049b12e7b19f6ab4cb27c5a24dc3d52c.tar.gz vim-polyglot-a688c66a049b12e7b19f6ab4cb27c5a24dc3d52c.zip |
Update
Diffstat (limited to 'indent')
-rw-r--r-- | indent/ecrystal.vim | 38 | ||||
-rw-r--r-- | indent/rst.vim | 8 |
2 files changed, 20 insertions, 26 deletions
diff --git a/indent/ecrystal.vim b/indent/ecrystal.vim index adf64e89..0d474587 100644 --- a/indent/ecrystal.vim +++ b/indent/ecrystal.vim @@ -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('.')] -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 +function! s:MatchAt(lnum, col, pattern) abort + let idx = a:col - 1 + return match(getline(a:lnum), a:pattern, idx) == idx +endfunction - 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) diff --git a/indent/rst.vim b/indent/rst.vim index 8e228dfe..0eb0f9c6 100644 --- a/indent/rst.vim +++ b/indent/rst.vim @@ -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 |