view runtime/indent/readline.vim @ 16692:2e689fb67c91 v8.1.1348

patch 8.1.1348: running tests may cause the window to move commit https://github.com/vim/vim/commit/f8191c5f07c650b75b85c5a5b3d000fd5cae1643 Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 18 17:22:54 2019 +0200 patch 8.1.1348: running tests may cause the window to move Problem: Running tests may cause the window to move. Solution: Correct the reported window position for the offset with the position after ":winpos". Works around an xterm bug.
author Bram Moolenaar <Bram@vim.org>
date Sat, 18 May 2019 17:30:05 +0200
parents d0a20101ecb2
children 9c221ad9634a
line wrap: on
line source

" Vim indent file
" Language:             readline configuration file
" Previous Maintainer:  Nikolai Weibull <now@bitwi.se>
" Latest Revision:      2006-12-20

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

setlocal indentexpr=GetReadlineIndent()
setlocal indentkeys=!^F,o,O,=$else,=$endif
setlocal nosmartindent

if exists("*GetReadlineIndent")
  finish
endif

function GetReadlineIndent()
  let lnum = prevnonblank(v:lnum - 1)
  if lnum == 0
    return 0
  endif

  let ind = indent(lnum)

  if getline(lnum) =~ '^\s*$\(if\|else\)\>'
    let ind = ind + shiftwidth()
  endif

  if getline(v:lnum) =~ '^\s*$\(else\|endif\)\>'
    let ind = ind - shiftwidth()
  endif

  return ind
endfunction