view runtime/indent/sshconfig.vim @ 32647:f4a6b6c9b2cb v9.0.1655

patch 9.0.1655: syntax test fails when Vim window is not tall enough Commit: https://github.com/vim/vim/commit/2f43ec9363b8f4120609ef43841a5524fed0f7d7 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jun 23 22:59:26 2023 +0100 patch 9.0.1655: syntax test fails when Vim window is not tall enough Problem: Syntax test fails when Vim window is not tall enough. Solution: Make sure each terminal window is closed.
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Jun 2023 00:00:11 +0200
parents 74e3316c1d5a
children
line wrap: on
line source

" Vim indent file
" Language: ssh config file
" Maintainer: JasonKim <git@jasonk.me>
" Last Change: 2020 May 16

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

setlocal autoindent
setlocal indentexpr=GetSshconfigIndent(v:lnum)
setlocal indentkeys=o,O,*<Return>,0=~host\ ,0=~match\ ,0#,!^F

let b:undo_indent = "setlocal autoindent< indentexpr< indentkeys<"

if exists("*GetSshconfigIndent")
  finish
endif

function GetSshconfigIndent(lnum)
  let sw = shiftwidth()
  let prev_lnum = prevnonblank(a:lnum - 1)
  let curr_lnum = a:lnum
  let prev_line = getline(prev_lnum)
  let curr_line = getline(curr_lnum)
  if curr_line =~? '^\s*\(host\|match\)\s'
    return 0
  elseif prev_line =~? '^\s*\(host\|match\)\s'
    return sw
  else
    return indent(prev_lnum)
  endif
endfunction