Monday, June 18, 2012

Re: Some VAM bundles with '%' in their names causing problems

2012/6/18 Christian Brabandt <cblists@256bit.org>:
> Hi Pablo!
>
> On Mo, 18 Jun 2012, Pablo Giménez wrote:
>
>> Well I think the % symbol confuse some string evaluations.
>> I use a function like this:
>> function! SetLocalPath ()
>>     " Current basename for the buffer
>>     let baseName = expand("%:p:h")
>>     if isdirectory(baseName)
>>         exe 'lcd ' . baseName
>>     endif
>>
>> endfunction
>>
>> And I have it in an autocommand so it is executed everytime a new
>> buffer is opened.
>> Problem is that when a foler name contains the % symbols it fails.
>> The string expansion for the exe command is wrong.
>> However it works for the isdirectory statement.
>
> You shouldn't paste the directory directly to lcd, bug need to use
> fnameescape().
Thanks a lot, worked like a charm.
>
> See :h cmdline-special
>
> regards,
> Christian
> --
> Als ich geboren wurde, war ich noch sehr jung.
>                -- Heinz Erhardt
>
> --
> 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



--
Un saludo
Best Regards
Pablo Giménez

--
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: