view runtime/indent/readline.vim @ 11123:9bfc9d7b07a7 v8.0.0449

patch 8.0.0449: part of fold patch accidentally included commit https://github.com/vim/vim/commit/abb4d5f73fd97d8f3c3e32311959929820e74b54 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 12 18:32:32 2017 +0100 patch 8.0.0449: part of fold patch accidentally included Problem: Part of fold patch accidentally included. Solution: Revert that part of the patch.
author Christian Brabandt <cb@256bit.org>
date Sun, 12 Mar 2017 18:45:04 +0100
parents 1218c5353e2b
children d0a20101ecb2
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 + &sw
  endif

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

  return ind
endfunction