开发者

how to replace 'LEFT-TO-RIGHT MARK' (U+200E) - <200e> with vim

Thats is开发者_如何学Go how this special character is displayed in vim:

how to replace 'LEFT-TO-RIGHT MARK' (U+200E) - <200e> with vim

Ive tryed with /\x20(\x0e|\x0f)/ and /\xe2\x80[\x8e\x8f]/ without results.


First, if you want to replace byte 0x20 (it is space, if I am not mistaking), you need to use \%x20, not \x20 because \x designates a hex digit (unless used inside a collection, there \x20 means what expected). But if you want to replace given unicode character, you should use \%u200E (\u200E inside a collection).

Second, both \%x20 and [\x20] will match character with unicode code 0x20, not byte with code 0x20. It does not matter for the space, but makes difference for code points >0x7F.


Try to replace \u200e :)

You can test this works by inserting that character into your buffer, and seeing that it appears as <200e>, if you type this in while in insert mode: <C-R>="\u200e"<CR> (that's CTRL+R and <CR> means ENTER)


I would put the cursor on the blue <200e>, then type yl to yank (copy) the character.

Then, type :%s/<C-R>"/replacement/g

(where <C-R> is Control+R, of course).


Use your terminal's mechanism for entering characters by Unicode codepoint. In the case of gnome-terminal, that's CtrlShiftU followed by the hex code (e.g. 200e) and then Enter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜