Mercurial > vim
view runtime/indent/treetop.vim @ 31412:742b7bf2fefc v9.0.1039
patch 9.0.1039: using a <Cmd> mapping CmdlineChanged may be triggered twice
Commit: https://github.com/vim/vim/commit/bb393d8259af8aec095e96d81624a16ed9f25005
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Dec 9 12:21:50 2022 +0000
patch 9.0.1039: using a <Cmd> mapping CmdlineChanged may be triggered twice
Problem: Using a <Cmd> mapping CmdlineChanged may be triggered twice.
Solution: Count the number of times CmdlineChanged is triggered and avoid
doing it twice. (closes #116820
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 09 Dec 2022 13:30:05 +0100 |
parents | 4d76b3e07c07 |
children |
line wrap: on
line source
" Vim indent file " Language: Treetop " Maintainer: Doug Kearns <dougkearns@gmail.com> " Previous Maintainer: Nikolai Weibull <now@bitwi.se> " Last Change: 2022 April 25 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 let b:undo_indent = "setl inde< indk< si<" 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