view runtime/indent/chatito.vim @ 33210:039954b5721d

runtime(doc): update help tags file Commit: https://github.com/vim/vim/commit/11d2aeeca4cf191b3f25b36603dcd32167eac8a0 Author: Christian Brabandt <cb@256bit.org> Date: Wed Sep 6 16:39:14 2023 +0200 runtime(doc): update help tags file Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 07 Sep 2023 08:30:05 +0200
parents 1e91e26ceebf
children
line wrap: on
line source

" Vim indent file
" Language:	Chatito
" Maintainer:	ObserverOfTime <chronobserver@disroot.org>
" Last Change:	2022 Sep 20

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

setlocal indentexpr=GetChatitoIndent()
setlocal indentkeys=o,O,*<Return>,0#,!^F

let b:undo_indent = 'setl inde< indk<'

if exists('*GetChatitoIndent')
    finish
endif

function GetChatitoIndent()
    let l:prev = v:lnum - 1
    if getline(prevnonblank(l:prev)) =~# '^[~%@]\['
        " shift indent after definitions
        return shiftwidth()
    elseif getline(l:prev) !~# '^\s*$'
        " maintain indent in sentences
        return indent(l:prev)
    else
        " reset indent after a blank line
        return 0
    end
endfunction