Matt Wozniski wrote:
>> On Sat, Sep 19, 2009 at 6:10 PM, Tim Chase <[email protected]> wrote:
>>>   map <leader>e :e <c-r>=escape(expand("%:p:h"), " ")."/"<cr>
>>>                                                   ^
>>> to instruct Vim to escape spaces.  This should change
>>>
>>>> ":e /home/xx/backup_Fri Sep 18 19:32:14 CST 2009/test/"
>>> into
>>>
>>>   :e /home/xx/backup_Fri\ Sep\ 18\ 19:32:14\ CST\ 2009/test/
>>>
> 
> Isn't fnameescape() a better function to use here?  It will escape the
> spaces, as well as a handful of other troublesome characters....

Good point...I don't use fnameescape() often enough to remember 
it -- my brain starts with "I need to escape something...hey, 
there's an escape() function that does what I need" and I just 
use that.  I also don't remember when it was added...I cut my 
teeth on a late version of 5.x which I don't remember having 
fnameescape() when I first learned vim.

So yes, Ryan, fnameescape(expand("%:p:h")) is a better choice :)

-tim



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to