How to convert non english text to uppercase in vim?

I have the following text:

偶贸艂膰 g臋艣l膮 ja藕艅

If I capitalize it in Vim (using gUU) under Windows (cp1250 encoding), I get:

偶贸艂膰 G臋艣L膮 JA藕艅

But I have to get:

呕脫艁膯 G臉艢L膭 JA殴艃

in accordance with the Polish alphabet.

Is there a way to override uppercase and lowercase letters in Vim?

+4
source share
2 answers

There is always brute force method:

%s#\%(偶\|贸\|艂\)#\={'偶':'呕','贸':'脫','艂':'艁'}[submatch(0)]#gcI 
0
source

You probably need to set your language correctly in Vim. Try adding this line to your vimrc

 lang ctype Polish_Poland.1250 
0
source

Source: https://habr.com/ru/post/1401428/


All Articles