Thursday, June 29, 2023

Re: How can I refactor with regex, the right single quotation mark with an apostrophe

On Thu, Jun 29, 2023 at 9:05 AM K otgc <konthegoldcoast@gmail.com> wrote:
>
> Hello Vim forum,
> I hope this is the correct vim forum firstly?
>
> So my keyboard Belkin (Ergonomic Smart Keyboard) F8E208-BLK(K B23-BLK) has an apostrophe key, but not a right single quotation mark.
>
> However my Google Contacts has duplicate data and version1 has the approved apostrophe, but version2 has the unapproved right single quotation mark.
>
> How can I run a regex to refactor this in vimdiff?
> Something like Terminal > vimdiff > right window > :s/<findRightSingleQuotationMark>/' > Enter.
> The problem is I cannot type the right single quotation mark with the keyboard? Perhaps I can somehow enter the regex with ISO 8859-1 Unicode U+2019?
>
> Thanks for any help, as manually typing r' could be a lot of repeat.

If your 'encoding' setting is utf-8 (usually set somewhere early in
your vimrc if your system doesn't default to it) you can type any
character in Vim if you know its codepoint number, see ":help
i_CTRL-V_digit". You should NOT change 'encoding' after Vim has
finished starting up; for some other values of 'encoding' there exist
characters which Vim cannot represent in memory.

For instance, to enter the codepoint U+2019 when in Insert or
Command-line mode, type Ctrl-V followed by u followed by 2019

To replace all right single quotation marks by apostrophes in the
current editfile, you would then type
:%s/'/'/g
where the "replace from" character ' is obtained by Ctrl-V followed by
u2019 and the "replace by" character ' is the apostrophe.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJkCKXuyehHycazd-8r21i%3DidAgDmp-aczpCdy%3DnW9t%2B-P_iQw%40mail.gmail.com.

No comments: