diff options
Diffstat (limited to 'indent')
| -rw-r--r-- | indent/graphql.vim | 21 | ||||
| -rw-r--r-- | indent/rst.vim | 14 | 
2 files changed, 34 insertions, 1 deletions
diff --git a/indent/graphql.vim b/indent/graphql.vim index 94e1726a..48090bbd 100644 --- a/indent/graphql.vim +++ b/indent/graphql.vim @@ -1,6 +1,25 @@  if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'graphql') == -1 -" Vim indent file +" Copyright (c) 2016-2019 Jon Parise <jon@indelible.org> +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to +" deal in the Software without restriction, including without limitation the +" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +" sell copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in +" all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +" IN THE SOFTWARE. +"  " Language: GraphQL  " Maintainer: Jon Parise <jon@indelible.org> diff --git a/indent/rst.vim b/indent/rst.vim index df7287ea..8e228dfe 100644 --- a/indent/rst.vim +++ b/indent/rst.vim @@ -20,6 +20,13 @@ endif  let s:itemization_pattern = '^\s*[-*+]\s'  let s:enumeration_pattern = '^\s*\%(\d\+\|#\)\.\s\+' +let s:note_pattern = '^\.\. ' + +function! s:get_paragraph_start() +    let paragraph_mark_start = getpos("'{")[1] +    return getline(paragraph_mark_start) =~ +        \ '\S' ? paragraph_mark_start : paragraph_mark_start + 1 +endfunction  function GetRSTIndent()    let lnum = prevnonblank(v:lnum - 1) @@ -30,6 +37,13 @@ function GetRSTIndent()    let ind = indent(lnum)    let line = getline(lnum) +  let psnum = s:get_paragraph_start() +  if psnum != 0 +      if getline(psnum) =~ s:note_pattern +          let ind = 3 +      endif +  endif +    if line =~ s:itemization_pattern      let ind += 2    elseif line =~ s:enumeration_pattern  | 
