Tuesday, February 1, 2011

Re: string type in vim script language

On Feb 1, 2011, at 7:15 AM, Ben Schmidt wrote:

>> However, I get the following
>>
>> Error detected while processing function SwitchSourceHeader:
>> line 5:
>> E492 Not an editor command: filename = expand(%:t:r)
>>
>> I am wondering if anyone can point out a correct way for doing this.
>
> In vimscript, 'let' isn't just used to declare variables the first time
> they are used, it is used any time you want to change a variable value.
> So you need
>
> let filename = expand(%:t:r)
> let filename = filename + ".cpp"

If you want to append the extension, the last one should be

let filename = filename . '.cpp'

Israel

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment