Tom Xue
Tom Xue

Reputation: 3365

How to indicate current open file in vimrc?

I want to call Astyle in my Gvim (under Windows) to format .c .h file. I put the Astyle.exe here below:

C:\Program Files (x86)\Vim\vim73

And it was added to the Path environment already.

And then I add below command in my _vimrc:

nmap <F10> :!Astyle --style=linux <CR>

But when I open a .c file and press F10, it gives some wrong message. I guess that is because Astyle does not know which file to operate. So my question is how to indicate Astyle the file to be operated?

nmap <F10> :!Astyle --style=linux some_indicator<CR>

Upvotes: 0

Views: 77

Answers (1)

Kent
Kent

Reputation: 195269

does this help?

:!Astyle --style=linux %:p<CR>

Upvotes: 2

Related Questions