This is what I have in my .vimrc file

autocmd FileType python map <F7> :!python %<CR>
autocmd FileType sh map <F7> :!bash -c ./%<CR>

Noah

> Hi All.
>
> I would like to map a key such that it 'executes' the current file.  Is
> this a no brainer?
>
> For example, I have the following in my .vimrc file:
>
> "map <F12> :!php tester.php<CR>
> "map <F12> :!./tester.py<CR>
> map <F12> :!tester<CR>
>
> I have to change the mapping based on what type of app I am working on
> (PHP script, python script, binary from a C++ compilation, etc) and then
> make sure the app is called 'tester'.  There has to be a better way.
>
> What I would like is to be able to just hit F12 and have the file that I
> am currently editing be executed, and hot hardcode it to run 'tester'
> from the current directory.
>
> Steve
>
>


Reply via email to