Mercurial > vim
view runtime/indent/chaiscript.vim @ 34489:4dd6d243e4f7 v9.1.0152
patch 9.1.0152: Coverity complains about ignoring return value
Commit: https://github.com/vim/vim/commit/af7ae8160041e2d17c56945381e9370e7178e596
Author: Christian Brabandt <cb@256bit.org>
Date: Wed Mar 6 19:31:39 2024 +0100
patch 9.1.0152: Coverity complains about ignoring return value
Problem: Coverity complains about ignoring return value of win_split()
(after v9.1.150)
Solution: Check if win_split() failed, add winfixbuf.res to Makefile
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 06 Mar 2024 21:00:08 +0100 |
parents | 6dd88e45d47d |
children |
line wrap: on
line source
" Vim indent file " Language: ChaiScript " Maintainer: Jason Turner <lefticus 'at' gmail com> " Last Change: 2022 Apr 06 " Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif let b:did_indent = 1 setlocal indentexpr=GetChaiScriptIndent() setlocal autoindent let b:undo_indent = "setl ai< inde<" " Only define the function once. if exists("*GetChaiScriptIndent") finish endif function! GetChaiScriptIndent() " Find a non-blank line above the current line. let lnum = prevnonblank(v:lnum - 1) " Hit the start of the file, use zero indent. if lnum == 0 return 0 endif " Add a 'shiftwidth' after lines that start a block: " lines containing a { let ind = indent(lnum) let flag = 0 let prevline = getline(lnum) if prevline =~ '^.*{.*' let ind = ind + shiftwidth() let flag = 1 endif " Subtract a 'shiftwidth' after lines containing a { followed by a } " to keep it balanced if flag == 1 && prevline =~ '.*{.*}.*' let ind = ind - shiftwidth() endif " Subtract a 'shiftwidth' on lines ending with } if getline(v:lnum) =~ '^\s*\%(}\)' let ind = ind - shiftwidth() endif return ind endfunction