mirror of
https://github.com/amix/vimrc
synced 2025-07-09 18:55:01 +08:00
Use sources_non_forked folder for pathogen path, with sources_non_forked_fallback folder as fallback.
This commit is contained in:
@ -1,43 +0,0 @@
|
||||
" Author: hsanson <hsanson@gmail.com>
|
||||
" Description: Lints sh files using bashate
|
||||
" URL: https://github.com/openstack/bashate
|
||||
|
||||
call ale#Set('sh_bashate_executable', 'bashate')
|
||||
call ale#Set('sh_bashate_options', '')
|
||||
|
||||
function! ale_linters#sh#bashate#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'sh_bashate_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#bashate#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'sh_bashate_options')
|
||||
let l:executable = ale_linters#sh#bashate#GetExecutable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable) . ' ' . l:options . ' ' . '%t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#bashate#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" /path/to/script/file:694:1: E003 Indent not multiple of 4
|
||||
let l:pattern = ':\(\d\+\):\(\d\+\): \(.*\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'col': str2nr(l:match[2]),
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('sh', {
|
||||
\ 'name': 'bashate',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': function('ale_linters#sh#bashate#GetExecutable'),
|
||||
\ 'command': function('ale_linters#sh#bashate#GetCommand'),
|
||||
\ 'callback': 'ale_linters#sh#bashate#Handle',
|
||||
\})
|
@ -1,5 +0,0 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for shell scripts.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('sh')
|
@ -1,32 +0,0 @@
|
||||
" Author: Christian Höltje (https://docwhat.org/)
|
||||
" Description: BASH Language server integration for ALE
|
||||
scriptencoding utf-8
|
||||
|
||||
call ale#Set('sh_language_server_executable', 'bash-language-server')
|
||||
call ale#Set('sh_language_server_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#sh#language_server#GetExecutable(buffer) abort
|
||||
return ale#path#FindExecutable(a:buffer, 'sh_language_server', [
|
||||
\ 'node_modules/.bin/bash-language-server',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#language_server#GetCommand(buffer) abort
|
||||
let l:exe = ale#Escape(ale_linters#sh#language_server#GetExecutable(a:buffer))
|
||||
|
||||
return l:exe . ' start'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#language_server#GetProjectRoot(buffer) abort
|
||||
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||
|
||||
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('sh', {
|
||||
\ 'name': 'language_server',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#sh#language_server#GetExecutable'),
|
||||
\ 'command': function('ale_linters#sh#language_server#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#sh#language_server#GetProjectRoot'),
|
||||
\})
|
@ -1,59 +0,0 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Lints shell files by invoking the shell with -n
|
||||
|
||||
" Backwards compatibility
|
||||
if exists('g:ale_linters_sh_shell_default_shell')
|
||||
let g:ale_sh_shell_default_shell = g:ale_linters_sh_shell_default_shell
|
||||
endif
|
||||
|
||||
" This option can be changed to change the default shell when the shell
|
||||
" cannot be taken from the hashbang line.
|
||||
if !exists('g:ale_sh_shell_default_shell')
|
||||
let g:ale_sh_shell_default_shell = fnamemodify($SHELL, ':t')
|
||||
|
||||
if g:ale_sh_shell_default_shell is# '' || g:ale_sh_shell_default_shell is# 'fish'
|
||||
let g:ale_sh_shell_default_shell = 'bash'
|
||||
endif
|
||||
endif
|
||||
|
||||
function! ale_linters#sh#shell#GetExecutable(buffer) abort
|
||||
let l:shell_type = ale#handlers#sh#GetShellType(a:buffer)
|
||||
|
||||
if !empty(l:shell_type)
|
||||
return l:shell_type
|
||||
endif
|
||||
|
||||
return ale#Var(a:buffer, 'sh_shell_default_shell')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#shell#GetCommand(buffer) abort
|
||||
return ale_linters#sh#shell#GetExecutable(a:buffer) . ' -n %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#shell#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" bash: line 13: syntax error near unexpected token `d'
|
||||
" bash:行0: 未预期的符号“done”附近有语法错误
|
||||
" bash: 列 90: 尋找匹配的「"」時遇到了未預期的檔案結束符
|
||||
" sh: 11: Syntax error: "(" unexpected
|
||||
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': str2nr(l:match[2]),
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('sh', {
|
||||
\ 'name': 'shell',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': function('ale_linters#sh#shell#GetExecutable'),
|
||||
\ 'command': function('ale_linters#sh#shell#GetCommand'),
|
||||
\ 'callback': 'ale_linters#sh#shell#Handle',
|
||||
\})
|
@ -1,4 +0,0 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: shellcheck linter for shell scripts.
|
||||
|
||||
call ale#handlers#shellcheck#DefineLinter('sh')
|
Reference in New Issue
Block a user