I'd like to set some file-type dependent mappings to quickly run files. For example, I have some mappings like these:
nnoremap <silent><leader>z :w<CR> :!clear; gcc %; ./a.out<cr>
nnoremap <silent><leader>z :w<CR> :!clear; g++ %; ./a.out<cr>
nnoremap <silent><leader>z :w<CR> :!clear; ruby %<cr>
How can I set each mapping to its corresponding file type?