1
0
mirror of https://github.com/amix/vimrc synced 2025-08-30 02:44:59 +08:00

Updated plugins

This commit is contained in:
Amir
2022-10-15 21:05:32 +02:00
parent 950b470eb9
commit 23ee6b7311
30 changed files with 412 additions and 77 deletions

View File

@ -585,3 +585,38 @@ function! ale#c#IncludeOptions(include_paths) abort
return join(l:option_list)
endfunction
" Get the language flag depending on on the executable, options and
" file extension
function! ale#c#GetLanguageFlag(
\ buffer,
\ executable,
\ use_header_lang_flag,
\ header_exts,
\ linter_lang_flag
\) abort
" Use only '-header' if the executable is 'clang' by default
if a:use_header_lang_flag == -1
let l:use_header_lang_flag = a:executable =~# 'clang'
else
let l:use_header_lang_flag = a:use_header_lang_flag
endif
" If we don't use the header language flag, return the default linter
" language flag
if !l:use_header_lang_flag
return a:linter_lang_flag
endif
" Get the buffer file extension
let l:buf_ext = expand('#' . a:buffer . ':e')
" If the buffer file is an header according to its extension, use
" the linter language flag + '-header', ex: 'c-header'
if index(a:header_exts, l:buf_ext) >= 0
return a:linter_lang_flag . '-header'
endif
" Else, use the default linter language flag
return a:linter_lang_flag
endfunction

View File

@ -47,6 +47,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['bzl'],
\ 'description': 'Format BUILD and .bzl files with buildifier.',
\ },
\ 'css-beautify': {
\ 'function': 'ale#fixers#css_beautify#Fix',
\ 'suggested_filetypes': ['css'],
\ 'description': 'Format CSS using css-beautify from js-beautify.',
\ },
\ 'deno': {
\ 'function': 'ale#fixers#deno#Fix',
\ 'suggested_filetypes': ['typescript'],
@ -514,7 +519,7 @@ let s:default_registry = {
\ 'html-beautify': {
\ 'function': 'ale#fixers#html_beautify#Fix',
\ 'suggested_filetypes': ['html', 'htmldjango'],
\ 'description': 'Fix HTML files with html-beautify.',
\ 'description': 'Fix HTML files with html-beautify from js-beautify.',
\ },
\ 'lua-format': {
\ 'function': 'ale#fixers#lua_format#Fix',
@ -528,7 +533,7 @@ let s:default_registry = {
\ },
\ 'dprint': {
\ 'function': 'ale#fixers#dprint#Fix',
\ 'suggested_filetypes': ['javascript', 'typescript', 'json', 'markdown'],
\ 'suggested_filetypes': ['dockerfile', 'javascript', 'json', 'markdown', 'toml', 'typescript'],
\ 'description': 'Pluggable and configurable code formatting platform',
\ },
\ 'stylua': {

View File

@ -0,0 +1,20 @@
" Author: https://github.com/Spixmaster
" Description: Format CSS using css-beautify from js-beautify.
call ale#Set('css_css_beautify_executable', 'css-beautify')
call ale#Set('css_css_beautify_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('css_css_beautify_options', '')
function! ale#fixers#css_beautify#Fix(buffer) abort
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'css_css_beautify',
\ ['css-beautify']
\)
let l:options = ale#Var(a:buffer, 'css_css_beautify_options')
return {
\ 'command': ale#Escape(l:executable) . ' ' . l:options . ' -',
\}
endfunction

View File

@ -1,10 +1,9 @@
" Author: WhyNotHugo <hugo@barrera.io>
" Description: Lint HTML files with html-beautify.
"
" Description: Format HTML files with html-beautify.
call ale#Set('html_beautify_executable', 'html-beautify')
call ale#Set('html_beautify_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('html_beautify_options', '')
call ale#Set('html_beautify_change_directory', 1)
function! ale#fixers#html_beautify#Fix(buffer) abort
let l:executable = ale#python#FindExecutable(
@ -16,6 +15,6 @@ function! ale#fixers#html_beautify#Fix(buffer) abort
let l:options = ale#Var(a:buffer, 'html_beautify_options')
return {
\ 'command': ale#Escape(l:executable). ' ' . l:options . ' -',
\ 'command': ale#Escape(l:executable) . ' ' . l:options . ' -',
\}
endfunction

View File

@ -33,6 +33,8 @@ function! ale#python#FindProjectRootIni(buffer) abort
\|| filereadable(l:path . '/pylama.ini')
\|| filereadable(l:path . '/pylintrc')
\|| filereadable(l:path . '/.pylintrc')
\|| filereadable(l:path . '/pyrightconfig.json')
\|| filereadable(l:path . '/pyrightconfig.toml')
\|| filereadable(l:path . '/Pipfile')
\|| filereadable(l:path . '/Pipfile.lock')
\|| filereadable(l:path . '/poetry.lock')