summaryrefslogtreecommitdiffstats
path: root/ftplugin
diff options
context:
space:
mode:
Diffstat (limited to 'ftplugin')
-rw-r--r--ftplugin/awk.vim7
-rw-r--r--ftplugin/erlang.vim97
-rw-r--r--ftplugin/fennel.vim2
-rw-r--r--ftplugin/pest.vim4
-rw-r--r--ftplugin/terraform.vim18
-rw-r--r--ftplugin/typescript.vim2
6 files changed, 120 insertions, 10 deletions
diff --git a/ftplugin/awk.vim b/ftplugin/awk.vim
index a3b02e17..a534249b 100644
--- a/ftplugin/awk.vim
+++ b/ftplugin/awk.vim
@@ -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
diff --git a/ftplugin/erlang.vim b/ftplugin/erlang.vim
new file mode 100644
index 00000000..45eb68f6
--- /dev/null
+++ b/ftplugin/erlang.vim
@@ -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
diff --git a/ftplugin/fennel.vim b/ftplugin/fennel.vim
index f840bb3b..ac905f27 100644
--- a/ftplugin/fennel.vim
+++ b/ftplugin/fennel.vim
@@ -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
diff --git a/ftplugin/pest.vim b/ftplugin/pest.vim
new file mode 100644
index 00000000..09ad3583
--- /dev/null
+++ b/ftplugin/pest.vim
@@ -0,0 +1,4 @@
+if has_key(g:polyglot_is_disabled, 'pest')
+ finish
+endif
+
diff --git a/ftplugin/terraform.vim b/ftplugin/terraform.vim
index 17a8b6d8..0ef25d30 100644
--- a/ftplugin/terraform.vim
+++ b/ftplugin/terraform.vim
@@ -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'
diff --git a/ftplugin/typescript.vim b/ftplugin/typescript.vim
index 963d0fe4..ec06e34d 100644
--- a/ftplugin/typescript.vim
+++ b/ftplugin/typescript.vim
@@ -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