mirror of
https://github.com/neovim/neovim.git
synced 2024-12-24 13:15:09 -07:00
a98a6996c2
Vim runtime files based on 7.4.384 / hg changeset 7090d7f160f7 Excluding: Amiga icons (*.info, icons/) doc/hangulin.txt tutor/ spell/ lang/ (only used for menu translations) macros/maze/, macros/hanoi/, macros/life/, macros/urm/ These were used to test vi compatibility. termcap "Demonstration of a termcap file (for the Amiga and Archimedes)" Helped-by: Rich Wareham <rjw57@cam.ac.uk> Helped-by: John <john.schmidt.h@gmail.com> Helped-by: Yann <yann@yann-salaun.com> Helped-by: Christophe Badoit <c.badoit@lesiteimmo.com> Helped-by: drasill <github@tof2k.com> Helped-by: Tae Sandoval Murgan <taecilla@gmail.com> Helped-by: Lowe Thiderman <lowe.thiderman@gmail.com>
88 lines
1.8 KiB
VimL
88 lines
1.8 KiB
VimL
" Vim ftplugin file
|
|
" Language: Erlang
|
|
" Author: Oscar Hellström <oscar@oscarh.net>
|
|
" Contributors: Ricardo Catalinas Jiménez <jimenezrick@gmail.com>
|
|
" Eduardo Lopez (http://github.com/tapichu)
|
|
" License: Vim license
|
|
" Version: 2012/01/25
|
|
|
|
if exists('b:did_ftplugin')
|
|
finish
|
|
else
|
|
let b:did_ftplugin = 1
|
|
endif
|
|
|
|
if exists('s:did_function_definitions')
|
|
call s:SetErlangOptions()
|
|
finish
|
|
else
|
|
let s:did_function_definitions = 1
|
|
endif
|
|
|
|
let s:cpo_save = &cpo
|
|
set cpo&vim
|
|
|
|
if !exists('g:erlang_keywordprg')
|
|
let g:erlang_keywordprg = 'erl -man'
|
|
endif
|
|
|
|
if !exists('g:erlang_folding')
|
|
let g:erlang_folding = 0
|
|
endif
|
|
|
|
let s:erlang_fun_begin = '^\a\w*(.*$'
|
|
let s:erlang_fun_end = '^[^%]*\.\s*\(%.*\)\?$'
|
|
|
|
function s:SetErlangOptions()
|
|
if g:erlang_folding
|
|
setlocal foldmethod=expr
|
|
setlocal foldexpr=GetErlangFold(v:lnum)
|
|
setlocal foldtext=ErlangFoldText()
|
|
endif
|
|
|
|
setlocal comments=:%%%,:%%,:%
|
|
setlocal commentstring=%%s
|
|
|
|
setlocal formatoptions+=ro
|
|
let &l:keywordprg = g:erlang_keywordprg
|
|
endfunction
|
|
|
|
function GetErlangFold(lnum)
|
|
let lnum = a:lnum
|
|
let line = getline(lnum)
|
|
|
|
if line =~ s:erlang_fun_end
|
|
return '<1'
|
|
endif
|
|
|
|
if line =~ s:erlang_fun_begin && foldlevel(lnum - 1) == 1
|
|
return '1'
|
|
endif
|
|
|
|
if line =~ s:erlang_fun_begin
|
|
return '>1'
|
|
endif
|
|
|
|
return '='
|
|
endfunction
|
|
|
|
function ErlangFoldText()
|
|
let line = getline(v:foldstart)
|
|
let foldlen = v:foldend - v:foldstart + 1
|
|
let lines = ' ' . foldlen . ' lines: ' . substitute(line, "[\ \t]*", '', '')
|
|
if foldlen < 10
|
|
let lines = ' ' . lines
|
|
endif
|
|
let retval = '+' . v:folddashes . lines
|
|
|
|
return retval
|
|
endfunction
|
|
|
|
call s:SetErlangOptions()
|
|
|
|
let b:undo_ftplugin = "setlocal foldmethod< foldexpr< foldtext<"
|
|
\ . " comments< commentstring< formatoptions<"
|
|
|
|
let &cpo = s:cpo_save
|
|
unlet s:cpo_save
|