Last active
August 29, 2015 13:57
-
-
Save jmervine/9534018 to your computer and use it in GitHub Desktop.
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
" :MakeTestFile | |
" run make test/unit on file | |
" | |
" mapping: | |
" nnoremap <silent> <leader>tt :MakeTest % | |
" | |
command! -nargs=+ MakeTest call s:MakeTestFile(<q-args>) | |
function! s:MakeTestFile(current_file) | |
echo a:current_file | |
let test_file_path = substitute(expand(a:current_file), "yp", "test/unit", "") | |
execute '! make '. test_file_path | |
1 | |
endfunction |
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
" :Shell <cmd> | |
" put shell command in new buffer. | |
command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand(<q-args>) | |
function! s:RunShellCommand(cmdline) | |
echo a:cmdline | |
let expanded_cmdline = a:cmdline | |
for part in split(a:cmdline, ' ') | |
if part[0] =~ '\v[%#<]' | |
let expanded_part = fnameescape(expand(part)) | |
let expanded_cmdline = substitute(expanded_cmdline, part, expanded_part, '') | |
endif | |
endfor | |
botright new | |
setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap | |
call setline(1, 'You entered: ' . a:cmdline) | |
call setline(2, 'Expanded Form: ' .expanded_cmdline) | |
call setline(3,substitute(getline(2),'.','=','g')) | |
execute '$read !'. expanded_cmdline | |
setlocal nomodifiable | |
1 | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment