annotate runtime/indent/sshconfig.vim @ 24457:23abff698ca5

Added tag v8.2.2768 for changeset c70dcd5ab837a1a9583d2459cbe521096f20c949
author Bram Moolenaar <Bram@vim.org>
date Thu, 15 Apr 2021 13:45:05 +0200
parents 74e3316c1d5a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20552
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim indent file
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Language: ssh config file
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Maintainer: JasonKim <git@jasonk.me>
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Last Change: 2020 May 16
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 if exists("b:did_indent")
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 finish
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 endif
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 let b:did_indent = 1
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 setlocal autoindent
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 setlocal indentexpr=GetSshconfigIndent(v:lnum)
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 setlocal indentkeys=o,O,*<Return>,0=~host\ ,0=~match\ ,0#,!^F
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 let b:undo_indent = "setlocal autoindent< indentexpr< indentkeys<"
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 if exists("*GetSshconfigIndent")
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 finish
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 endif
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 function GetSshconfigIndent(lnum)
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 let sw = shiftwidth()
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 let prev_lnum = prevnonblank(a:lnum - 1)
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 let curr_lnum = a:lnum
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 let prev_line = getline(prev_lnum)
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 let curr_line = getline(curr_lnum)
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 if curr_line =~? '^\s*\(host\|match\)\s'
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 return 0
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 elseif prev_line =~? '^\s*\(host\|match\)\s'
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 return sw
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 else
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 return indent(prev_lnum)
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 endif
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 endfunction