title: Vim [compile and] run shortcut
body: <p>Basically what I want is a keyboard shortcut in vim that lets me [compile and] run the currently being edited C, C++ or Python program. In psuedocode:</p>
  
  <pre><code>when a shortcut key is pressed:
      if current_extension == 'c' then
          shell: gcc this_filename.c -o this_filename_without_extension
          if retcode == 0 then shell: ./this_filename_without_extension
      else if current_extension == 'cpp' then
          shell: g++ this_filename.cpp -o this_filename_without_extension
      if retcode == 0 then shell: ./this_filename_without_extension
      else if current_extension == 'py' then
          shell: python this_filename.py
      end if
  end key
  </code></pre>
  
  <p>I realise I might be asking a bit much but would love it if this was possible!</p>