/usr/share/vim/addons/compiler/erlang.vim is in vim-vimerl 1.4.1+git20120509.89111c7-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | " Vim compiler file
" Language: Erlang
" Author: Pawel 'kTT' Salata <rockplayer.pl@gmail.com>
" Contributors: Ricardo Catalinas Jiménez <jimenezrick@gmail.com>
" License: Vim license
" Version: 2012/02/08
if exists("current_compiler") || v:version < 703
finish
else
let current_compiler = "erlang"
endif
let b:error_list = {}
let b:is_showing_msg = 0
let b:next_sign_id = 1
if exists(":CompilerSet") != 2
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet makeprg=make
CompilerSet errorformat=%f:%l:\ %tarning:\ %m,%f:%l:\ %m
" Only define functions and script scope variables once
if exists("*s:ShowErrors")
finish
endif
if !exists("g:erlang_show_errors")
let g:erlang_show_errors = 1
endif
let s:erlang_check_file = expand("<sfile>:p:h") . "/erlang_check.erl"
let s:autocmds_defined = 0
sign define ErlangError text=>> texthl=Error
sign define ErlangWarning text=>> texthl=Todo
command ErlangDisableShowErrors silent call s:DisableShowErrors()
command ErlangEnableShowErrors silent call s:EnableShowErrors()
function s:ShowErrors()
setlocal shellpipe=>
if match(getline(1), "#!.*escript") != -1
setlocal makeprg=escript\ -s\ %
else
execute "setlocal makeprg=" . s:erlang_check_file . "\\ \%"
endif
silent make!
call s:ClearErrors()
for error in getqflist()
let item = {}
let item["lnum"] = error.lnum
let item["text"] = error.text
let b:error_list[error.lnum] = item
let type = error.type == "W" ? "ErlangWarning" : "ErlangError"
execute "sign place" b:next_sign_id "line=" . item.lnum "name=" . type "file=" . expand("%:p")
let b:next_sign_id += 1
endfor
setlocal shellpipe&
setlocal makeprg=make
endfunction
function s:ShowErrorMsg()
let pos = getpos(".")
if has_key(b:error_list, pos[1])
let item = get(b:error_list, pos[1])
echo item.text
let b:is_showing_msg = 1
else
if b:is_showing_msg
echo
let b:is_showing_msg = 0
endif
endif
endf
function s:ClearErrors()
sign unplace *
let b:error_list = {}
let b:next_sign_id = 1
if b:is_showing_msg
echo
let b:is_showing_msg = 0
endif
endfunction
function s:EnableShowErrors()
if !s:autocmds_defined
autocmd BufWritePost *.erl call s:ShowErrors()
autocmd CursorHold *.erl call s:ShowErrorMsg()
autocmd CursorMoved *.erl call s:ShowErrorMsg()
let s:autocmds_defined = 1
endif
endfunction
function s:DisableShowErrors()
sign unplace *
autocmd! BufWritePost *.erl
autocmd! CursorHold *.erl
autocmd! CursorMoved *.erl
let s:autocmds_defined = 0
endfunction
if g:erlang_show_errors
call s:EnableShowErrors()
endif
|