view runtime/indent/chatito.vim @ 34221:f2d904d44ebd v9.1.0059

patch 9.1.0059: No event triggered before creating a window Commit: https://github.com/vim/vim/commit/1f47db75fdc8c53c5c778b26ecfa0942ac801f22 Author: Sergey Vlasov <sergey@vlasov.me> Date: Thu Jan 25 23:07:00 2024 +0100 patch 9.1.0059: No event triggered before creating a window Problem: No event is triggered before creating a window. (Sergey Vlasov) Solution: Add the WinNewPre event (Sergey Vlasov) fixes: #10635 closes: #12761 Signed-off-by: Sergey Vlasov <sergey@vlasov.me> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 25 Jan 2024 23:15:04 +0100
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