On 22/03/09 13:16, Matt Wozniski wrote:
>
> On Sat, Mar 21, 2009 at 3:58 PM, Tony Mechelynck wrote:
>>
>> On 21/03/09 00:39, Andreas Klein wrote:
>>> Here is a hexdump of a file I creatad with vim -u NONE on my system:
>>>
>>> 0000000: 2626 c2a0 0a3d 3d20 0a3c 3c20 0a&&...== .<<    .
>>>
>>> You see, strange characters get inserted when I type "&&".
>>>
>>> I found this behaviour both in MacVim and the vim I compiled out of
>>> MacPorts.
>>
>> C2 A0 is UTF-8 representation of U+00A0 NO-BREAK SPACE. Otherwise 0x20
>> is space and 0x0A is linefeed, both of which are rather "normal" in a
>> text file. Does this ring a bell? I don't see anything in this dump that
>> could be understood as \194.
>
> Aha, I think I see what's going on here.
>
> Andreas: Do you need to hold alt (or option) to type characters like&
> and<  with the keyboard layout you've chosen?  If so, my guess is that
> what's going wrong is that you're holding alt too long, and typing
> alt+space after finishing the&  or<  which causes OS X to insert a
> nonbreaking space instead of a normal space.  Why they would ever
> include a 2-key combination to insert a character that most people
> will never ever want to type, I have no idea... And I'm also not savvy
> enough with OS X to know if you can turn off that behavior, but it
> would explain why you only see the behavior 'sometimes' - because
> you're actually typing a different character sometimes.
>
> ~Matt

Hm, one way to disable it (only in Vim, of course) would be

        :map!  <Char-0xA0>  <Space>

which would replace any no-break space typed in Insert/Replace or 
Command-line modes by a plain space. If you _do_ want to intentionally 
enter no-break spaces sometimes, you'll need an additional mapping for 
it, for example

        :noremap!  <S-F12>  <Char-0xA0>

With these two mappings, either Space or Option-Space (or whatever 
normally produces a no-break space) is just plain space, and Shift-F12 
(safely out of the way, and something that you probably won't hit by 
mistake) is no-break space.


Best regards,
Tony.
-- 
"I've been teaching myself to play the piano for about 5 years and now write
most of my songs on it, mainly because I can never find any paper."
                Jeff Lynne, ELO's greatest hits

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

Reply via email to