In Vim, I can echo the current filename using this command:
:echo @%
I found that information here: http://vim.wikia.com/wiki/Get_the_name_of_the_current_file
Can someone explain why the @ symbol is necessary? If I enter the command without the @ symbol, I get an error:
E15: Invalid expression: %
E15: Invalid expression: %
However, if I try to send the filename to a bang command as an argument, including the @ sign appears as a regular character in the argument. Removing the @ sign works. In other words, in my .bash_profile I have the following function:
test_func() {
echo $1
}
In Vim, I run:
:! test_func @% #outputs @path/to/my/file
:! test_func % #outputs path/to/my/file
What is the @ symbol doing and why does it behave differently when sending the output to a bash function?
Ctrl+Gbut want something else.