Here it is attached the final version of the ftplugin from Vimerl, without those two lines that Csaba noted that should be removed. I'll keep this version in a separate branch[1] in my GitHub account where this version of Vimerl is developed.
So, if everybody is happy, this ftplugin could be included in the official Vim runtime distribution. Do I need to send it to Bram Moolenaar? [1] https://github.com/jimenezrick/vimerl/blob/official-vim-runtime/ftplugin/erlang.vim On Wed, Feb 01, 2012 at 11:46:00AM +0100, Csaba Hoch wrote: > > So, I'm probably dropping the pure Vim indent and taking the new one > > in Erlang for Vimerl. This Erlang indenter isn't gonna be included in > > the official Vim distribution, so that Csaba should keep his version > > if he can mantain it. As it seems a good default one for Vim. > > I hope you can make it work like the Erlang indentation of Emacs, > which seems to be the de facto standard for indenting Erlang code :) Well, some nested expression don't have the same indentation level as Emacs, but overall, it seems to do a much better job indenting and is far more similar to the Emacs style, sometimes lining up columns to keep the code nice. > [...] > Oscar's file indeed contains some things that could (should) be > incorporated into the current one; but their styles are also > different. For example the current one highlights the global calls > (module:function) and does not highlight local calls or variables; > while Oscar's file highlights variables and not function calls. Both > are good algorithms, but I don't think we should change from one style > to the other in the standard Vim distribution. OK, keep your version of the syntax file. And if you want, do any merge you considere necessary. > [...] > I haven't found an easy solution. The autoload functionality in Vim > will try to look up the file (autoload/erlang_complete.vim in this > case) in each directory in 'runtimepath', but you cannot ask in > advance whether a file exists in any of these directories or not. > > One option is to parse the value of 'runtimepath' and check the > existence of the files ourselves -- I would rather not do that. > > Another option is to call erlang_complete#Complete and examine the > error. If we get "E117 Unknown function" error, then the file does not > exist; otherwise we are just calling the function in a wrong way > (without arguments). > > silent! call erlang_complete#Complete() > if strpart(v:errmsg, 0, 4) != 'E117' " E117: Unknown function > compiler erlang > setlocal omnifunc=erlang_complete#Complete > endif > > Maybe the third option is the simplest: not to have these two lines in > the version of ftplugin shipped with Vim. (Although I know that it is > worse from a version contol point of view.) OK, I removed those two commands. There is no trouble at all, I'll just keep a Git branch for the official Vim runtime version of the ftplugin. Regards -- Ricardo (http://r.untroubled.be/) -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
" Vim ftplugin file " Language: Erlang " Author: Oscar Hellström <[email protected]> " Contributors: Ricardo Catalinas Jiménez <[email protected]> " 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 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()
