mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -191,15 +191,12 @@ endfunction
|
||||
"
|
||||
" Every variable name will be prefixed with 'ale_'.
|
||||
function! ale#Var(buffer, variable_name) abort
|
||||
let l:nr = str2nr(a:buffer)
|
||||
let l:full_name = 'ale_' . a:variable_name
|
||||
let l:vars = getbufvar(str2nr(a:buffer), '', 0)
|
||||
|
||||
if bufexists(l:nr)
|
||||
let l:vars = getbufvar(l:nr, '')
|
||||
elseif has_key(g:, 'ale_fix_buffer_data')
|
||||
let l:vars = get(g:ale_fix_buffer_data, l:nr, {'vars': {}}).vars
|
||||
else
|
||||
let l:vars = {}
|
||||
if l:vars is 0
|
||||
" Look for variables from deleted buffers, saved from :ALEFix
|
||||
let l:vars = get(get(g:ale_fix_buffer_data, a:buffer, {}), 'vars', {})
|
||||
endif
|
||||
|
||||
return get(l:vars, l:full_name, g:[l:full_name])
|
||||
@ -210,10 +207,29 @@ endfunction
|
||||
" Every variable name will be prefixed with 'ale_'.
|
||||
function! ale#Set(variable_name, default) abort
|
||||
let l:full_name = 'ale_' . a:variable_name
|
||||
let l:value = get(g:, l:full_name, a:default)
|
||||
let g:[l:full_name] = l:value
|
||||
|
||||
return l:value
|
||||
if !has_key(g:, l:full_name)
|
||||
let g:[l:full_name] = a:default
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Given a string for adding to a command, return the string padded with a
|
||||
" space on the left if it is not empty. Otherwise return an empty string.
|
||||
"
|
||||
" This can be used for making command strings cleaner and easier to test.
|
||||
function! ale#Pad(string) abort
|
||||
return !empty(a:string) ? ' ' . a:string : ''
|
||||
endfunction
|
||||
|
||||
" Given a environment variable name and a value, produce part of a command for
|
||||
" setting an environment variable before running a command. The syntax will be
|
||||
" valid for cmd on Windows, or most shells on Unix.
|
||||
function! ale#Env(variable_name, value) abort
|
||||
if has('win32')
|
||||
return 'set ' . a:variable_name . '=' . ale#Escape(a:value) . ' && '
|
||||
endif
|
||||
|
||||
return a:variable_name . '=' . ale#Escape(a:value) . ' '
|
||||
endfunction
|
||||
|
||||
" Escape a string suitably for each platform.
|
||||
|
Reference in New Issue
Block a user