neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

context.vim (752B)


      1 " ConTeXt indent file
      2 " Language: ConTeXt typesetting engine
      3 " Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com>
      4 " Last Change:  2016 Oct 15
      5 
      6 if exists("b:did_indent")
      7  finish
      8 endif
      9 
     10 if !get(b:, 'context_metapost', get(g:, 'context_metapost', 1))
     11  finish
     12 endif
     13 
     14 " Load MetaPost indentation script
     15 runtime! indent/mp.vim
     16 
     17 let s:keepcpo= &cpo
     18 set cpo&vim
     19 
     20 setlocal indentexpr=GetConTeXtIndent()
     21 
     22 let b:undo_indent = "setl indentexpr<"
     23 
     24 function! GetConTeXtIndent()
     25  " Use MetaPost rules inside MetaPost graphic environments
     26  if len(synstack(v:lnum, 1)) > 0 &&
     27        \ synIDattr(synstack(v:lnum, 1)[0], "name") ==# 'contextMPGraphic'
     28    return GetMetaPostIndent()
     29  endif
     30  return -1
     31 endfunc
     32 
     33 let &cpo = s:keepcpo
     34 unlet s:keepcpo
     35 
     36 " vim:sw=2