Here's a (test) file that contains a sample of single characters from
the French alphabet.
Column 1 contains a <tab> character (0x09) and column 2 contains the
actual letters.
A
E
O
À
È
É
Ô
Œ
If I use the sort command provided on linux by the GNU coreutils package
so as to sort this file at the terminal with the following locale:
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
... without changing locales the resulting ouput appears to be
sorted the way it should be:
A
À
E
É
È
O
Ô
Œ
But when I edit the file in vim and run the :sort / / where the '//'
pattern contains a tab character (0x09) nothing happens.
In other words... the fancy pants letters (À, È, É, Ô, Œ ) stay where
they are instead of being moved to the spot where they belong.
So I tried launching vim like so:
$ LANG='fr_FR.UTF-8' vim
I noticed that vim was now talking French to me and when I ran the
':language' commmand I saw that vim's locale-related variables were now
set to the 'fr_FR' locale:
Langue courante pour :
"LC_CTYPE=fr_FR.UTF-8;
LC_NUMERIC=C;
LC_TIME=fr_FR.UTF-8;
LC_COLLATE=fr_FR.UTF-8;
LC_MONETARY=fr_FR.UTF-8;
LC_MESSAGES=fr_FR.UTF-8;
LC_PAPER=fr_FR.UTF-8;
LC_NAME=fr_FR.UTF-8;
LC_ADDRESS=fr_FR.UTF-8;
LC_TELEPHONE=fr_FR.UTF-8;
LC_MEASUREMENT=fr_FR.UTF-8;
LC_IDENTIFICATION=fr_FR.UTF-8"
But when I ran the same ':sort / /' command it didn't make any difference.
Am I doing it wrong?
Thanks,
CJ
P.S. I'm using a bit of vim trickery to translate the LaTeX '\index ...'
etc. stuff to html tags so as to have a basic index with links to
anchors in the HTML version of the document. Unfortunately the original
document happens to be in French... and naturally... correct sorting of
the 'TABLE ALPHABÉTIQUE' is crucial (I do want eggs/œufs to appear under
letter 'O'... not relegated to the index's last page).
I've read the ':h :sort' doc something like a dozen times and find parts
of it a little cryptic. Especially when somewhere near the end it says:
'Vim does do a "stable" sort.' :-) What's up with that?
--
--
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/20201027225540.GC5998%40turki.local.
No comments:
Post a Comment