Mercurial > vim
comparison runtime/indent/sshconfig.vim @ 20552:74e3316c1d5a
Update runtime files
Commit: https://github.com/vim/vim/commit/388a5d4f20b4b64341d1604aa238cab85827b892
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue May 26 21:20:45 2020 +0200
Update runtime files
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 26 May 2020 21:30:04 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
20551:f1b23a9643fe | 20552:74e3316c1d5a |
---|---|
1 " Vim indent file | |
2 " Language: ssh config file | |
3 " Maintainer: JasonKim <git@jasonk.me> | |
4 " Last Change: 2020 May 16 | |
5 | |
6 if exists("b:did_indent") | |
7 finish | |
8 endif | |
9 let b:did_indent = 1 | |
10 | |
11 setlocal autoindent | |
12 setlocal indentexpr=GetSshconfigIndent(v:lnum) | |
13 setlocal indentkeys=o,O,*<Return>,0=~host\ ,0=~match\ ,0#,!^F | |
14 | |
15 let b:undo_indent = "setlocal autoindent< indentexpr< indentkeys<" | |
16 | |
17 if exists("*GetSshconfigIndent") | |
18 finish | |
19 endif | |
20 | |
21 function GetSshconfigIndent(lnum) | |
22 let sw = shiftwidth() | |
23 let prev_lnum = prevnonblank(a:lnum - 1) | |
24 let curr_lnum = a:lnum | |
25 let prev_line = getline(prev_lnum) | |
26 let curr_line = getline(curr_lnum) | |
27 if curr_line =~? '^\s*\(host\|match\)\s' | |
28 return 0 | |
29 elseif prev_line =~? '^\s*\(host\|match\)\s' | |
30 return sw | |
31 else | |
32 return indent(prev_lnum) | |
33 endif | |
34 endfunction |