1
0
mirror of https://github.com/amix/vimrc synced 2025-07-01 20:55:00 +08:00

Updated plugins

This commit is contained in:
Amir
2023-08-20 16:33:32 +02:00
parent 06f872cb2f
commit 8240935caa
34 changed files with 497 additions and 279 deletions

View File

@ -12,8 +12,10 @@ let s:cursor_timer = -1
" A wrapper for echon so we can test messages we echo in Vader tests.
function! ale#cursor#Echom(message) abort
" no-custom-checks
exec "norm! :echom a:message\n"
if mode() is# 'n'
" no-custom-checks
exec "norm! :echom a:message\n"
endif
endfunction
function! ale#cursor#TruncatedEcho(original_message) abort

View File

@ -179,7 +179,12 @@ let s:default_registry = {
\ 'yamlfix': {
\ 'function': 'ale#fixers#yamlfix#Fix',
\ 'suggested_filetypes': ['yaml'],
\ 'description': 'Fix yaml files with yamlfix.',
\ 'description': 'Fix YAML files with yamlfix.',
\ },
\ 'yamlfmt': {
\ 'function': 'ale#fixers#yamlfmt#Fix',
\ 'suggested_filetypes': ['yaml'],
\ 'description': 'Format YAML files with yamlfmt.',
\ },
\ 'yapf': {
\ 'function': 'ale#fixers#yapf#Fix',
@ -615,6 +620,11 @@ let s:default_registry = {
\ 'function': 'ale#fixers#npmgroovylint#Fix',
\ 'suggested_filetypes': ['groovy'],
\ 'description': 'Fix Groovy files with npm-groovy-fix.',
\ },
\ 'erb-formatter': {
\ 'function': 'ale#fixers#erbformatter#Fix',
\ 'suggested_filetypes': ['eruby'],
\ 'description': 'Apply erb-formatter -w to eruby/erb files.',
\ }
\}

View File

@ -0,0 +1,13 @@
" Author: Arash Mousavi <arash-m>
" Description: Support for ERB::Formetter https://github.com/nebulab/erb-formatter
call ale#Set('eruby_erbformatter_executable', 'erb-formatter')
function! ale#fixers#erbformatter#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'eruby_erbformatter_executable')
return {
\ 'command': ale#Escape(l:executable) . ' -w %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@ -1,4 +1,4 @@
" Author: Cyril Roelandt <tipecaml@gmail.com>
" Author: Cyril Roelandt <tipecaml@gmail.com>, jiz4oh <me@jiz4oh.com>
" Description: Integration of xmllint with ALE.
call ale#Set('xml_xmllint_executable', 'xmllint')
@ -7,7 +7,14 @@ call ale#Set('xml_xmllint_indentsize', 2)
function! ale#fixers#xmllint#Fix(buffer) abort
let l:executable = ale#Escape(ale#Var(a:buffer, 'xml_xmllint_executable'))
let l:filename = ale#Escape(bufname(a:buffer))
let l:filename = bufname(a:buffer)
if empty(l:filename)
let l:filename = '%t'
else
let l:filename = ale#Escape(l:filename)
endif
let l:command = l:executable . ' --format ' . l:filename
let l:indent = ale#Var(a:buffer, 'xml_xmllint_indentsize')

View File

@ -0,0 +1,20 @@
" Author: https://github.com/Spixmaster
" Description: Format YAML files with yamlfmt.
call ale#Set('yaml_yamlfmt_executable', 'yamlfmt')
call ale#Set('yaml_yamlfmt_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('yaml_yamlfmt_options', '')
function! ale#fixers#yamlfmt#Fix(buffer) abort
let l:executable = ale#python#FindExecutable(
\ a:buffer,
\ 'yaml_yamlfmt',
\ ['yamlfmt']
\)
let l:options = ale#Var(a:buffer, 'yaml_yamlfmt_options')
return {
\ 'command': ale#Escape(l:executable) . ' ' . l:options . ' -in',
\}
endfunction

View File

@ -37,15 +37,21 @@ function! s:NvimShow(lines, options) abort
endif
" Execute commands in window context
let l:parent_window = nvim_get_current_win()
if exists('*win_execute')
for l:command in get(a:options, 'commands', [])
call win_execute(w:preview['id'], l:command)
endfor
else
let l:parent_window = nvim_get_current_win()
call nvim_set_current_win(w:preview['id'])
call nvim_set_current_win(w:preview['id'])
for l:command in get(a:options, 'commands', [])
call execute(l:command)
endfor
for l:command in get(a:options, 'commands', [])
call execute(l:command)
endfor
call nvim_set_current_win(l:parent_window)
call nvim_set_current_win(l:parent_window)
endif
" Return to parent context on move
augroup ale_floating_preview_window

View File

@ -24,14 +24,19 @@ endfunction
function! ale#handlers#cspell#Handle(buffer, lines) abort
" Look for lines like the following:
"
" /home/user/repos/ale/README.md:723:48 - Unknown word (stylelint)
let l:pattern = '\v^.*:(\d+):(\d+) - (.*)$'
" /home/user/repos/ale/README.md:3:128 - Unknown word (Neovim)
" match1: 3
" match2: 128
" match3: Unknown word (Neovim)
" match4: Neovim
let l:pattern = '\v^.*:(\d+):(\d+) - ([^\(]+\(([^\)]+)\).*)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'end_col': l:match[2] + len(l:match[4]) - 1,
\ 'text': l:match[3],
\ 'type': 'W',
\})

View File

@ -70,6 +70,18 @@ function! s:ConvertLanguageName(language) abort
return a:language
endfunction
" Cache syntax file (non-)existence to avoid calling globpath repeatedly.
let s:syntax_file_exists_cache = {}
function! s:SyntaxFileExists(syntax_file) abort
if !has_key(s:syntax_file_exists_cache, a:syntax_file)
let s:syntax_file_exists_cache[a:syntax_file] =
\ !empty(globpath(&runtimepath, a:syntax_file))
endif
return s:syntax_file_exists_cache[a:syntax_file]
endfunction
function! ale#hover#ParseLSPResult(contents) abort
let l:includes = {}
let l:highlights = []
@ -160,10 +172,11 @@ function! ale#hover#ParseLSPResult(contents) abort
let l:language = s:ConvertLanguageName(l:language)
if !empty(l:language)
let l:includes[l:language] = printf(
\ 'syntax/%s.vim',
\ l:language,
\)
let l:syntax_file = printf('syntax/%s.vim', l:language)
if s:SyntaxFileExists(l:syntax_file)
let l:includes[l:language] = l:syntax_file
endif
let l:start = len(l:lines) + 1
let l:end = l:start + len(l:marked_lines)

View File

@ -42,7 +42,7 @@ let s:default_ale_linters = {
\ 'apkbuild': ['apkbuild_lint', 'secfixes_check'],
\ 'csh': ['shell'],
\ 'elixir': ['credo', 'dialyxir', 'dogma'],
\ 'go': ['gofmt', 'gopls', 'govet'],
\ 'go': ['gofmt', 'golangci-lint', 'gopls', 'govet'],
\ 'groovy': ['npm-groovy-lint'],
\ 'hack': ['hack'],
\ 'help': [],

View File

@ -424,7 +424,7 @@ function! s:SendInitMessage(conn) abort
\ 'completionItem': {
\ 'snippetSupport': v:false,
\ 'commitCharactersSupport': v:false,
\ 'documentationFormat': ['plaintext'],
\ 'documentationFormat': ['plaintext', 'markdown'],
\ 'deprecatedSupport': v:false,
\ 'preselectSupport': v:false,
\ },
@ -432,7 +432,7 @@ function! s:SendInitMessage(conn) abort
\ },
\ 'hover': {
\ 'dynamicRegistration': v:false,
\ 'contentFormat': ['plaintext'],
\ 'contentFormat': ['plaintext', 'markdown'],
\ },
\ 'references': {
\ 'dynamicRegistration': v:false,

View File

@ -87,7 +87,7 @@ execute 'sign define ALEInfoSign text=' . s:EscapeSignText(g:ale_sign_info)
\ . ' texthl=ALEInfoSign linehl=ALEInfoLine'
sign define ALEDummySign text=\ texthl=SignColumn
if g:ale_sign_highlight_linenrs && has('nvim-0.3.2')
if g:ale_sign_highlight_linenrs && (has('nvim-0.3.2') || has('patch-8.2.3874'))
if !hlexists('ALEErrorSignLineNr')
highlight link ALEErrorSignLineNr CursorLineNr
endif