Exercism पर अपने Vim script अभ्यासों को टेस्ट करना सीखिए।
यह ट्रैक टेस्ट सूट चलाने और अच्छे तरीकों का पालन सुनिश्चित करने के लिए दो टूल इस्तेमाल करता है:
$ vim exercise.vim
:source %
:Vader exercise.vader
पाथ अलग-अलग हो सकते हैं।
अगर आप ऊपर बताए गए चरणों के लिए कोई आसान शॉर्टकट चाहते हैं, तो इसे अपनी vimrc में रख दीजिए:
function! s:exercism_tests()
if expand('%:e') == 'vim'
let testfile = printf('%s/%s.vader', expand('%:p:h'),
\ tr(expand('%:p:h:t'), '-', '_'))
if !filereadable(testfile)
echoerr 'File does not exist: '. testfile
return
endif
source %
execute 'Vader' testfile
else
let sourcefile = printf('%s/%s.vim', expand('%:p:h'),
\ tr(expand('%:p:h:t'), '-', '_'))
if !filereadable(sourcefile)
echoerr 'File does not exist: '. sourcefile
return
endif
execute 'source' sourcefile
Vader
endif
endfunction
autocmd BufRead *.{vader,vim}
\ command! -buffer Test call s:exercism_tests()
इसके बाद किसी अभ्यास की डायरेक्टरी से कोई भी .vim या .vader फाइल खोलिए और :Test कमांड चलाइए।
$ vint .
Vim script ट्रैक के बारे में और ज़्यादा जानकारी के लिए मदद पेज देखिए।