On 14/11/11 15:41, H. İbrahim Güngör wrote:
On 12 Aralık 2010 Pazar 22:56:29 Bram Moolenaar wrote:
Fatih Arslan wrote:
On Sat, Dec 11, 2010 at 01:51:52PM +0100, Bram Moolenaar wrote:
Most likely the C function tolower() doesn't work on the 'I'. Try this:
:lang ctype C
That's works fine, thanks. But is there any way to fix it without
setting the ctype to C ? I mean without changing the locale ?
I guess to solve it we should fix the tolower() function. Am I right ?
It's difficult to solve this without slowing down for everybody not
using a Turkish locale.
Is there a problem with setting ctype to C?
I'm flaming this thread up, sorry :)
Yep, setting the ctype to C is not acceptable for Turkish language since we
have an exception in our alphabet that the uppercase of "i" is not "I", it's
"İ". And the lowercase of "I" is not "i", it's "ı".
If any programmer uses glibc provided tolower/toupper/strcmp/strncmp, it will
fail to convert, for example "join", "bits" etc.
"join" (toupper) "JOİN"
"bits" (toupper") "BİTS"
"JOIN" (tolower) "joın"
"BITS" (tolower) "bıts"
There are locale awareless string functions in glib mostly for this kind of
situations (g_ascii_tolower...).
Maybe we should use vim_tolower/vim_toupper functions for reserved word
conversions just to convert in C locale.
Vim has an option which allows you to use Turkish or non-Turkish case
mapping at any given time, and to easily switch from using one from
using the other.
See :help 'casemap'
You could for instance map:
if has('multi_byte')
map <F8> :set casemap=<CR> " use the locale
imap <F8> <C-O>:set casemap=<CR>
map <S-F8> :set casemap&<CR> " use ASCII defaults
imap <S-F8> <C-O> :set casemap&<CR> " internal,keepascii
endif
An alternative possibility would be to keep 'casemap' empty (i.e. "use
the locale's settings") and change Vim's internal locale (the following
[untested] assumes that you've set 'encoding' to UTF-8):
if has('multi_byte')
set casemap=
if has('unix')
map <F8> :lang ctype tr_TR.UTF-8<CR>
imap <F8> <C-O>:lang ctype tr_TR.UTF-8<CR>
map <S-F8> :lang ctype C<CR>
imap <S-F8> <C-O>:lang ctype C<CR>
else " not Unix: assume Windows
map <F8> :lang ctype Turkish_Turkey.10646<CR>
imap <F8> <C-O>:lang ctype Turkish_Turkey.10646<CR>
map <S-F8> :lang ctype en<CR>
imap <S-F8> <C-O>:lang ctype en<CR>
endif
endif
Best regards,
Tony.
--
To those accustomed to the precise, structured methods of conventional
system development, exploratory development techniques may seem messy,
inelegant, and unsatisfying. But it's a question of congruence:
precision and flexibility may be just as disfunctional in novel,
uncertain situations as sloppiness and vacillation are in familiar,
well-defined ones. Those who admire the massive, rigid bone structures
of dinosaurs should remember that jellyfish still enjoy their very
secure ecological niche.
-- Beau Sheil, "Power Tools for Programmers"
--
You received this message from the "vim_dev" 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