On 09/09/2013 12:47, ZyX wrote:
I had tried calls to escape(..., '\') and that made no difference.
Changing the test
if l:d !~ "^\V" . s:dir1
makes no difference.
It makes difference with some specific directory names. “Specific” includes
dots in directory name.
My bad again. On Windows fnamemodify(..., ':p') appears to normalise
the given path to remove things like .. and . whereas on unix it
doesn't. I was hoping to rely on normalisation being done for me.
If I substitute all back slashes for forward slashes then it works as I
expect. So basically I tripped and fallen into backslash hell, again.
b) you do not need regular expressions at all, use l:d[:len(s:dir1)-1] is#
s:dir1 (use is? for windows).
Which does work (toss up between using is# and ==# in this case) -
thanks :-)
“A is# b” is like “type(A) == type(b) && A ==# b”. I just use it always for string
comparison because I constantly use zero as a substitution for python None (e.g. as a default
value) and “"abc" == 0” is true because if one of the “==” operands is a number another
operand is also coerced to a number. Using “#” and “?” is a good habit because it is bad idea to
rely on user settings.
Note that I use is# here not because I expect number as one of the operands
*here*. I use it because it is string comparison and in some *other* string
comparisons I write numbers are expected.
Thanks for the explanation - this is my first deep dive in VIML to do
something more than solve an immediate issue. Reading around some of
the larger plugins and some blogs I get the interesting aroma of python
and javascript idioms being used, so I expect more confusion as I move
on until things start to sink in deep.
Mike
--
Old enough to know better, but young enough to not care.
--
--
You received this message from the "vim_dev" 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
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.