Created
March 28, 2016 00:56
-
-
Save zhangchiqing/a7dd8ae1a1789aac5403 to your computer and use it in GitHub Desktop.
vim shortcut to bind <leader>d to run doctest for typescript file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nnoremap <leader>d :call <SID>RunDoctest()<cr> | |
function! s:RunDoctest() | |
if &filetype == "typescript" | |
cexpr system('tsc ' . expand('%:p') . '&& doctest --module commonjs ' . substitute(expand('%:p'), ".ts", ".js", "")) | |
endif | |
if &filetype == "javascript" | |
cexpr system('doctest --module commonjs ' . expand('%:p')) | |
endif | |
copen | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment