Mercurial > vim
annotate runtime/ftplugin/erlang.vim @ 19814:e7bbf6cadc9e v8.2.0464
patch 8.2.0464: typos and other small problems
Commit: https://github.com/vim/vim/commit/2d9d409ad4fab1ae7ceaecc0ef0e9b511d868374
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Mar 27 20:52:45 2020 +0100
patch 8.2.0464: typos and other small problems
Problem: Typos and other small problems.
Solution: Fix the typos. Add missing file to distribution.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 27 Mar 2020 21:00:06 +0100 |
parents | 94601b379f38 |
children | 5b7ea82bc18f |
rev | line source |
---|---|
3281 | 1 " Vim ftplugin file |
2 " Language: Erlang | |
3356 | 3 " Author: Oscar Hellström <oscar@oscarh.net> |
4 " Contributors: Ricardo Catalinas Jiménez <jimenezrick@gmail.com> | |
3281 | 5 " Eduardo Lopez (http://github.com/tapichu) |
6 " License: Vim license | |
3356 | 7 " Version: 2012/01/25 |
3281 | 8 |
9 if exists('b:did_ftplugin') | |
10 finish | |
11 else | |
12 let b:did_ftplugin = 1 | |
13 endif | |
14 | |
15 if exists('s:did_function_definitions') | |
16 call s:SetErlangOptions() | |
17 finish | |
18 else | |
19 let s:did_function_definitions = 1 | |
20 endif | |
21 | |
3410
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
3356
diff
changeset
|
22 let s:cpo_save = &cpo |
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
3356
diff
changeset
|
23 set cpo&vim |
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
3356
diff
changeset
|
24 |
3281 | 25 if !exists('g:erlang_keywordprg') |
26 let g:erlang_keywordprg = 'erl -man' | |
27 endif | |
28 | |
29 if !exists('g:erlang_folding') | |
30 let g:erlang_folding = 0 | |
31 endif | |
32 | |
3356 | 33 let s:erlang_fun_begin = '^\a\w*(.*$' |
34 let s:erlang_fun_end = '^[^%]*\.\s*\(%.*\)\?$' | |
35 | |
3281 | 36 function s:SetErlangOptions() |
37 if g:erlang_folding | |
38 setlocal foldmethod=expr | |
39 setlocal foldexpr=GetErlangFold(v:lnum) | |
40 setlocal foldtext=ErlangFoldText() | |
41 endif | |
42 | |
43 setlocal comments=:%%%,:%%,:% | |
44 setlocal commentstring=%%s | |
45 | |
46 setlocal formatoptions+=ro | |
47 let &l:keywordprg = g:erlang_keywordprg | |
48 endfunction | |
49 | |
3356 | 50 function GetErlangFold(lnum) |
51 let lnum = a:lnum | |
52 let line = getline(lnum) | |
3281 | 53 |
3356 | 54 if line =~ s:erlang_fun_end |
55 return '<1' | |
56 endif | |
3281 | 57 |
3356 | 58 if line =~ s:erlang_fun_begin && foldlevel(lnum - 1) == 1 |
59 return '1' | |
60 endif | |
3281 | 61 |
3356 | 62 if line =~ s:erlang_fun_begin |
63 return '>1' | |
64 endif | |
3281 | 65 |
3356 | 66 return '=' |
67 endfunction | |
3281 | 68 |
3356 | 69 function ErlangFoldText() |
70 let line = getline(v:foldstart) | |
71 let foldlen = v:foldend - v:foldstart + 1 | |
72 let lines = ' ' . foldlen . ' lines: ' . substitute(line, "[\ \t]*", '', '') | |
73 if foldlen < 10 | |
74 let lines = ' ' . lines | |
75 endif | |
76 let retval = '+' . v:folddashes . lines | |
3281 | 77 |
3356 | 78 return retval |
79 endfunction | |
3281 | 80 |
81 call s:SetErlangOptions() | |
3410
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
3356
diff
changeset
|
82 |
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
3356
diff
changeset
|
83 let b:undo_ftplugin = "setlocal foldmethod< foldexpr< foldtext<" |
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
3356
diff
changeset
|
84 \ . " comments< commentstring< formatoptions<" |
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
3356
diff
changeset
|
85 |
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
3356
diff
changeset
|
86 let &cpo = s:cpo_save |
94601b379f38
Updated runtime files. Add Dutch translations.
Bram Moolenaar <bram@vim.org>
parents:
3356
diff
changeset
|
87 unlet s:cpo_save |