Mercurial > vim
view runtime/indent/config.vim @ 34303:7c95f913fdd6 v9.1.0086
patch 9.1.0086: Problem when scrolling using slow touchpads scroll event
Commit: https://github.com/vim/vim/commit/725c7c31a4c7603e688511d769b0addaab442d07
Author: lilydjwg <lilydjwg@gmail.com>
Date: Fri Feb 9 19:24:23 2024 +0100
patch 9.1.0086: Problem when scrolling using slow touchpads scroll event
Problem: Problem when scrolling using slow touchpads scroll event
Solution: better ways to determine if a smooth scroll has ended (when
available) (lilydjwg)
related: #13997
Signed-off-by: lilydjwg <lilydjwg@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 09 Feb 2024 19:30:04 +0100 |
parents | 9c221ad9634a |
children |
line wrap: on
line source
" Vim indent file " Language: Autoconf configure.{ac,in} file " Maintainer: Doug Kearns <dougkearns@gmail.com> " Previous Maintainer: Nikolai Weibull <now@bitwi.se> " Last Change: 24 Sep 2021 " TODO: how about nested [()]'s in one line what's wrong with '\\\@!'? " Only load this indent file when no other was loaded. if exists("b:did_indent") finish endif runtime! indent/sh.vim " will set b:did_indent setlocal indentexpr=GetConfigIndent() setlocal indentkeys=!^F,o,O,=then,=do,=else,=elif,=esac,=fi,=fin,=fil,=done setlocal nosmartindent let b:undo_indent = "setl inde< indk< si<" " Only define the function once. if exists("*GetConfigIndent") finish endif " get the offset (indent) of the end of the match of 'regexp' in 'line' function s:GetOffsetOf(line, regexp) let end = matchend(a:line, a:regexp) let width = 0 let i = 0 while i < end if a:line[i] != "\t" let width = width + 1 else let width = width + &ts - (width % &ts) endif let i = i + 1 endwhile return width endfunction function GetConfigIndent() " 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 " where to put this let ind = GetShIndent() let line = getline(lnum) " if previous line has unmatched, unescaped opening parentheses, " indent to its position. TODO: not failsafe if multiple ('s if line =~ '\\\@<!([^)]*$' let ind = s:GetOffsetOf(line, '\\\@!(') endif " if previous line has unmatched opening bracket, " indent to its position. TODO: same as above if line =~ '\[[^]]*$' let ind = s:GetOffsetOf(line, '\[') endif " if previous line had an unmatched closing parentheses, " indent to the matching opening parentheses if line =~ '[^(]\+\\\@<!)$' call search(')', 'bW') let lnum = searchpair('\\\@<!(', '', ')', 'bWn') let ind = indent(lnum) endif " if previous line had an unmatched closing bracket, " indent to the matching opening bracket if line =~ '[^[]\+]$' call search(']', 'bW') let lnum = searchpair('\[', '', ']', 'bWn') let ind = indent(lnum) endif return ind endfunction