annotate runtime/indent/logtalk.vim @ 9651:fe665dae7197 v7.4.2102

commit https://github.com/vim/vim/commit/45a249513f5ed2de0a6f6b5cb6e32015e35644be Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 24 22:25:15 2016 +0200 patch 7.4.2102 Problem: Tiny build with GUI fails. Solution: Revert one FOR_ALL_ change.
author Christian Brabandt <cb@256bit.org>
date Sun, 24 Jul 2016 22:30:05 +0200
parents 0b796e045c42
children 63b0b7b79b25
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
1 " Maintainer: Paulo Moura <pmoura@logtalk.org>
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
2 " Revised on: 2008.06.02
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
3 " Language: Logtalk
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
4
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
5 " This Logtalk indent file is a modified version of the Prolog
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
6 " indent file written by Gergely Kontra
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
7
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
8 " Only load this indent file when no other was loaded.
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
9 if exists("b:did_indent")
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
10 finish
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
11 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
12
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
13 let b:did_indent = 1
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
14
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
15 setlocal indentexpr=GetLogtalkIndent()
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
16 setlocal indentkeys-=:,0#
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
17 setlocal indentkeys+=0%,-,0;,>,0)
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
18
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
19 " Only define the function once.
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
20 if exists("*GetLogtalkIndent")
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
21 finish
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
22 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
23
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
24 function! GetLogtalkIndent()
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
25 " Find a non-blank line above the current line.
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
26 let pnum = prevnonblank(v:lnum - 1)
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
27 " Hit the start of the file, use zero indent.
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
28 if pnum == 0
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
29 return 0
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
30 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
31 let line = getline(v:lnum)
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
32 let pline = getline(pnum)
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
33
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
34 let ind = indent(pnum)
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
35 " Previous line was comment -> use previous line's indent
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
36 if pline =~ '^\s*%'
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
37 retu ind
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
38 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
39 " Check for entity opening directive on previous line
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
40 if pline =~ '^\s*:-\s\(object\|protocol\|category\)\ze(.*,$'
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
41 let ind = ind + &sw
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
42 " Check for clause head on previous line
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
43 elseif pline =~ ':-\s*\(%.*\)\?$'
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
44 let ind = ind + &sw
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
45 " Check for entity closing directive on previous line
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
46 elseif pline =~ '^\s*:-\send_\(object\|protocol\|category\)\.\(%.*\)\?$'
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
47 let ind = ind - &sw
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
48 " Check for end of clause on previous line
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
49 elseif pline =~ '\.\s*\(%.*\)\?$'
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
50 let ind = ind - &sw
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
51 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
52 " Check for opening conditional on previous line
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
53 if pline =~ '^\s*\([(;]\|->\)' && pline !~ '\.\s*\(%.*\)\?$' && pline !~ '^.*\([)][,]\s*\(%.*\)\?$\)'
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
54 let ind = ind + &sw
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
55 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
56 " Check for closing an unclosed paren, or middle ; or ->
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
57 if line =~ '^\s*\([);]\|->\)'
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
58 let ind = ind - &sw
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
59 endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
60 return ind
0b796e045c42 updated for version 7.2b-000
vimboss
parents:
diff changeset
61 endfunction