view runtime/indent/treetop.vim @ 29060:a8c0c5865e73 v8.2.5052

patch 8.2.5052: CI checkout step title is a bit cryptic Commit: https://github.com/vim/vim/commit/bfaa24f95343af9c058696644375d04e660f1b00 Author: Philip H <47042125+pheiduck@users.noreply.github.com> Date: Wed Jun 1 21:26:34 2022 +0100 patch 8.2.5052: CI checkout step title is a bit cryptic Problem: CI checkout step title is a bit cryptic. Solution: Add a better title. (closes https://github.com/vim/vim/issues/10509)
author Bram Moolenaar <Bram@vim.org>
date Wed, 01 Jun 2022 22:30:03 +0200
parents 4d76b3e07c07
children
line wrap: on
line source

" Vim indent file
" Language:		Treetop
" Maintainer:		Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer:	Nikolai Weibull <now@bitwi.se>
" Last Change:		2022 April 25

if exists("b:did_indent")
  finish
endif
let b:did_indent = 1

setlocal indentexpr=GetTreetopIndent()
setlocal indentkeys=0{,0},!^F,o,O,=end
setlocal nosmartindent

let b:undo_indent = "setl inde< indk< si<"

if exists("*GetTreetopIndent")
  finish
endif

function GetTreetopIndent()
  let pnum = prevnonblank(v:lnum - 1)
  if pnum == 0
    return 0
  endif

  let ind = indent(pnum)
  let line = getline(pnum)

  if line =~ '^\s*\%(grammar\|module\|rule\)\>'
    let ind += shiftwidth()
  endif

  let line = getline(v:lnum)
  if line =~ '^\s*end\>'
    let ind -= shiftwidth()
  end

  return ind
endfunction