mirror of
https://github.com/amix/vimrc
synced 2025-08-29 18:35:00 +08:00
Updated plugins
This commit is contained in:
@ -60,23 +60,26 @@ lockvar s:SECTCRE s:OPTCRE s:MAX_SECTION_NAME s:MAX_PROPERTY_NAME s:MAX_PROPERTY
|
||||
" Read \p config_filename and return the options applicable to
|
||||
" \p target_filename. This is the main entry point in this file.
|
||||
function! editorconfig_core#ini#read_ini_file(config_filename, target_filename)
|
||||
let l:oldenc = &encoding
|
||||
|
||||
if !filereadable(a:config_filename)
|
||||
return {}
|
||||
endif
|
||||
|
||||
try " so &encoding will always be reset
|
||||
let &encoding = 'utf-8' " so readfile() will strip BOM
|
||||
try
|
||||
let l:lines = readfile(a:config_filename)
|
||||
if &encoding !=? 'utf-8'
|
||||
" strip BOM
|
||||
if len(l:lines) > 0 && l:lines[0][:2] ==# "\xEF\xBB\xBF"
|
||||
let l:lines[0] = l:lines[0][3:]
|
||||
endif
|
||||
" convert from UTF-8 to 'encoding'
|
||||
call map(l:lines, 'iconv(v:val, "utf-8", &encoding)')
|
||||
endif
|
||||
let result = s:parse(a:config_filename, a:target_filename, l:lines)
|
||||
catch
|
||||
let &encoding = l:oldenc
|
||||
" rethrow, but with a prefix since throw 'Vim...' fails.
|
||||
throw 'Could not read editorconfig file at ' . v:throwpoint . ': ' . string(v:exception)
|
||||
endtry
|
||||
|
||||
let &encoding = l:oldenc
|
||||
return result
|
||||
endfunction
|
||||
|
||||
|
@ -124,11 +124,11 @@ is restarted.
|
||||
|
||||
*g:EditorConfig_max_line_indicator*
|
||||
The way to show the line where the maximal length is reached. Accepted values
|
||||
are "line", "fill", otherwise there will be no max line indicator.
|
||||
are "line", "fill" and "exceeding", otherwise there will be no max line
|
||||
indicator.
|
||||
|
||||
"line": the right column of the max line length column will be
|
||||
highlighted, made possible by setting 'colorcolumn' to
|
||||
"max_line_length + 1".
|
||||
highlighted, made possible by adding "+1" to 'colorcolumn'.
|
||||
|
||||
"fill": all the columns to the right of the max line length column
|
||||
will be highlighted, made possible by setting 'colorcolumn'
|
||||
@ -161,6 +161,23 @@ max_line_length is set:
|
||||
<
|
||||
This option defaults to 0.
|
||||
|
||||
*g:EditorConfig_softtabstop_space*
|
||||
When spaces are used for indent, Vim's 'softtabstop' feature will make the
|
||||
backspace key delete one indent level. If you turn off that feature (by
|
||||
setting the option to 0), only a single space will be deleted.
|
||||
This option defaults to 1, which enables 'softtabstop' and uses the
|
||||
'shiftwidth' value for it. You can also set this to -1 to automatically follow
|
||||
the current 'shiftwidth' value (since Vim 7.3.693). Or set this to [] if
|
||||
EditorConfig should not touch 'softtabstop' at all.
|
||||
|
||||
*g:EditorConfig_softtabstop_tab*
|
||||
When tabs are used for indent, Vim's 'softtabstop' feature only applies to
|
||||
backspacing over existing runs of spaces.
|
||||
This option defaults to 1, so backspace will delete one indent level worth of
|
||||
spaces; -1 does the same but automatically follows the current 'shiftwidth'
|
||||
value. Set this to 0 to have backspace delete just a single space character.
|
||||
Or set this to [] if EditorConfig should not touch 'softtabstop' at all.
|
||||
|
||||
*g:EditorConfig_verbose*
|
||||
Set this to 1 if you want debug info printed:
|
||||
>
|
||||
|
@ -60,6 +60,14 @@ if !exists('g:EditorConfig_disable_rules')
|
||||
let g:EditorConfig_disable_rules = []
|
||||
endif
|
||||
|
||||
if !exists('g:EditorConfig_softtabstop_space')
|
||||
let g:EditorConfig_softtabstop_space = 1
|
||||
endif
|
||||
|
||||
if !exists('g:EditorConfig_softtabstop_tab')
|
||||
let g:EditorConfig_softtabstop_tab = 1
|
||||
endif
|
||||
|
||||
" Copy some of the globals into script variables --- changes to these
|
||||
" globals won't affect the plugin until the plugin is reloaded.
|
||||
if exists('g:EditorConfig_core_mode') && !empty(g:EditorConfig_core_mode)
|
||||
@ -394,12 +402,18 @@ function! s:ApplyConfig(config) abort " Set the buffer options {{{1
|
||||
" value
|
||||
if a:config["indent_size"] == "tab"
|
||||
let &l:shiftwidth = &l:tabstop
|
||||
let &l:softtabstop = &l:shiftwidth
|
||||
if type(g:EditorConfig_softtabstop_tab) != type([])
|
||||
let &l:softtabstop = g:EditorConfig_softtabstop_tab > 0 ?
|
||||
\ &l:shiftwidth : g:EditorConfig_softtabstop_tab
|
||||
endif
|
||||
else
|
||||
let l:indent_size = str2nr(a:config["indent_size"])
|
||||
if l:indent_size > 0
|
||||
let &l:shiftwidth = l:indent_size
|
||||
let &l:softtabstop = &l:shiftwidth
|
||||
if type(g:EditorConfig_softtabstop_space) != type([])
|
||||
let &l:softtabstop = g:EditorConfig_softtabstop_space > 0 ?
|
||||
\ &l:shiftwidth : g:EditorConfig_softtabstop_space
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -473,7 +487,7 @@ function! s:ApplyConfig(config) abort " Set the buffer options {{{1
|
||||
if exists('+colorcolumn')
|
||||
if l:max_line_length > 0
|
||||
if g:EditorConfig_max_line_indicator == 'line'
|
||||
let &l:colorcolumn = l:max_line_length + 1
|
||||
setlocal colorcolumn+=+1
|
||||
elseif g:EditorConfig_max_line_indicator == 'fill' &&
|
||||
\ l:max_line_length < &l:columns
|
||||
" Fill only if the columns of screen is large enough
|
||||
|
@ -160,3 +160,10 @@ if extcore
|
||||
)
|
||||
test_instance vim
|
||||
end
|
||||
|
||||
# Test the vim core with latin1 encoding
|
||||
(lambda do
|
||||
puts 'Testing with express vim_core mode'
|
||||
vim = create_vim("set encoding=latin1")
|
||||
test_instance vim
|
||||
end).call
|
||||
|
Reference in New Issue
Block a user