mirror of
https://github.com/inkarkat/vim-ingo-library.git
synced 2025-12-22 12:13:58 +01:00
122 lines
7.2 KiB
Plaintext
122 lines
7.2 KiB
Plaintext
" vim: set ft=vim foldcolumn=0 :
|
||
if exists("g:loaded_test")
|
||
finish
|
||
endif
|
||
let g:loaded_test = 1
|
||
echomsg "this is testnew.vim"
|
||
|
||
setl foldcolumn=0
|
||
map <silent> ,x :call EchoWithoutScrolling#Echo(getline(line('.')))<CR>
|
||
map <silent> ,x :call EchoWithoutScrolling#Echo(EchoWithoutScrolling#TranslateLineBreaks(getline(line('.'))))<CR>
|
||
map <silent> ,z :call EchoLine#EchoLinePart( line('.'), col('.'),0,EchoWithoutScrolling#MaxLength(), [] )<CR>
|
||
map <silent> ,Z :call EchoLine#EchoLine( line('.'), col('.'),'prefix:', [] )<CR>
|
||
map <silent> ,c :call EchoLine#EchoLinePart( line('.'), col('.'),0,6, [] )<CR>
|
||
call EchoWithoutScrolling#Echo(getline(line(".")))
|
||
set noshowcmd
|
||
|
||
|
||
function! s:IndentConsistencyCop( startLineNum, endLineNum, isBufferSettingsCheck ) " {{{1
|
||
"*******************************************************************************
|
||
"* PURPOSE:
|
||
" Triggers the indent consistency check and presents the results to the user.
|
||
"* ASSUMPTIONS / PRECONDITIONS:
|
||
" ? List of any external variable, control, or other element whose state affects this procedure.
|
||
"* EFFECTS / POSTCONDITIONS:
|
||
" ? List of the procedure's effect on each external variable, control, or other element.
|
||
"* INPUTS:
|
||
" a:startLineNum, a:endLineNum: range in the current buffer that is to be
|
||
" checked.
|
||
" a:isBufferSettingsCheck: flag whether consistency with the buffer
|
||
" settings should also be checked.
|
||
"* RETURN VALUES:
|
||
" none
|
||
"*******************************************************************************
|
||
let l:isEntireBuffer = s:IsEntireBuffer(a:startLineNum, a:endLineNum)
|
||
let l:lineCnt = a:endLineNum - a:startLineNum + 1
|
||
|
||
call s:EchoStartupMessage( l:lineCnt, l:isEntireBuffer )
|
||
|
||
let s:occurrences = {}
|
||
let s:ratings = {}
|
||
let l:isConsistent = s:CheckBufferConsistency( a:startLineNum, a:endLineNum )
|
||
call s:ReportConsistencyResult( l:isEntireBuffer, l:isConsistent, '' )
|
||
call s:ReportBufferSettingsConsistency('')
|
||
|
||
if l:isConsistent == -1
|
||
call s:ClearHighlighting()
|
||
call s:UnindentedBufferConsistencyCop( l:isEntireBuffer, a:isBufferSettingsCheck )
|
||
call s:ReportConsistencyWithBufferSettingsResult( l:isEntireBuffer, 1 )
|
||
elseif l:isConsistent == 0
|
||
if a:isBufferSettingsCheck
|
||
let l:isBufferConsistentWithBufferSettings = s:IsBufferConsistentWithBufferSettings( a:startLineNum, a:endLineNum )
|
||
call s:ReportConsistencyWithBufferSettingsResult( l:isEntireBuffer, l:isBufferConsistentWithBufferSettings )
|
||
if l:isBufferConsistentWithBufferSettings
|
||
call s:ClearHighlighting()
|
||
|
||
let l:consistentIndentSetting = s:GetIndentSettingForBufferSettings()
|
||
call s:ReportConsistencyResult( l:isEntireBuffer, l:isConsistent, l:consistentIndentSetting ) " Update report, now that the verdict has been turned around and we have the consistent indent setting.
|
||
call s:IndentBufferConsistencyCop( a:startLineNum, a:endLineNum, l:consistentIndentSetting, 0 ) " Pass isBufferSettingsCheck = 0 here (though a:isBufferSettingsCheck == 1) because we've already ensured that the buffer is consistent with the buffer settings.
|
||
else
|
||
let l:inconsistentIndentationMessage = 'Found ' . ( s:IsEnoughIndentForSolidAssessment() ? '' : 'potentially ')
|
||
let l:inconsistentIndentationMessage .= 'inconsistent indentation in this ' . s:GetScopeUserString(l:isEntireBuffer) . '; generated from these conflicting settings: '
|
||
let l:inconsistentIndentationMessage .= s:RatingsToUserString( l:lineCnt )
|
||
let l:inconsistentIndentationMessage .= s:GetInsufficientIndentUserMessage() " problems ahead
|
||
call s:IndentBufferInconsistencyCop( a:startLineNum, a:endLineNum, l:inconsistentIndentationMessage )
|
||
endif
|
||
endif
|
||
elseif l:isConsistent == 1
|
||
call s:ClearHighlighting()
|
||
|
||
call s:ReportConsistencyResult( l:isEntireBuffer, l:isConsistent, s:perfectIndentSetting ) " Update report, now that we have the consistent (perfect) indent setting.
|
||
call s:IndentBufferConsistencyCop( a:startLineNum, a:endLineNum, s:perfectIndentSetting, a:isBufferSettingsCheck )
|
||
else
|
||
throw 'assert false'
|
||
endif
|
||
"****D echo 'Consistent ? ' . l:isConsistent
|
||
"****D echo 'Occurrences: ' . string( s:occurrences )
|
||
"****D echo 'Nrm. Ratings: ' . string( s:ratings )
|
||
|
||
" Cleanup remaining dictionaries with script-scope to free memory.
|
||
let s:occurrences = {}
|
||
let s:ratings = {}
|
||
endfunction
|
||
|
||
" }}}1
|
||
Ich würde alles Übermäßig im Gebärmutterüberdruß á la §282 sehen.
|
||
日本abc語
|
||
ab日本cdef
|
||
call s:IndentBufferConsistencyCop( a:startLineNum, a:endLineNum, l:consistentIndentSetting, 0 ) " Pass isBufferSettingsCheck = 0 here (though a:isBufferSettingsCheck == 1) because we've already ensured that the buffer is consistent with the buffer settings.
|
||
calls:IndentBufferConsistencyCop(a:startLineNum,a:endLineNum,l:consistentIndentSetting,0)"PassisBufferSettingsCheck=0here(thougha:isBufferSettingsCheck==1)becausewe'vealreadyensuredthatthebufferisconsistentwiththebuffersettings.
|
||
echomsg "this is testnew.vim" a very long line because of this additional stuff that serves no other purpose than to 日lengthen this line so that it'll definitely be too long to display.
|
||
echomsg "this is 日本語 testnew インゴ Hello, world!.vim" a very long line because of this additional stuff that serves no other purpose than to 日lengthen this line so that it'll definitely be too long to display.
|
||
echo msg "this is 日本語 testnew インゴ Hello, world!.vim" a very long line because of this additional stuff that serves no other purpose than to 日lengthen this line so that it'll definitely be too long to display.
|
||
echo msg "this is 日本語 testnew インゴ Hello, world!.vim" a very long line echo msg "this is 日本語 testnew インゴ Hello, world!.vim" a very long line
|
||
日本語 日本語 日本語 日本語 日本語 日本語 インゴ Hello, world! foobar
|
||
|
||
invisible foo
|
||
bar is not seen
|
||
hehe is the only clue
|
||
invisible foo |