Tuesday, November 8, 2016

Re: What is the blank char in my file?

On Tue, Nov 8, 2016 at 1:22 PM, A. S. Budden <abudden@gmail.com> wrote:
>> On 1 November 2016 at 17:00, 李哲 <imlegendlzz@gmail.com> wrote:
>>> As the pic say~
>>>
>>> I find a blank char in my file but I can't match it by \s+, I want to delete it, what should I do?
> On 8 November 2016 at 10:01, Yongwei Wu <wuyongwei@gmail.com> wrote:
>> Put the cursor over the character and type "g8".
>>
>> :help g8
>>
>> 8 Print the hex values of the bytes used in the
>> character under the cursor, assuming it is in |UTF-8|
>> encoding. This also shows composing characters. The
>> value of 'maxcombine' doesn't matter.
>> Example of a character with two composing characters:
>> e0 b8 81 + e0 b8 b9 + e0 b9 89 ~
>> {not in Vi} {only when compiled with the |+multi_byte|
>> feature}
>
> The above is probably the best way to find out what it is; if you want
> to delete all instances of it, one way that has worked for me in the
> past is:
>
> * Put the cursor on the character
> * Press y<space> to "yank" it into the unnamed register
> * Type :%s/<C-R>"//g (where <C-R>" means press Ctrl & R together and
> then press shift-2 or whatever combination on your keyboard gives a
> double-quote) - this pulls the unnamed register content into the
> command line
>
> You can also use the output of g8 with:
>
> %s/\%uXXXX//g (where XXXX is the hex code shown by g8) - see :help \%u
> for more info
>
> Al

For %u you need the Unicode codepoint (the hex part of the output of
ga) not the individual byte values (as shown by g8). They are
different for every codepoint above U+007F, and if it were ASCII (i.e.
lower than U+0080) the OP wouldn't asking "What is that strange blank
character?"

Best regards,
Tony.

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: