annotate runtime/indent/logtalk.vim @ 6383:9c9c70625444 v7.4.523

updated for version 7.4.523 Problem: When the X11 server is stopped and restarted, while Vim is kept in the background, copy/paste no longer works. (Issue 203) Solution: Setup the clipboard again. (Christian Brabandt)
author Bram Moolenaar <bram@vim.org>
date Wed, 19 Nov 2014 18:48:46 +0100
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