This commit is contained in:
Adam Stankiewicz
2020-11-18 20:33:42 +01:00
parent da18fe6851
commit c228e993ad
32 changed files with 1986 additions and 767 deletions

View File

@@ -3,9 +3,10 @@ if has_key(g:polyglot_is_disabled, 'awk')
endif
" Vim filetype plugin
" Language: awk, nawk, gawk, mawk
" Maintainer: Antonio Colombo <azc100@gmail.com>
" Last Change: 2020 Sep 28
" Language: awk, nawk, gawk, mawk
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Antonio Colombo <azc100@gmail.com>
" Last Change: 2020 Sep 28
" This plugin was prepared by Mark Sikora
" This plugin was updated as proposed by Doug Kearns

97
ftplugin/erlang.vim Normal file
View File

@@ -0,0 +1,97 @@
if has_key(g:polyglot_is_disabled, 'erlang')
finish
endif
" Vim ftplugin file
" Language: Erlang
" Maintainer: Csaba Hoch <csaba.hoch@gmail.com>
" 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
setlocal suffixesadd=.erl,.hrl
let &l:include = '^\s*-\%(include\|include_lib\)\s*("\zs\f*\ze")'
let &l:define = '^\s*-\%(define\|record\|type\|opaque\)'
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< suffixesadd< include< define<"
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -21,6 +21,8 @@ setlocal iskeyword=!,$,%,#,*,+,-,.,/,:,<,=,>,?,_,a-z,A-Z,48-57,128-247,124,126,3
" of user-defined def* definitions.
setlocal define=\\v[(/]def(ault)@!\\S*
setlocal suffixesadd=.fnl
" Remove 't' from 'formatoptions' to avoid auto-wrapping code.
setlocal formatoptions-=t

4
ftplugin/pest.vim Normal file
View File

@@ -0,0 +1,4 @@
if has_key(g:polyglot_is_disabled, 'pest')
finish
endif

View File

@@ -19,10 +19,10 @@ silent! setlocal formatoptions+=j
let b:undo_ftplugin = 'setlocal formatoptions<'
if !has('patch-7.4.1142')
" Include hyphens as keyword characters so that a keyword appearing as
" part of a longer name doesn't get partially highlighted.
setlocal iskeyword+=-
let b:undo_ftplugin .= ' iskeyword<'
" Include hyphens as keyword characters so that a keyword appearing as
" part of a longer name doesn't get partially highlighted.
setlocal iskeyword+=-
let b:undo_ftplugin .= ' iskeyword<'
endif
if get(g:, 'terraform_fold_sections', 0)
@@ -42,14 +42,20 @@ endif
let &cpoptions = s:cpo_save
unlet s:cpo_save
if !executable('terraform')
if !exists('g:terraform_binary_path')
let g:terraform_binary_path='terraform'
endif
if !executable(g:terraform_binary_path)
finish
endif
let s:cpo_save = &cpoptions
set cpoptions&vim
command! -nargs=+ -complete=custom,terraform#commands -buffer Terraform execute '!terraform '.<q-args>. ' -no-color'
command! -nargs=+ -complete=custom,terraform#commands -buffer Terraform
\ execute '!'.g:terraform_binary_path.' '.<q-args>.' -no-color'
command! -nargs=0 -buffer TerraformFmt call terraform#fmt()
let b:undo_ftplugin .= '|delcommand Terraform|delcommand TerraformFmt'

View File

@@ -20,7 +20,7 @@ setlocal commentstring=//\ %s
setlocal formatoptions-=t formatoptions+=croql
if !&l:formatexpr && !&l:formatprg
setlocal formatprg=Fixedgq(v:lnum,v:count)
setlocal formatexpr=Fixedgq(v:lnum,v:count)
endif
" setlocal foldmethod=syntax