1
0
mirror of https://github.com/amix/vimrc synced 2025-08-29 18:35:00 +08:00

Updated plugins

This commit is contained in:
Amir
2023-04-01 22:48:04 +02:00
parent 2b653aa950
commit b318c1d0e5
96 changed files with 2382 additions and 625 deletions

View File

@ -96,12 +96,10 @@ test_script:
# Run the core tests
- ctest . --output-on-failure -C Debug
# CTestCustom specifies skipping UTF-8 tests on Windows.
- cmd: echo "Reminder - did not try UTF-8"
- sh: echo "Reminder - tried UTF-8"
# CTestCustom specifies skipping some tests on Windows.
- cmd: echo "Reminder - skipped some tests"
on_failure:
- echo "failed"
- cmd: type tests\core\build\Testing\Temporary\LastTest.log
- sh: cat tests/core/build/Testing/Temporary/LastTest.log

View File

@ -14,8 +14,8 @@ To install this plugin, you can use one of the following ways:
Download the [archive][] and extract it into your Vim runtime directory
(`~/.vim` on UNIX/Linux and `$VIM_INSTALLATION_FOLDER\vimfiles` on windows).
You should have 3 sub-directories in this runtime directory now: "autoload",
"doc" and "plugin".
You should have 4 sub-directories in this runtime directory now: "autoload",
"doc", "ftdetect" and "plugin".
### Install as Vim8 plugin

View File

@ -45,22 +45,24 @@ if !exists('g:editorconfig_core_vimscript_debug')
endif
" }}}1
" === Regexes =========================================================== {{{1
let s:LEFT_BRACE = '\v%(^|[^\\])\{'
let s:LEFT_BRACE = '\v[\\]@8<!\{'
" 8 is an arbitrary byte-count limit to the lookbehind (micro-optimization)
"LEFT_BRACE = re.compile(
" r"""
"
" (?: ^ | [^\\] ) # Beginning of string or a character besides "\"
" (?<! \\ ) # Not preceded by "\"
"
" \{ # "{"
"
" """, re.VERBOSE
")
let s:RIGHT_BRACE = '\v%(^|[^\\])\}'
let s:RIGHT_BRACE = '\v[\\]@8<!\}'
" 8 is an arbitrary byte-count limit to the lookbehind (micro-optimization)
"RIGHT_BRACE = re.compile(
" r"""
"
" (?: ^ | [^\\] ) # Beginning of string or a character besides "\"
" (?<! \\ ) # Not preceded by "\"
"
" \} # "}"
"

View File

@ -49,8 +49,8 @@ let s:SECTCRE = '\v^\s*\[(%([^\\#;]|\\.)+)\]'
let s:OPTCRE = '\v\s*([^:=[:space:]][^:=]*)\s*([:=])\s*(.*)$'
let s:MAX_SECTION_NAME = 4096
let s:MAX_PROPERTY_NAME = 50
let s:MAX_PROPERTY_VALUE = 255
let s:MAX_PROPERTY_NAME = 1024
let s:MAX_PROPERTY_VALUE = 4096
lockvar s:SECTCRE s:OPTCRE s:MAX_SECTION_NAME s:MAX_PROPERTY_NAME s:MAX_PROPERTY_VALUE
@ -155,18 +155,6 @@ function! s:parse(config_filename, target_filename, lines)
echom printf('Saw raw opt <%s>=<%s>', l:optname, l:optval)
endif
if l:optval =~# '\v[;#]'
" ';' and '#' are comment delimiters only if
" preceded by a spacing character
let l:m = matchlist(l:optval, '\v(.{-})\s[;#]')
if len(l:m)
let l:optval = l:m[1]
endif
" ; and # can be escaped with backslash.
let l:optval = substitute(l:optval, '\v\\([;#])', '\1', 'g')
endif
let l:optval = editorconfig_core#util#strip(l:optval)
" allow empty values
if l:optval ==? '""'

View File

@ -124,35 +124,48 @@ is restarted.
*g:EditorConfig_max_line_indicator*
The way to show the line where the maximal length is reached. Accepted values
are "line", "fill" and "exceeding", otherwise there will be no max line
indicator.
are "line", "fill", "exceeding" and "fillexceeding", otherwise there will be
no max line indicator.
"line": the right column of the max line length column will be
highlighted, made possible by adding "+1" to 'colorcolumn'.
"line": the right column of the max line length column will be
highlighted on all lines, 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'
to a list of numbers starting from "max_line_length + 1" to
the number of columns on the screen.
"fill": all the columns to the right of the max line length
column will be highlighted on all lines, by setting
'colorcolumn' to a list starting from "max_line_length +
1" to the number of columns on the screen.
"exceeding": the right column of the max line length column will be
highlighted on lines that exceed the max line length, made
possible by adding a match for the ColorColumn group.
"exceeding": the right column of the max line length column will be
highlighted on lines that exceed the max line length, by
adding a match for the ColorColumn group.
"none": no max line length indicator will be shown. This is the
recommended value when you do not want any indicator to be
shown, but values other than "line" or "fill" would also work
as "none".
"fillexceeding": all the columns to the right of the max line length
column will be highlighted on lines that exceed the max
line length, by adding a match for the ColorColumn group.
"none": no max line length indicator will be shown. Recommended
when you do not want any indicator to be shown, but any
value other than those listed above also work as "none".
To set this option, add any of the following lines to your |vimrc| file:
>
let g:EditorConfig_max_line_indicator = "line"
let g:EditorConfig_max_line_indicator = "fill"
let g:EditorConfig_max_line_indicator = "exceeding"
let g:EditorConfig_max_line_indicator = "fillexceeding"
let g:EditorConfig_max_line_indicator = "none"
<
The default value is "line".
*g:EditorConfig_enable_for_new_buf*
Set this to 1 if you want EditorConfig plugin to set options
for new empty buffers too.
Path to .editorconfig will be determined based on CWD (see |getcwd()|)
>
let g:EditorConfig_enable_for_new_buf = 1
<
This option defaults to 0.
*g:EditorConfig_preserve_formatoptions*
Set this to 1 if you don't want your formatoptions modified when
max_line_length is set:

View File

@ -0,0 +1 @@
autocmd BufNewFile,BufRead .editorconfig setfiletype dosini

View File

@ -1,3 +1,3 @@
#!/bin/sh
zip -r editorconfig-vim-$*.zip plugin/* autoload/* doc/*
zip -r editorconfig-vim-$*.zip autoload/* doc/* ftdetect/* plugin/*

View File

@ -60,6 +60,10 @@ if !exists('g:EditorConfig_disable_rules')
let g:EditorConfig_disable_rules = []
endif
if !exists('g:EditorConfig_enable_for_new_buf')
let g:EditorConfig_enable_for_new_buf = 0
endif
if !exists('g:EditorConfig_softtabstop_space')
let g:EditorConfig_softtabstop_space = 1
endif
@ -203,11 +207,22 @@ endfunction " }}}1
function! s:UseConfigFiles() abort " Apply config to the current buffer {{{1
let b:editorconfig_tried = 1
let l:buffer_name = expand('%:p')
" ignore buffers without a name
if empty(l:buffer_name)
" Only process normal buffers (do not treat help files as '.txt' files)
" When starting Vim with a directory, the buftype might not yet be set:
" Therefore, also check if buffer_name is a directory.
if index(['', 'acwrite'], &buftype) == -1 || isdirectory(l:buffer_name)
return
endif
if empty(l:buffer_name)
if g:EditorConfig_enable_for_new_buf
let l:buffer_name = getcwd() . "/."
else
return
endif
endif
if exists("b:EditorConfig_disable") && b:EditorConfig_disable
if g:EditorConfig_verbose
echo 'Skipping EditorConfig for buffer "' . l:buffer_name . '"'
@ -247,11 +262,11 @@ function! s:UseConfigFiles() abort " Apply config to the current buffer {{{1
endfor
if s:editorconfig_core_mode ==? 'vim_core'
if s:UseConfigFiles_VimCore() == 0
if s:UseConfigFiles_VimCore(l:buffer_name) == 0
let b:editorconfig_applied = 1
endif
elseif s:editorconfig_core_mode ==? 'external_command'
call s:UseConfigFiles_ExternalCommand()
call s:UseConfigFiles_ExternalCommand(l:buffer_name)
let b:editorconfig_applied = 1
else
echohl Error |
@ -269,6 +284,7 @@ function! s:EditorConfigEnable(should_enable)
autocmd!
if a:should_enable
autocmd BufNewFile,BufReadPost,BufFilePost * call s:UseConfigFiles()
autocmd VimEnter,BufNew * call s:UseConfigFiles()
endif
augroup END
endfunction
@ -285,21 +301,15 @@ command! EditorConfigReload call s:UseConfigFiles() " Reload EditorConfig files
" On startup, enable the autocommands
call s:EditorConfigEnable(1)
" Always set the filetype for .editorconfig files
augroup editorconfig_dosini
autocmd!
autocmd BufNewFile,BufRead .editorconfig set filetype=dosini
augroup END
" }}}1
" UseConfigFiles function for different modes {{{1
function! s:UseConfigFiles_VimCore()
function! s:UseConfigFiles_VimCore(target)
" Use the vimscript EditorConfig core
try
let l:config = editorconfig_core#handler#get_configurations(
\ { 'target': expand('%:p') } )
\ { 'target': a:target } )
call s:ApplyConfig(l:config)
return 0 " success
catch
@ -307,17 +317,17 @@ function! s:UseConfigFiles_VimCore()
endtry
endfunction
function! s:UseConfigFiles_ExternalCommand()
function! s:UseConfigFiles_ExternalCommand(target)
" Use external EditorConfig core (e.g., the C core)
call s:DisableShellSlash()
let l:exec_path = shellescape(s:editorconfig_exec_path)
call s:ResetShellSlash()
call s:SpawnExternalParser(l:exec_path)
call s:SpawnExternalParser(l:exec_path, a:target)
endfunction
function! s:SpawnExternalParser(cmd) " {{{2
function! s:SpawnExternalParser(cmd, target) " {{{2
" Spawn external EditorConfig. Used by s:UseConfigFiles_ExternalCommand()
let l:cmd = a:cmd
@ -329,7 +339,7 @@ function! s:SpawnExternalParser(cmd) " {{{2
let l:config = {}
call s:DisableShellSlash()
let l:cmd = l:cmd . ' ' . shellescape(expand('%:p'))
let l:cmd = l:cmd . ' ' . shellescape(a:target)
call s:ResetShellSlash()
let l:parsing_result = split(system(l:cmd), '\v[\r\n]+')
@ -375,11 +385,6 @@ endfunction " }}}2
" }}}1
function! s:ApplyConfig(config) abort " Set the buffer options {{{1
" Only process normal buffers (do not treat help files as '.txt' files)
if index(['', 'acwrite'], &buftype) == -1
return
endif
if g:EditorConfig_verbose
echo 'Options: ' . string(a:config)
endif
@ -502,6 +507,15 @@ function! s:ApplyConfig(config) abort " Set the buffer options {{{1
endfor
call matchadd('ColorColumn',
\ '\%' . (l:max_line_length + 1) . 'v.', 100)
elseif g:EditorConfig_max_line_indicator == 'fillexceeding'
let &l:colorcolumn = ''
for l:match in getmatches()
if get(l:match, 'group', '') == 'ColorColumn'
call matchdelete(get(l:match, 'id'))
endif
endfor
call matchadd('ColorColumn',
\ '\%'. (l:max_line_length + 1) . 'v.\+', -1)
endif
endif
endif

View File

@ -32,3 +32,10 @@ if(WIN32 AND (NOT "$ENV{RUN_UTF8}"))
set(CTEST_CUSTOM_TESTS_IGNORE ${CTEST_CUSTOM_TESTS_IGNORE} g_utf_8_char)
set(CTEST_CUSTOM_TESTS_IGNORE ${CTEST_CUSTOM_TESTS_IGNORE} utf_8_char)
endif()
# Skip min_supported_value_length on Windows since that test seems to
# cause Appveyor to hang.
if(WIN32)
message(WARNING "Skipping min_supported_value_length test on this platform")
set(CTEST_CUSTOM_TESTS_IGNORE ${CTEST_CUSTOM_TESTS_IGNORE} min_supported_value_length)
endif()