最近、このようなコメントの書き方をよく見かけるようになりました。
:if exists('loaded_undobranch_viewer')
:finish
:endif
:let loaded_undobranch_viewer = 1
:command! -nargs=0 UndoBranchViewer :call s:UndoBranchViewer()
:function! s:UndoBranchViewer()
:let g:undolistHandlers = [
\ {'key': 16, 'agent': s:SNR().'AgentUndoPreview', 'key_name': '<c-p>', 'help': 'Undo preview'},
\ {'pick_last_item': 0},
\ ]
:let s:undolists = tlib#cmd#OutputAsList('undolist')
:call tlib#input#List('s', 'UndoBranch', s:undolists, g:undolistHandlers)
:endfunction
:function! s:AgentUndoPreview(world, selected)
:return a:world
:endfunction
:function! s:SNR()
:return matchstr(expand('<sfile>'), '<SNR>\d\+_\zeSNR$')
:endfunction
finish
==============================================================
スクリプトのコメントとか、
履歴とか記述。
「finish」と書いて、そこでスクリプトの読み込みを停止、その後ろにコメントを書くらしい。 コメントアウトする手間もかからず、ハイライトも有効と。 流行ってるの?



