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
2022-11-20 12:21:23 +01:00
parent 0ebb4622e9
commit b8073ac5c4
57 changed files with 578 additions and 101 deletions

View File

@ -216,7 +216,7 @@ function! s:UpdateCursor(cursor, start, end, offset) abort
" to the end of the changes
let l:cur_line = l:end_line + l:line_offset
let l:cur_column = l:end_column + l:column_offset
" else is not necesary, it means modifications are happening
" else is not necessary, it means modifications are happening
" after the cursor so no cursor updates need to be done
endif
endif

View File

@ -130,6 +130,7 @@ let s:should_complete_map = {
\ '<default>': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$',
\ 'clojure': s:lisp_regex,
\ 'lisp': s:lisp_regex,
\ 'racket': '\k\+$',
\ 'typescript': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|''$|"$',
\ 'rust': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$',
\ 'cpp': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$|-\>$',

View File

@ -570,6 +570,11 @@ let s:default_registry = {
\ 'function': 'ale#fixers#zigfmt#Fix',
\ 'suggested_filetypes': ['zig'],
\ 'description': 'Official formatter for Zig',
\ },
\ 'raco_fmt': {
\ 'function': 'ale#fixers#raco_fmt#Fix',
\ 'suggested_filetypes': ['racket'],
\ 'description': 'Fix Racket files with raco fmt.',
\ }
\}

View File

@ -0,0 +1,15 @@
" Author: Jeremy Cantrell <jmcantrell@gmail.com>
" Description: Integration of raco fmt with ALE.
call ale#Set('racket_raco_fmt_executable', 'raco')
call ale#Set('racket_raco_fmt_options', '')
function! ale#fixers#raco_fmt#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'racket_raco_fmt_executable')
let l:options = ale#Var(a:buffer, 'racket_raco_fmt_options')
return {
\ 'command': ale#Escape(l:executable) . ' fmt'
\ . (empty(l:options) ? '' : ' ' . l:options),
\}
endfunction

View File

@ -0,0 +1,54 @@
" Author: Yining <zhang.yining@gmail.com>
" Description: ruff as ALE fixer for python files
function! ale#fixers#ruff#GetCwd(buffer) abort
if ale#Var(a:buffer, 'python_ruff_change_directory')
" Run from project root if found, else from buffer dir.
let l:project_root = ale#python#FindProjectRoot(a:buffer)
return !empty(l:project_root) ? l:project_root : '%s:h'
endif
return ''
endfunction
function! ale#fixers#ruff#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_ruff_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_ruff_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
return ale#python#FindExecutable(a:buffer, 'python_ruff', ['ruff'])
endfunction
function! ale#fixers#ruff#GetCommand(buffer, version) abort
let l:executable = ale_linters#python#ruff#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry$'
\ ? ' run ruff'
\ : ''
" NOTE: ruff version `0.0.72` implement `--fix` with stdin
return ale#Escape(l:executable) . l:exec_args
\ . ale#Pad(ale#Var(a:buffer, 'python_ruff_options'))
\ . ' --fix'
\ . (ale#semver#GTE(a:version, [0, 0, 72]) ? ' -' : ' %s')
endfunction
function! ale#fixers#ruff#Fix(buffer) abort
let l:fix_cmd = {buffer -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale#fixers#ruff#GetExecutable(buffer),
\ '%e --version',
\ function('ale#fixers#ruff#GetCommand'),
\ )}(a:buffer)
return {
\ 'cwd': ale#fixers#ruff#GetCwd(a:buffer),
\ 'command': l:fix_cmd,
\}
endfunction

View File

@ -13,7 +13,7 @@ function! ale#handlers#hdl_checker#IsDotGit(path) abort
return ! empty(a:path) && isdirectory(a:path)
endfunction
" Sould return (in order of preference)
" Should return (in order of preference)
" 1. Nearest config file
" 2. Nearest .git directory
" 3. The current path

View File

@ -1,7 +1,7 @@
" Author: Horacio Sanson https://github.com/hsanson
" Description: Functions for integrating with Java tools
" Find the nearest dir contining a gradle or pom file and asume it
" Find the nearest dir contining a gradle or pom file and assume it
" the root of a java app.
function! ale#java#FindProjectRoot(buffer) abort
let l:gradle_root = ale#gradle#FindProjectRoot(a:buffer)

View File

@ -18,7 +18,7 @@ if !exists('s:timer_args')
let s:timer_args = {}
endif
" Return 1 if there is a buffer with buftype == 'quickfix' in bufffer list
" Return 1 if there is a buffer with buftype == 'quickfix' in buffer list
function! ale#list#IsQuickfixOpen() abort
let l:res = getqflist({ 'winid' : winnr() })
@ -190,7 +190,7 @@ function! s:RestoreViewIfNeeded(buffer) abort
return
endif
" Check wether the cursor has moved since linting was actually requested. If
" Check whether the cursor has moved since linting was actually requested. If
" the user has indeed moved lines, do nothing
let l:current_view = winsaveview()

View File

@ -434,7 +434,7 @@ function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort
if empty(l:root) && a:linter.lsp isnot# 'tsserver'
" If there's no project root, then we can't check files with LSP,
" unless we are using tsserver, which doesn't use project roots.
call ale#lsp_linter#AddErrorMessage(a:linter.name, "Failed to find project root, language server wont't start.")
call ale#lsp_linter#AddErrorMessage(a:linter.name, "Failed to find project root, language server won't start.")
return 0
endif