1
0
Fork 0
mirror of synced 2024-11-22 00:35:35 -05:00

Updated plugins

This commit is contained in:
Amir 2022-09-20 10:08:17 +02:00
parent 0d39f82965
commit c6ba5aa440
8 changed files with 348 additions and 0 deletions

View file

@ -0,0 +1,63 @@
" Author: Carl Smedstad <carl.smedstad at protonmail dot com>
" Description: bicep for bicep files
let g:ale_bicep_bicep_executable =
\ get(g:, 'ale_bicep_bicep_executable', 'bicep')
let g:ale_bicep_bicep_options =
\ get(g:, 'ale_bicep_bicep_options', '')
function! ale_linters#bicep#bicep#Executable(buffer) abort
return ale#Var(a:buffer, 'bicep_bicep_executable')
endfunction
function! ale_linters#bicep#bicep#Command(buffer) abort
let l:executable = ale_linters#bicep#bicep#Executable(a:buffer)
let l:options = ale#Var(a:buffer, 'bicep_bicep_options')
if has('win32')
let l:nullfile = 'NUL'
else
let l:nullfile = '/dev/null'
endif
return ale#Escape(l:executable)
\ . ' build --outfile '
\ . l:nullfile
\ . ' '
\ . l:options
\ . ' %t'
endfunction
function! ale_linters#bicep#bicep#Handle(buffer, lines) abort
let l:pattern = '\v^.*\((\d+),(\d+)\)\s:\s([a-zA-Z]*)\s([-a-zA-Z0-9]*):\s(.*)'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
if l:match[3] is# 'Error'
let l:type = 'E'
elseif l:match[3] is# 'Warning'
let l:type = 'W'
else
let l:type = 'I'
endif
call add(l:output, {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'type': l:type,
\ 'code': l:match[4],
\ 'text': l:match[5],
\})
endfor
return l:output
endfunction
call ale#linter#Define('bicep', {
\ 'name': 'bicep',
\ 'executable': function('ale_linters#bicep#bicep#Executable'),
\ 'command': function('ale_linters#bicep#bicep#Command'),
\ 'callback': 'ale_linters#bicep#bicep#Handle',
\ 'output_stream': 'both',
\})

View file

@ -0,0 +1,49 @@
call ale#Set('yaml_gitlablint_executable', 'gll')
call ale#Set('yaml_gitlablint_options', '')
function! ale_linters#yaml#gitlablint#GetCommand(buffer) abort
return '%e' . ale#Pad(ale#Var(a:buffer, 'yaml_gitlablint_options'))
\ . ' -p %t'
endfunction
function! ale_linters#yaml#gitlablint#Handle(buffer, lines) abort
" Matches patterns line the following:
" (<unknown>): mapping values are not allowed in this context at line 68 column 8
" jobs:build:dev config contains unknown keys: ony
let l:pattern = '^\(.*\) at line \(\d\+\) column \(\d\+\)$'
let l:output = []
for l:line in a:lines
let l:match = matchlist(l:line, l:pattern)
if !empty(l:match)
let l:item = {
\ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0,
\ 'text': l:match[1],
\ 'type': 'E',
\}
call add(l:output, l:item)
else
if l:line isnot# 'GitLab CI configuration is invalid'
let l:item = {
\ 'lnum': 0,
\ 'col': 0,
\ 'text': l:line,
\ 'type': 'E',
\}
call add(l:output, l:item)
endif
endif
endfor
return l:output
endfunction
call ale#linter#Define('yaml', {
\ 'name': 'gitlablint',
\ 'executable': {b -> ale#Var(b, 'yaml_gitlablint_executable')},
\ 'command': function('ale_linters#yaml#gitlablint#GetCommand'),
\ 'callback': 'ale_linters#yaml#gitlablint#Handle',
\ 'output_stream': 'stderr',
\})

View file

@ -0,0 +1,19 @@
call ale#Set('ruby_syntax_tree_options', '')
call ale#Set('ruby_syntax_tree_executable', 'stree')
function! ale#fixers#syntax_tree#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'ruby_syntax_tree_executable')
let l:options = ale#Var(a:buffer, 'ruby_syntax_tree_options')
return ale#ruby#EscapeExecutable(l:executable, 'stree')
\ . ' write'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %t'
endfunction
function! ale#fixers#syntax_tree#Fix(buffer) abort
return {
\ 'command': ale#fixers#syntax_tree#GetCommand(a:buffer),
\ 'read_temporary_file': 1,
\}
endfunction

View file

@ -0,0 +1,24 @@
===============================================================================
ALE Bicep Integration *ale-bicep-options*
===============================================================================
bicep *ale-bicep-bicep*
g:ale_bicep_bicep_executable *g:ale_bicep_bicep_executable*
*b:ale_bicep_bicep_executable*
Type: |String|
Default: `'bicep'`
This variable can be set to change the path to bicep.
g:ale_bicep_bicep_options *g:ale_bicep_bicep_options*
*b:ale_bicep_bicep_options*
Type: |String|
Default: `'build --outfile /dev/null'`
This variable can be set to pass additional options to bicep.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View file

@ -0,0 +1,28 @@
# snippets for smarty3
extends html
extends javascript
extends css
# https://www.smarty.net/docs/en/language.function.append.tpl
snippet append "{append} is used for creating or appending template variable arrays during the execution of a template."
{append var='${1}' value='${2}'${3: index='${4|first,last|}'}${5: scope='${6|parent,root,global|}'}}
endsnippet
# https://www.smarty.net/docs/en/language.function.assign.tpl
snippet assign "{assign} is used for assigning template variables during the execution of a template."
{assign var='${1}' value='${2}'${3: scope='${4|parent,root,global|}'}}
endsnippet
# https://www.smarty.net/docs/en/language.function.config.load.tpl
snippet config_load "config_load"
{config_load file='${1}'${2: section='${3}'}${4: scope='${5|local,parent,global|}'}}
endsnippet
# https://www.smarty.net/docs/en/language.function.include.tpl
snippet include "{include} tags are used for including other templates in the current template. Any variables available in the current template are also available within the included template."
{include file='${1}'${2: assign='${3}'}${4: cache_lifetime=${5}}${6: compile_id='${7}'}${8: cache_id='${9}'}${10: scope='${11|parent,root,global|}'}${12: variables}}
endsnippet

View file

@ -0,0 +1 @@
extends _

View file

@ -0,0 +1,25 @@
extends sh
# Shebang
snippet #!
#!/usr/bin/env bash
snippet s#!
#!/usr/bin/env bash
set -eu
snippet if
if [[ $1 ]]; then
${0:${VISUAL}}
fi
snippet elif
elif [[ $1 ]]; then
${0:${VISUAL}}
snippet wh
while [[ $1 ]]; do
${0:${VISUAL}}
done
snippet until
until [[ $1 ]]; do
${0:${VISUAL}}
done

View file

@ -0,0 +1,139 @@
# snippets for smarty3
extends html
extends javascript
extends css
# https://www.smarty.net/docs/en/language.function.if.tpl
snippet if "{if cond} ... {/if}"
{if ${1}}
${0:${VISUAL}}
{/if}
snippet ifn "{if !cond} ... {/if}"
{if ${1}}
${0:${VISUAL}}
{/if}
snippet ife "{if cond} ... {else} ... {/if}"
{if ${1}}
${0:${VISUAL}}
{else}
${2}
{/if}
snippet eif "{elseif cond} ... {/if}"
{elseif ${1}}
${0:${VISUAL}}
{/if}
snippet el "{else} ... {/if}"
{else}
${1}
{/if}
# https://www.smarty.net/docs/en/language.function.for.tpl
snippet for "The {for} tag is used to create simple loops."
{for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max=${7}}}
${0:${VISUAL}}
{/for}
snippet forelse "The {for}{forelse} tag is used to create simple loops."
{for $${1:var}=${2:start} to ${3:end}${4: step ${5}}${6: max=${7}}}
${0:${VISUAL}}
{forelse}
${8}
{/for}
# https://www.smarty.net/docs/en/language.function.foreach.tpl
snippet foreach "{foreach} is used for looping over arrays of data."
{foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}}
${0:${VISUAL}}
{/foreach}
snippet foreach2 "[Smarty2] {foreach} is used for looping over arrays of data."
{foreach from=$${1:collection} item='${2}'${3: key='${4}'}${5: name='${6}'}}
${0:${VISUAL}}
{/foreach}
snippet foreachelse "{foreach} is used for looping over arrays of data."
{foreach $${1:array_variable} as $${2:var_or_key}${3: => $${4:itemvar}}}
${0:${VISUAL}}
{foreachelse}
${5}
{/foreach}
snippet wh "{while} loops in Smarty have much the same flexibility as PHP while statements, with a few added features for the template engine. Every {while} must be paired with a matching {/while}. All PHP conditionals and functions are recognized, such as ||, or, &&, and, is_array(), etc."
{while ${1}}
${0:${VISUAL}}
{/while}
# https://www.smarty.net/docs/en/language.function.append.tpl
#snippet append implemented in UltiSnips format
# https://www.smarty.net/docs/en/language.function.assign.tpl
#snippet assign implemented in UltiSnips format
# https://www.smarty.net/docs/en/language.function.block.tpl
snippet block "{block} is used to define a named area of template source for template inheritance."
{block name='${1}'}
${0:${VISUAL}}
{/block}
# https://www.smarty.net/docs/en/language.function.call.tpl
snippet call "{call} is used to call a template function defined by the {function} tag just like a plugin function."
{call name=${1}${2: assign=${3}}${4: variables}}
# https://www.smarty.net/docs/en/language.function.capture.tpl
snippet capture "{capture} is used to collect the output of the template between the tags into a variable instead of displaying it. Any content between {capture name='foo'} and {/capture} is collected into the variable specified in the name attribute. "
{capture name='${1}'${2: assign='${3}' }${4: append='${5:array_variable}'}}
${0:${VISUAL}}
{/capture}
# https://www.smarty.net/docs/en/language.function.config.load.tpl
#snippet config_load implemented in UltiSnips format
# https://www.smarty.net/docs/en/language.function.extends.tpl
snippet extends "{extends} tags are used in child templates in template inheritance for extending parent templates."
{extends file='${1}'}
# https://www.smarty.net/docs/en/language.function.function.tpl
snippet function "{function} is used to create functions within a template and call them just like a plugin function. Instead of writing a plugin that generates presentational content, keeping it in the template is often a more manageable choice. It also simplifies data traversal, such as deeply nested menus."
{function name='${1}' ${2:variables}}
${0:${VISUAL}}
{/function}
# https://www.smarty.net/docs/en/language.function.include.tpl
#snippet include implemented in UltiSnips format
# https://www.smarty.net/docs/en/language.function.literal.tpl
snippet literal "{literal} tags allow a block of data to be taken literally. This is typically used around Javascript or stylesheet blocks where {curly braces} would interfere with the template delimiter syntax"
{literal}
${0:${VISUAL}}
{/literal}
# https://www.smarty.net/docs/en/language.function.nocache.tpl
snippet nocache "{nocache} is used to disable caching of a template section. Every {nocache} must be paired with a matching {/nocache}."
{nocache}
${0:${VISUAL}}
{/nocache}
# https://www.smarty.net/docs/en/language.function.section.tpl
snippet section "A {section} is for looping over sequentially indexed arrays of data, unlike {foreach} which is used to loop over a single associative array. Every {section} tag must be paired with a closing {/section} tag."
{section name='${1}'${2: loop='${3}'}${4: start=${5}}${6: step=${7}}${8: max=${9}}${10: show=${11}}}
${0:${VISUAL}}
{/section}
# https://www.smarty.net/docs/en/language.function.setfilter.tpl
snippet setfilter "The {setfilter}...{/setfilter} block tag allows the definition of template instance's variable filters."
{setfilter ${1:filters}}
${0:${VISUAL}}
{/setfilter}
# https://www.smarty.net/docs/en/language.function.strip.tpl
snippet strip "Anything within {strip}{/strip} tags are stripped of the extra spaces or carriage returns at the beginnings and ends of the lines before they are displayed. This way you can keep your templates readable, and not worry about extra white space causing problems."
{strip}
${0:${VISUAL}}
{/strip}