Vim Shortcuts – Shortcut for Current File Name

keyboard shortcutsmacrovim

In vim, if I'm working on a Python script, I will commonly type:

:! python this_script.py

to execute the script. Is there a shortcut for the name of the current file? If not, can I easily make one? I'm new at vim, and I'm not sure how to google for this.

Best Answer

You can just use % for current file. This command should serve your purpose:

:! python %
Related Question