In my previous question, I passed an argument into a Vimscript function and concatenated it into the command line. This works great, but when you pass a string that contains the #
character, it balks with an error about the following:
E499: Empty file name for '%' or '#', only works with `:p:h`: read!<shellcmd>
The vimscript function looks like this:
function! GetJobLines(a:argA)
" 1. Create a new buffer for the output
enew
" 2. Change directory to location of said script
cd /home/leeand00/src
execute "read!echo" shellescape(a:argA)
functionend
Running the command itself looks like this:
:call GetJobLines("C#")
Myself I thought that including shellescape()
would have taken care of this, however this is not the case. I also tried adding \#
to escape the #
character, but that does not work either...
When I run the same command from the command line directly it does not cause an issue, and clearly this is a problem to be corrected in vimscript, I just don't know how.