From 95d82fdb668b746ac100a8b7d2aca38038150707 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Tue, 29 Dec 2020 19:44:40 +0100 Subject: Update --- ftplugin/css.vim | 5 ++- ftplugin/eelixir.vim | 9 ++++- ftplugin/elixir.vim | 2 +- ftplugin/erlang.vim | 111 +++++++++++++++++++++++---------------------------- ftplugin/idris2.vim | 7 ++-- ftplugin/nroff.vim | 10 ++++- ftplugin/spec.vim | 36 ++++++++--------- 7 files changed, 92 insertions(+), 88 deletions(-) (limited to 'ftplugin') diff --git a/ftplugin/css.vim b/ftplugin/css.vim index e7ff73b6..5d4dca2a 100644 --- a/ftplugin/css.vim +++ b/ftplugin/css.vim @@ -6,7 +6,7 @@ endif " Language: CSS " Maintainer: Doug Kearns " Previous Maintainer: Nikolai Weibull -" Latest Revision: 2008-07-09 +" Last Change: 2020 Dec 21 if exists("b:did_ftplugin") finish @@ -16,11 +16,12 @@ let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim -let b:undo_ftplugin = "setl com< cms< inc< fo< ofu<" +let b:undo_ftplugin = "setl com< cms< inc< fo< ofu< isk<" setlocal comments=s1:/*,mb:*,ex:*/ commentstring& setlocal formatoptions-=t formatoptions+=croql setlocal omnifunc=csscomplete#CompleteCSS +setlocal iskeyword+=- let &l:include = '^\s*@import\s\+\%(url(\)\=' diff --git a/ftplugin/eelixir.vim b/ftplugin/eelixir.vim index 61a59a05..cda21c9b 100644 --- a/ftplugin/eelixir.vim +++ b/ftplugin/eelixir.vim @@ -27,7 +27,10 @@ if !exists("b:eelixir_subtype") let b:eelixir_subtype = matchstr(&filetype,'^leex\.\zs\w\+') endif if b:eelixir_subtype == '' - let b:eelixir_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.eex\|\.leex\|\.eelixir\)\+$','',''),'\.\zs\w\+$') + let b:eelixir_subtype = matchstr(&filetype,'^sface\.\zs\w\+') + endif + if b:eelixir_subtype == '' + let b:eelixir_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.eex\|\.sface\|\.leex\|\.eelixir\)\+$','',''),'\.\zs\w\+$') endif if b:eelixir_subtype == 'ex' let b:eelixir_subtype = 'elixir' @@ -97,6 +100,10 @@ if !exists('b:surround_35') " When using surround `#` (ASCII 35) would provide `<%# selection %>` let b:surround_35 = "<%# \r %>" endif +if !exists('b:surround_123') + " When using surround `{` (ASCII 123) would provide `{{ selection }}` + let b:surround_123 = "{{ \r }}" +endif if !exists('b:surround_5') " When using surround `` (ASCII 5 `ENQ`) would provide `<% selection %>\n<% end %>` let b:surround_5 = "<% \r %>\n<% end %>" diff --git a/ftplugin/elixir.vim b/ftplugin/elixir.vim index 2cae0e3e..9a273567 100644 --- a/ftplugin/elixir.vim +++ b/ftplugin/elixir.vim @@ -32,7 +32,7 @@ let &l:path = \ &g:path \ ], ',') setlocal includeexpr=elixir#util#get_filename(v:fname) -setlocal suffixesadd=.ex,.exs,.eex,.leex,.erl,.xrl,.yrl,.hrl +setlocal suffixesadd=.ex,.exs,.eex,.leex,.sface,.erl,.xrl,.yrl,.hrl let &l:define = 'def\(macro\|guard\|delegate\)\=p\=' diff --git a/ftplugin/erlang.vim b/ftplugin/erlang.vim index 45eb68f6..b9720484 100644 --- a/ftplugin/erlang.vim +++ b/ftplugin/erlang.vim @@ -8,90 +8,79 @@ endif " Author: Oscar Hellström " Contributors: Ricardo Catalinas Jiménez " Eduardo Lopez (http://github.com/tapichu) +" Arvid Bjurklint (http://github.com/slarwise) " 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 + finish endif +let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim -if !exists('g:erlang_keywordprg') - let g:erlang_keywordprg = 'erl -man' -endif +let &l:keywordprg = get(g:, 'erlang_keywordprg', 'erl -man') -if !exists('g:erlang_folding') - let g:erlang_folding = 0 +if get(g:, 'erlang_folding', 0) + setlocal foldmethod=expr + setlocal foldexpr=GetErlangFold(v:lnum) + setlocal foldtext=ErlangFoldText() 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 comments=:%%%,:%%,:% - setlocal commentstring=%%s +setlocal formatoptions+=ro - setlocal formatoptions+=ro - let &l:keywordprg = g:erlang_keywordprg +setlocal suffixesadd=.erl,.hrl - setlocal suffixesadd=.erl,.hrl +let &l:include = '^\s*-\%(include\|include_lib\)\s*("\zs\f*\ze")' +let &l:define = '^\s*-\%(define\|record\|type\|opaque\)' - 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 +let s:erlang_fun_begin = '^\a\w*(.*$' +let s:erlang_fun_end = '^[^%]*\.\s*\(%.*\)\?$' - if line =~ s:erlang_fun_begin && foldlevel(lnum - 1) == 1 - return '1' - endif +if !exists('*GetErlangFold') + function GetErlangFold(lnum) + let lnum = a:lnum + let line = getline(lnum) - if line =~ s:erlang_fun_begin - return '>1' - endif + if line =~ s:erlang_fun_end + return '<1' + endif - return '=' -endfunction + if line =~ s:erlang_fun_begin && foldlevel(lnum - 1) == 1 + return '1' + endif -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 + if line =~ s:erlang_fun_begin + return '>1' + endif - return retval -endfunction + return '=' + endfunction +endif -call s:SetErlangOptions() +if !exists('*ErlangFoldText') + 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 +endif -let b:undo_ftplugin = "setlocal foldmethod< foldexpr< foldtext<" - \ . " comments< commentstring< formatoptions< suffixesadd< include< define<" +let b:undo_ftplugin = "setlocal keywordprg< foldmethod< foldexpr< foldtext<" + \ . " comments< commentstring< formatoptions< suffixesadd< include<" + \ . " define<" let &cpo = s:cpo_save unlet s:cpo_save + +" vim: sw=2 et diff --git a/ftplugin/idris2.vim b/ftplugin/idris2.vim index 28ac7b5c..9a09fada 100644 --- a/ftplugin/idris2.vim +++ b/ftplugin/idris2.vim @@ -37,8 +37,9 @@ endfunction function! s:IdrisCommand(...) let idriscmd = shellescape(join(a:000)) -" echo("idris2 " . expand ('%:p') . " --client " . idriscmd) - return system("idris2 --find-ipkg " . shellescape(expand('%:p')) . " --client " . idriscmd) + " Vim does not support ANSI escape codes natively, so we need to disable + " automatic colouring + return system("idris2 --no-color --find-ipkg " . shellescape(expand('%:p')) . " --client " . idriscmd) endfunction function! IdrisDocFold(lineNum) @@ -99,7 +100,7 @@ endfunction function! IdrisReload(q) w let file = expand('%:p') - let tc = system("idris2 --find-ipkg " . shellescape(file) . " --client ''") + let tc = system("idris2 --no-color --find-ipkg " . shellescape(file) . " --client ''") if (! (tc is "")) call IWrite(tc) else diff --git a/ftplugin/nroff.vim b/ftplugin/nroff.vim index 5ddd07f7..ac3dce4d 100644 --- a/ftplugin/nroff.vim +++ b/ftplugin/nroff.vim @@ -4,8 +4,10 @@ endif " Vim filetype plugin " Language: roff(7) -" Maintainer: Chris Spiegel -" Last Change: 2019 Apr 24 +" Maintainer: Aman Verma +" Homepage: https://github.com/a-vrma/vim-nroff-ftplugin +" Previous Maintainer: Chris Spiegel +" Last Change: 2020 Nov 21 if exists("b:did_ftplugin") finish @@ -13,3 +15,7 @@ endif let b:did_ftplugin = 1 setlocal commentstring=.\\\"%s +setlocal comments=:.\\\" +setlocal sections+=Sh + +let b:undo_ftplugin = 'setlocal commentstring< comments< sections<' diff --git a/ftplugin/spec.vim b/ftplugin/spec.vim index 15234b68..fad900f9 100644 --- a/ftplugin/spec.vim +++ b/ftplugin/spec.vim @@ -77,23 +77,23 @@ if !exists("*s:SpecChangelog") let chgline = -1 while (line <= line("$")) let linestr = getline(line) - if (name == "" && linestr =~? '^Name:') + if name == "" && linestr =~? '^Name:' let nameline = line let name = substitute(strpart(linestr,5), '^[ ]*\([^ ]\+\)[ ]*$','\1','') - elseif (ver == "" && linestr =~? '^Version:') + elseif ver == "" && linestr =~? '^Version:' let verline = line let ver = substitute(strpart(linestr,8), '^[ ]*\([^ ]\+\)[ ]*$','\1','') - elseif (rel == "" && linestr =~? '^Release:') + elseif rel == "" && linestr =~? '^Release:' let relline = line let rel = substitute(strpart(linestr,8), '^[ ]*\([^ ]\+\)[ ]*$','\1','') - elseif (linestr =~? '^%changelog') + elseif linestr =~? '^%changelog' let chgline = line execute line break endif let line = line+1 endwhile - if (nameline != -1 && verline != -1 && relline != -1) + if nameline != -1 && verline != -1 && relline != -1 let include_release_info = exists("g:spec_chglog_release_info") let name = s:ParseRpmVars(name, nameline) let ver = s:ParseRpmVars(ver, verline) @@ -104,20 +104,20 @@ if !exists("*s:SpecChangelog") call s:GetRelVer() - if (chgline == -1) + if chgline == -1 let option = confirm("Can't find %changelog. Create one? ","&End of file\n&Here\n&Cancel",3) - if (option == 1) + if option == 1 call append(line("$"),"") call append(line("$"),"%changelog") execute line("$") let chgline = line(".") - elseif (option == 2) + elseif option == 2 call append(line("."),"%changelog") normal j - chgline = line(".") + let chgline = line(".") endif endif - if (chgline != -1) + if chgline != -1 let tmptime = v:lc_time language time C let parsed_format = "* ".strftime(format)." - ".ver."-".rel @@ -126,16 +126,16 @@ if !exists("*s:SpecChangelog") let wrong_format = 0 let wrong_release = 0 let insert_line = 0 - if (getline(chgline+1) != parsed_format) + if getline(chgline+1) != parsed_format let wrong_format = 1 endif - if (include_release_info && getline(chgline+2) != release_info) + if include_release_info && getline(chgline+2) != release_info let wrong_release = 1 endif - if (wrong_format || wrong_release) - if (include_release_info && !wrong_release && !exists("g:spec_chglog_never_increase_release")) + if wrong_format || wrong_release + if include_release_info && !wrong_release && !exists("g:spec_chglog_never_increase_release") let option = confirm("Increase release? ","&Yes\n&No",1) - if (option == 1) + if option == 1 execute relline normal  let rel = substitute(strpart(getline(relline),8), '^[ ]*\([^ ]\+\)[ ]*$','\1','') @@ -175,13 +175,13 @@ if !exists("*s:ParseRpmVars") let ret = "" while (1) let start = match(a:str, "\%{", end+1) - if (start == -1) + if start == -1 let ret = ret . strpart(a:str, end+1) break endif let ret = ret . strpart(a:str, end+1, start-(end+1)) let end = match(a:str, "}", start) - if (end == -1) + if end == -1 let ret = ret . strpart(a:str, start) break endif @@ -189,7 +189,7 @@ if !exists("*s:ParseRpmVars") execute a:strline let definestr = "^[ \t]*%\\(define\\|global\\)[ \t]\\+".varname."[ \t]\\+\\(.*\\)$" let linenum = search(definestr, "bW") - if (linenum != 0) + if linenum != 0 let ret = ret . substitute(getline(linenum), definestr, "\\2", "") endif endwhile -- cgit v1.2.3