I want to be able to compile and run C++ files directly from inside vim. I have a custom compilation alias gmm
defined in ~/.bash_aliases
. I do not want to copy it over to my ~/.vim/ftplugin/cpp.vim
file as it is quite a big command (several warning flags and stuff).
If I use the following I get an error:
nnoremap <F4> :w<CR>:vs \| te gmm % && ./a.out < in<CR>i
inoremap <F4> <esc>:w<CR>:vs \| te gmm % && ./a.out < in<CR>i
since vim cannot find the gmm
alias. Is there any way to make the alias available to the cpp.vim
file?
:term bash -ilc gmm
$BASH_ENV
variable, e.glet $BASH_ENV = "$HOME/.bash_aliases"
:h 'makeprg'
to do it the right way :)gmm
a custom bash script, added it to path, and setupmakeprg
and now it works perfectly!