From bc8a81d3592dab86334f27d1d43c080ebf680d42 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Fri, 14 Oct 2022 17:40:10 +0200 Subject: Update --- ftplugin/caddyfile.vim | 7 ++++--- ftplugin/erlang.vim | 22 ++++++++++++++++++++-- ftplugin/eruby.vim | 10 +++++++--- ftplugin/gitcommit.vim | 15 +++++++++------ ftplugin/gitrebase.vim | 2 +- ftplugin/haml.vim | 2 +- ftplugin/julia.vim | 6 ++++++ ftplugin/markdown.vim | 6 +++++- ftplugin/mir.vim | 17 +++++++++++++++++ ftplugin/ps1.vim | 2 +- ftplugin/requirements.vim | 46 ++++++++++++++++++++++++++++++++++++++++++++++ ftplugin/zig.vim | 7 +++++++ 12 files changed, 124 insertions(+), 18 deletions(-) create mode 100644 ftplugin/mir.vim create mode 100644 ftplugin/requirements.vim (limited to 'ftplugin') diff --git a/ftplugin/caddyfile.vim b/ftplugin/caddyfile.vim index b3e48a08..ae45e27e 100644 --- a/ftplugin/caddyfile.vim +++ b/ftplugin/caddyfile.vim @@ -2,8 +2,9 @@ if polyglot#init#is_disabled(expand(':p'), 'caddyfile', 'ftplugin/caddyfi finish endif -" Language: Caddyfile -" Author: Josh Glendenning +" Language: Caddyfile +" Maintainer: 0az <0az@afzhou.com> +" Original Author: Josh Glendenning if exists('b:did_ftplugin') finish @@ -20,7 +21,7 @@ if exists('g:NERDDelimiterMap') endif elseif exists('g:NERDCustomDelimiters') if !has_key(g:NERDCustomDelimiters, 'caddyfile') - let g:NERDDelimiterMap.caddyfile = s:delimiters + let g:NERDCustomDelimiters.caddyfile = s:delimiters endif else let g:NERDCustomDelimiters = {'caddyfile': s:delimiters} diff --git a/ftplugin/erlang.vim b/ftplugin/erlang.vim index 85f57209..d9a7eaeb 100644 --- a/ftplugin/erlang.vim +++ b/ftplugin/erlang.vim @@ -9,7 +9,8 @@ endif " Contributors: Ricardo Catalinas Jiménez " Eduardo Lopez (http://github.com/tapichu) " Arvid Bjurklint (http://github.com/slarwise) -" Last Update: 2021-Jan-08 +" Paweł Zacharek (http://github.com/subc2) +" Last Update: 2022-Sep-28 " License: Vim license " URL: https://github.com/vim-erlang/vim-erlang-runtime @@ -61,7 +62,7 @@ setlocal suffixesadd=.erl,.hrl let &l:include = '^\s*-\%(include\|include_lib\)\s*("\zs\f*\ze")' let &l:define = '^\s*-\%(define\|record\|type\|opaque\)' -let s:erlang_fun_begin = '^\a\w*(.*$' +let s:erlang_fun_begin = '^\l[A-Za-z0-9_@]*(.*$' let s:erlang_fun_end = '^[^%]*\.\s*\(%.*\)\?$' if !exists('*GetErlangFold') @@ -103,6 +104,23 @@ let b:undo_ftplugin = "setlocal keywordprg< foldmethod< foldexpr< foldtext<" \ . " comments< commentstring< formatoptions< suffixesadd< include<" \ . " define<" +" The following lines enable the macros/matchit.vim plugin for +" extended matching with the % key. +if exists("loaded_matchit") + let s:sw = &sw + if exists('*shiftwidth') + let s:sw = shiftwidth() + endif + + let b:match_words = + \ '\<\%(begin\|case\|fun\|if\|maybe\|receive\|try\)\>' . + \ ':\<\%(after\|catch\|else\|of\)\>' . + \ ':\,' . + \ '^\l[A-Za-z0-9_@]*' . + \ ':^\%(\%(\t\| \{' . s:sw . '}\)\%([^\t\ %][^%]*\)\?\)\?;\s*\%(%.*\)\?$\|\.[\t\ %]\|\.$' + let b:match_skip = 's:comment\|string\|erlangmodifier\|erlangquotedatom' +endif + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/ftplugin/eruby.vim b/ftplugin/eruby.vim index 7ea19dea..33c769dd 100644 --- a/ftplugin/eruby.vim +++ b/ftplugin/eruby.vim @@ -89,8 +89,12 @@ runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim let b:did_ftplugin = 1 " Combine the new set of values with those previously included. -if exists("b:undo_ftplugin") - let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin +if !exists('b:undo_ftplugin') + " No-op + let b:undo_ftplugin = 'exe' +endif +if !empty(s:undo_ftplugin) + let b:undo_ftplugin .= '|' . s:undo_ftplugin endif if exists ("b:browsefilter") let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter @@ -122,7 +126,7 @@ endif setlocal commentstring=<%#%s%> let b:undo_ftplugin = "setl cms< " . - \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin + \ " | unlet! b:browsefilter b:match_words | " . b:undo_ftplugin let &cpo = s:save_cpo unlet s:save_cpo diff --git a/ftplugin/gitcommit.vim b/ftplugin/gitcommit.vim index 56e72973..bcd82356 100644 --- a/ftplugin/gitcommit.vim +++ b/ftplugin/gitcommit.vim @@ -5,7 +5,7 @@ endif " Vim filetype plugin " Language: git commit file " Maintainer: Tim Pope -" Last Change: 2019 Dec 05 +" Last Change: 2022 Jan 05 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) @@ -16,7 +16,7 @@ let b:did_ftplugin = 1 setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72 setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q formatoptions+=n -setlocal formatlistpat+=\\\|^\\s*[-*+]\\s\\+ +setlocal formatlistpat=^\\s*\\d\\+[\\]:.)}]\\s\\+\\\|^\\s*[-*+]\\s\\+ setlocal include=^+++ setlocal includeexpr=substitute(v:fname,'^[bi]/','','') @@ -46,6 +46,11 @@ function! s:diffcomplete(A, L, P) abort return args endfunction +function! s:setupdiff() abort + command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(0, ) + setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git +endfunction + function! s:gitdiffcached(bang, ...) abort let name = tempname() if a:0 @@ -54,8 +59,6 @@ function! s:gitdiffcached(bang, ...) abort let extra = "-p --stat=".&columns endif call system("git diff --cached --no-color --no-ext-diff ".extra." > ".shellescape(name)) - exe "pedit " . fnameescape(name) - wincmd P - command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(0, ) - setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git + exe 'pedit +call\ s:setupdiff()' fnameescape(name) + silent! wincmd P endfunction diff --git a/ftplugin/gitrebase.vim b/ftplugin/gitrebase.vim index 285f76a4..f83280a1 100644 --- a/ftplugin/gitrebase.vim +++ b/ftplugin/gitrebase.vim @@ -5,7 +5,7 @@ endif " Vim filetype plugin " Language: git rebase --interactive " Maintainer: Tim Pope -" Last Change: 2019 Dec 05 +" Last Change: 2022 Jan 05 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) diff --git a/ftplugin/haml.vim b/ftplugin/haml.vim index ec6f249d..1dc83371 100644 --- a/ftplugin/haml.vim +++ b/ftplugin/haml.vim @@ -5,7 +5,7 @@ endif " Vim filetype plugin " Language: Haml " Maintainer: Tim Pope -" Last Change: 2016 Aug 29 +" Last Change: 2019 Dec 05 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") diff --git a/ftplugin/julia.vim b/ftplugin/julia.vim index e33b1a42..de983466 100644 --- a/ftplugin/julia.vim +++ b/ftplugin/julia.vim @@ -26,10 +26,16 @@ setlocal fo-=t fo+=croql let b:julia_vim_loaded = 1 let b:undo_ftplugin = "setlocal include< suffixesadd< comments< commentstring<" + \ . " expandtab< shiftwidth<" \ . " define< fo< indentexpr< indentkeys< cinoptions< completefunc<" \ . " | unlet! b:commentary_format" \ . " | unlet! b:smartcomment_force_linemode" \ . " | unlet! b:julia_vim_loaded" + +if !exists("g:julia_set_indentation") || g:julia_set_indentation != 0 + " As suggested by Style Guide. + setlocal expandtab shiftwidth=4 +endif " MatchIt plugin support if exists("loaded_matchit") diff --git a/ftplugin/markdown.vim b/ftplugin/markdown.vim index d3129a87..a0474d94 100644 --- a/ftplugin/markdown.vim +++ b/ftplugin/markdown.vim @@ -860,7 +860,11 @@ endfunction function! s:MarkdownRefreshSyntax(force) - if &filetype =~# 'markdown' && line('$') > 1 + " Use != to compare &syntax's value to use the same logic run on + " $VIMRUNTIME/syntax/synload.vim. + " + " vint: next-line -ProhibitEqualTildeOperator + if &filetype =~# 'markdown' && line('$') > 1 && &syntax != 'OFF' call s:MarkdownHighlightSources(a:force) endif endfunction diff --git a/ftplugin/mir.vim b/ftplugin/mir.vim new file mode 100644 index 00000000..332e3272 --- /dev/null +++ b/ftplugin/mir.vim @@ -0,0 +1,17 @@ +if polyglot#init#is_disabled(expand(':p'), 'llvm', 'ftplugin/mir.vim') + finish +endif + +" Vim filetype plugin file +" Language: LLVM Machine IR +" Maintainer: The LLVM team, http://llvm.org/ + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal softtabstop=2 shiftwidth=2 +setlocal expandtab +setlocal comments+=:; + diff --git a/ftplugin/ps1.vim b/ftplugin/ps1.vim index e7c1a853..82e18469 100644 --- a/ftplugin/ps1.vim +++ b/ftplugin/ps1.vim @@ -17,7 +17,7 @@ let b:did_ftplugin = 1 setlocal tw=0 setlocal commentstring=#%s -setlocal formatoptions=tcqro +setlocal formatoptions+=tcqroj " Enable autocompletion of hyphenated PowerShell commands, " e.g. Get-Content or Get-ADUser setlocal iskeyword+=- diff --git a/ftplugin/requirements.vim b/ftplugin/requirements.vim new file mode 100644 index 00000000..b79e55e7 --- /dev/null +++ b/ftplugin/requirements.vim @@ -0,0 +1,46 @@ +if polyglot#init#is_disabled(expand(':p'), 'requirements', 'ftplugin/requirements.vim') + finish +endif + +" the Requirements File Format syntax support for Vim +" Version: 1.7.1 +" Author: raimon +" License: MIT LICENSE +" The MIT License (MIT) +" +" Copyright (c) 2015 raimon +" +" Permission is hereby granted, free of charge, to any person obtaining a copy +" of this software and associated documentation files (the "Software"), to deal +" in the Software without restriction, including without limitation the rights +" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +" copies of the Software, and to permit persons to whom the Software is +" furnished to do so, subject to the following conditions: +" +" The above copyright notice and this permission notice shall be included in all +" copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +" SOFTWARE. +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:save_cpoptions = &cpoptions +set cpoptions&vim + +let b:undo_ftplugin = "setl iskeyword< commentstring<" +" pip options contain "-" +setlocal iskeyword+=- +setlocal commentstring=#\ %s +compiler pip_compile + +let &cpoptions = s:save_cpoptions +unlet s:save_cpoptions +" vim: et sw=4 ts=4 sts=4: diff --git a/ftplugin/zig.vim b/ftplugin/zig.vim index 1e6f91b3..a2921a9b 100644 --- a/ftplugin/zig.vim +++ b/ftplugin/zig.vim @@ -54,6 +54,13 @@ endif let b:undo_ftplugin = \ 'setl isk< et< ts< sts< sw< fo< sua< mp< com< cms< inex< inc< pa<' +augroup vim-zig + autocmd! * + autocmd BufWritePre if get(g:, 'zig_fmt_autosave', 1) | call zig#fmt#Format() | endif +augroup END + +let b:undo_ftplugin .= '|au! vim-zig * ' + let &cpo = s:cpo_orig unlet s:cpo_orig " vim: tabstop=8 shiftwidth=4 softtabstop=4 expandtab -- cgit v1.2.3