Get current file path in VIM
You can get file path in vim with % (percent) symbol. Sometimes you need to run a command with the current file path, for example
git add filepath or
You can add the current file to git with this command in vim:
:!git add %
or you can run any file with this command:
For example, you write a bash script and saved it. But you don't want to close vim or you don't want to go to another terminal screen. Just you need to write
:!%:p and vim run the file for you.