I\'m trying to find the name of the file I\'m editing inside of Vim. So I can use it to map F5 to compile this file. Would of course be great if I could recognize
As others have already mentioned, %
is expanded to the current file. If you want to get that string in vim script, use expand("%")
.
But you may want to simply set makeprg to something like "compiler-command\ %"
and run :make
- you gain quick-fix support that way. (open errors/warnings window with :copen
)