1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 01:25:00 +08:00

Updated the plugins

This commit is contained in:
Amir Salihefendic
2018-09-30 17:58:57 -03:00
parent a6b64938eb
commit 44dca49794
27 changed files with 491 additions and 185 deletions

View File

@ -3,11 +3,17 @@
call ale#Set('haskell_brittany_executable', 'brittany')
function! ale#fixers#brittany#Fix(buffer) abort
function! ale#fixers#brittany#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_brittany_executable')
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'brittany')
endfunction
function! ale#fixers#brittany#Fix(buffer) abort
let l:executable = ale#fixers#brittany#GetExecutable(a:buffer)
return {
\ 'command': ale#Escape(l:executable)
\ 'command': l:executable
\ . ' --write-mode inplace'
\ . ' %t',
\ 'read_temporary_file': 1,

View File

@ -6,13 +6,28 @@ function! ale#fixers#generic_python#AddLinesBeforeControlStatements(buffer, line
let l:new_lines = []
let l:last_indent_size = 0
let l:last_line_is_blank = 0
let l:in_docstring = 0
for l:line in a:lines
let l:indent_size = len(matchstr(l:line, '^ *'))
if !l:in_docstring
" Make sure it is not just a single line docstring and then verify
" it's starting a new docstring
if match(l:line, '\v^ *("""|'''''').*("""|'''''')') == -1
\&& match(l:line, '\v^ *("""|'''''')') >= 0
let l:in_docstring = 1
endif
else
if match(l:line, '\v^ *.*("""|'''''')') >= 0
let l:in_docstring = 0
endif
endif
if !l:last_line_is_blank
\&& !l:in_docstring
\&& l:indent_size <= l:last_indent_size
\&& match(l:line, '\v^ *(return|if|for|while|break|continue)') >= 0
\&& match(l:line, '\v^ *(return|if|for|while|break|continue)(\(| |$)') >= 0
call add(l:new_lines, '')
endif

View File

@ -7,7 +7,7 @@ function! ale#fixers#hfmt#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_hfmt_executable')
return {
\ 'command': ale#Escape(l:executable)
\ 'command': ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hfmt')
\ . ' -w'
\ . ' %t',
\ 'read_temporary_file': 1,

View File

@ -1,13 +1,10 @@
" Author: eborden <evan@evan-borden.com>
" Description: Integration of hlint refactor with ALE.
"
call ale#Set('haskell_hlint_executable', 'hlint')
function! ale#fixers#hlint#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_hlint_executable')
return {
\ 'command': ale#Escape(l:executable)
\ 'command': ale#handlers#hlint#GetExecutable(a:buffer)
\ . ' --refactor'
\ . ' --refactor-options="--inplace"'
\ . ' %t',

View File

@ -3,11 +3,17 @@
"
call ale#Set('haskell_stylish_haskell_executable', 'stylish-haskell')
function! ale#fixers#stylish_haskell#Fix(buffer) abort
function! ale#fixers#stylish_haskell#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_stylish_haskell_executable')
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'stylish-haskell')
endfunction
function! ale#fixers#stylish_haskell#Fix(buffer) abort
let l:executable = ale#fixers#stylish_haskell#GetExecutable(a:buffer)
return {
\ 'command': ale#Escape(l:executable)
\ 'command': l:executable
\ . ' --inplace'
\ . ' %t',
\ 'read_temporary_file': 1,

View File

@ -0,0 +1,17 @@
scriptencoding utf-8
" Author: Ye Jingchen <ye.jingchen@gmail.com>
" Description: Utilities for ccls
function! ale#handlers#ccls#GetProjectRoot(buffer) abort
let l:project_root = ale#path#FindNearestFile(a:buffer, '.ccls-root')
if empty(l:project_root)
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
endif
if empty(l:project_root)
let l:project_root = ale#path#FindNearestFile(a:buffer, '.ccls')
endif
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
endfunction

View File

@ -0,0 +1,7 @@
function! ale#handlers#haskell_stack#EscapeExecutable(executable, stack_exec) abort
let l:exec_args = a:executable =~? 'stack$'
\ ? ' exec ' . ale#Escape(a:stack_exec) . ' --'
\ : ''
return ale#Escape(a:executable) . l:exec_args
endfunction

View File

@ -0,0 +1,8 @@
call ale#Set('haskell_hlint_executable', 'hlint')
call ale#Set('haskell_hlint_options', get(g:, 'hlint_options', ''))
function! ale#handlers#hlint#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'haskell_hlint_executable')
return ale#handlers#haskell_stack#EscapeExecutable(l:executable, 'hlint')
endfunction