56854Re: passing local variable to shell howto
- Mar 1, 2005Shaw Vrana wrote:
> Hi All,With the above, both the script and the ":e" command will get
> I'm trying to write a simple vim function that prompts me for a filename and
> then calls an external shell script with the entered filename, and then loads
> the file. Here's what I have so far.
> fun! GetFile()
> let myfilename = input("Filename? )
> !my_script myfilename
> e myfilename
> This almost works, but it doesn't look like my_script is getting the value I
> entered for myfilename, though it is being assigned the value, and my_script
> is being called. I guess this is b/c I'm using the ! operator? How can I
> call my_script with the myfilename input?
> Any pointers or help pages greatly appreciated!
"myfilename" (i.e., the name, not the contents, of the Vim variable). Try
exe "!my_script" myfilename
exe "edit" myfilename
- << Previous post in topic Next post in topic >>