view runtime/indent/treetop.vim @ 28586:3fd992496509 v8.2.4817

patch 8.2.4817: Win32 GUI: modifiers are not always used Commit: https://github.com/vim/vim/commit/45684c6ec458c43e20db0b2f5f19ce000d34dbd5 Author: LemonBoy <thatlemon@gmail.com> Date: Sun Apr 24 15:46:42 2022 +0100 patch 8.2.4817: Win32 GUI: modifiers are not always used Problem: Win32 GUI: modifiers are not always used. Solution: Handle more modifiers. (closes https://github.com/vim/vim/issues/10269)
author Bram Moolenaar <Bram@vim.org>
date Sun, 24 Apr 2022 17:00:02 +0200
parents 11b656e74444
children 4d76b3e07c07
line wrap: on
line source

" Vim indent file
" Language:             Treetop
" Previous Maintainer:  Nikolai Weibull <now@bitwi.se>
" Latest Revision:      2011-03-14

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

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