On Thu, 10 Mar 2011, Ben Schmidt wrote:
On 10/03/11 9:50 PM, Fernando Basso wrote:
I was doing f<Space> and I noticed that vim did not jump to one
specific 'space' (of course, that was not a space).
'ga' then showed< > 160, Hex 00a0, Octal 240 between 'gtpl' and
':call' in the first line of that code. The same thing between
'silent' and '! echo'.
I replaced those with a 'real' white space and it is working
wonderfully well now.
Just one more thing because it seems very intriguing to me: did you
copy/paste the code to your vimrc or typed it in? I copied mine from
firefox and pasted with "+p. Then visually selected it and did =.
I copied and pasted it from your email using Thunderbird. It looks
like the non-breaking spaces are still in your email source as I
received it, so I guess Thunderbird's viewer or editor must've
substituted it for a normal space at some stage.
It's annoying that it should get copied from Firefox at all, though. I
wonder if that's a problem we can address on the Wiki, as it's going
to cause a lot of users really confusing problems if when they
copy+paste code it has a bunch of invisible things causing errors!
After this kept happening with SQL a coworker sending me (I think GNOME
Terminal was the culprit), I added the following in
~/.vim/after/ftplugin/sql.vim:
hi def link WhiteSpaceError Error
match WhiteSpaceError /[\u00a0]/
Expanding it to cover a much larger set of weird Unicode whitespace
chars (double-width space, other-language spaces, en/em/2,3,4-etc.
spaces):
match WhiteSpaceError
/[\x0b\x0c\u00a0\u1680\u180e\u2000-\u200a\u2028\u202f\u205f\u3000]/
Also adding Zero-Width No-Breaking space (a.k.a. BOM) (might not want
to add this if you use any variant of UTF-16 on a regular basis):
match WhiteSpaceError
/[\x0b\x0c\u00a0\u1680\u180e\u2000-\u200a\u2028\u202f\u205f\u3000\ufeff]/
--
Best,
Ben H
--
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