view runtime/indent/asm.vim @ 35050:ef62cd409cdd

runtime(asm): fix undefined variable in indent plugin Commit: https://github.com/vim/vim/commit/98b12ede31754071f36fb7a73324456c1ee7b89c Author: Christian Brabandt <cb@256bit.org> Date: Thu Apr 25 22:42:05 2024 +0200 runtime(asm): fix undefined variable in indent plugin It's an indent script, so we need to set the b:undo_indent variable instead of the b:undo_ftplugin var. fixes: #14602 Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Thu, 25 Apr 2024 22:45:03 +0200
parents 387127d40fa2
children 43739470fe40
line wrap: on
line source

" Vim indent file
" Language:	asm
" Maintainer:	Philip Jones <philj56@gmail.com>
" Upstream:	https://github.com/philj56/vim-asm-indent
" Last Change:	2017-Jul-01
"		2024 Apr 25 by Vim Project (undo_indent)

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

setlocal indentexpr=s:getAsmIndent()
setlocal indentkeys=<:>,!^F,o,O

let b:undo_indent = "indentexpr< indentkeys<"

function! s:getAsmIndent()
  let line = getline(v:lnum)
  let ind = shiftwidth()

  " If the line is a label (starts with ':' terminated keyword), 
  " then don't indent
  if line =~ '^\s*\k\+:'
    let ind = 0
  endif

  return ind
endfunction