annotate runtime/indent/cucumber.vim @ 18627:169c810d4e51 v8.1.2306

patch 8.1.2306: double and triple clicks are not tested Commit: https://github.com/vim/vim/commit/f36a2c7e60d86b1a1733a8f51ed72da9c6f76eb8 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 16 18:57:16 2019 +0100 patch 8.1.2306: double and triple clicks are not tested Problem: Double and triple clicks are not tested. Solution: Test mouse clicks to select text. (closes https://github.com/vim/vim/issues/5226)
author Bram Moolenaar <Bram@vim.org>
date Sat, 16 Nov 2019 19:00:05 +0100
parents 63b0b7b79b25
children 9ece16460769
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
1 " Vim indent file
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
2 " Language: Cucumber
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org>
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
4 " Last Change: 2017 Jun 13
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
5
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
6 if exists("b:did_indent")
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
7 finish
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
8 endif
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
9 let b:did_indent = 1
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
10
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
11 setlocal autoindent
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
12 setlocal indentexpr=GetCucumberIndent()
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
13 setlocal indentkeys=o,O,*<Return>,<:>,0<Bar>,0#,=,!^F
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
14
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
15 let b:undo_indent = 'setl ai< inde< indk<'
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
16
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
17 " Only define the function once.
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
18 if exists("*GetCucumberIndent")
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
19 finish
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
20 endif
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
21
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
22 function! s:syn(lnum)
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
23 return synIDattr(synID(a:lnum,1+indent(a:lnum),1),'name')
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
24 endfunction
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
25
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
26 function! GetCucumberIndent()
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
27 let line = getline(prevnonblank(v:lnum-1))
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
28 let cline = getline(v:lnum)
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
29 let nline = getline(nextnonblank(v:lnum+1))
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
30 let sw = exists('*shiftwidth') ? shiftwidth() : shiftwidth()
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
31 let syn = s:syn(prevnonblank(v:lnum-1))
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
32 let csyn = s:syn(v:lnum)
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
33 let nsyn = s:syn(nextnonblank(v:lnum+1))
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
34 if csyn ==# 'cucumberFeature' || cline =~# '^\s*Feature:'
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
35 " feature heading
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
36 return 0
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
37 elseif csyn ==# 'cucumberExamples' || cline =~# '^\s*\%(Examples\|Scenarios\):'
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
38 " examples heading
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
39 return 2 * sw
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
40 elseif csyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
41 " background, scenario or outline heading
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
42 return sw
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
43 elseif syn ==# 'cucumberFeature' || line =~# '^\s*Feature:'
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
44 " line after feature heading
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
45 return sw
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
46 elseif syn ==# 'cucumberExamples' || line =~# '^\s*\%(Examples\|Scenarios\):'
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
47 " line after examples heading
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
48 return 3 * sw
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
49 elseif syn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
50 " line after background, scenario or outline heading
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
51 return 2 * sw
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
52 elseif cline =~# '^\s*[@#]' && (nsyn == 'cucumberFeature' || nline =~# '^\s*Feature:' || indent(prevnonblank(v:lnum-1)) <= 0)
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
53 " tag or comment before a feature heading
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
54 return 0
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
55 elseif cline =~# '^\s*@'
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
56 " other tags
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
57 return sw
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
58 elseif cline =~# '^\s*[#|]' && line =~# '^\s*|'
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
59 " mid-table
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
60 " preserve indent
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
61 return indent(prevnonblank(v:lnum-1))
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
62 elseif cline =~# '^\s*|' && line =~# '^\s*[^|]'
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
63 " first line of a table, relative indent
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
64 return indent(prevnonblank(v:lnum-1)) + sw
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
65 elseif cline =~# '^\s*[^|]' && line =~# '^\s*|'
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
66 " line after a table, relative unindent
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
67 return indent(prevnonblank(v:lnum-1)) - sw
4681
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
68 elseif cline =~# '^\s*#' && getline(v:lnum-1) =~ '^\s*$' && (nsyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || nline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):')
2eb30f341e8d Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents: 2202
diff changeset
69 " comments on scenarios
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 4681
diff changeset
70 return sw
2098
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
71 endif
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
72 return indent(prevnonblank(v:lnum-1))
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
73 endfunction
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
74
3259c3923c1e Updated runtime an documentation files.
Bram Moolenaar <bram@zimbu.org>
parents:
diff changeset
75 " vim:set sts=2 sw=2: