Converts Turkish characters between TeX, HTML, ANSI and Turkish accent representations and back.
I wrote this plugin when I was working on my B.S. Thesis. It helped me much then, I hope it helps others too.
Home page: https://github.com/caglartoklu/tex_turkce.vim
Vim.org page: http://www.vim.org/scripts/script.php?script_id=3029
- 2019-03-14
- Added
TexTurkceReplaceOneChar
command.
- Added
- 2013-10-31
- Added
TrToAnsi
command. This command will convert Turkish characters with accents to similar ones in ANSI. This has no from function since the change is irreversible unless undoed. - Added warnings if
TrTo
orTrFrom
does not find a suitable converter function.
- Added
- 2013-10-30
- Added generic
TrTo
andTrFrom
commands which calls the appropriate conversion function according to the file type.
- Added generic
- 2013-10-06
- Conversion in selection instead of whole file.
- If no selection is provided, whole file is used.
- Commands renamed as
TrToTex
andTrFromTex
- The script is now a
plugin
instead offtplugin
, since it will not be limited with.tex
files in the future. - Hosted the code on Github, all the development will be on Github from now on.
- vim.org will be updated if a major change happens.
- The license has been changed from GPL to 2-clause FreeBSD.
- The file is saved in UNIX file format instead of Windows.
- 0.0.1, 2010-03-27
- First version.
For Vundle users:
Bundle 'caglartoklu/tex_turkce.vim'
For Pathogen users:
cd ~/.vim/bundle
git clone git://github.com/caglartoklu/tex_turkce.vim
For all other users, simply drop the tex_turkce.vim
file to your
plugin
directory.
- Vim (no
+Python
required)
Select a text, and execute the commands.
Please note that if no text is choosen,
whole file content is processed.
When a command is executed, the characters will be replaced.
If things get messed up somehow, simply press u
for undo in
insert node.
In the following screenshot, lines 6,7,8 is replaced using the
command :TrToTex
and the result can be seen in lines 15,16,17.
:TrFromTex
would do the reverse.
Whe natively typed Turkish characters are encoded using :TrToHtml
command,
this is what is seen on the web page when no any encoding applied:
:TrToTex
Converts Turkish characters to their .tex
representation.
ç => \c{c}
Ç => \c{C}
ı => {\\i}
İ => \.I
ğ => \u{g}
Ğ => \u{G}
ö => \"o
Ö => \"O
ş => \c{s}
Ş => \c{S}
ü => \"u
Ü => \"U
:TrFromTex
Converts .tex
character representation of characters to Turkish.
\c{c} => ç
\c{C} => Ç
{\\i} => ı
\.I => İ
\u{g} => ğ
\u{G} => Ğ
\"o => ö
\"O => Ö
\c{s} => ş
\c{S} => Ş
\"u => ü
\"U => Ü
:TrToHTML
Converts Turkish characters to their .html
representation.
ç => ç
Ç => Ç
ı => ı
İ => İ
ğ => ğ
Ğ => Ğ
ö => ö
Ö => Ö
ş => ş
Ş => Ş
ü => ü
Ü => Ü
:TrFromHtml
Converts .html
character representation of characters to Turkish.
ç => ç
ç => ç
Ç => Ç
Ç => Ç
ı => ı
İ => İ
ğ => ğ
Ğ => Ğ
ö => ö
ö => ö
Ö => Ö
Ö => Ö
ş => ş
Ş => Ş
ü => ü
ü => ü
Ü => Ü
Ü => Ü
:TrToAnsi
This command will convert Turkish characters with accents to similar ones in ANSI.
ç => c
Ç => C
ı => i
ý => i
İ => I
Ý => I
ğ => g
ð => g
Ğ => G
Ð => G
ö => o
Ö => O
ş => s
þ => s
Ş => S
Þ => S
ü => u
Ü => U
:TexTurkceReplaceOneChar
In normal mode, if the character is one of the ANSI characters below, it converts a single character to its Turkish accent counterpart. For all the other characters, it has no effect. This command allows Turkish accent output when your keyboard does not support Turkish character set.
g => ğ
u => ü
s => ş
i => ı
o => ö
c => ç
You can use the following block for configuration:
" { Plugin 'caglartoklu/tex_turkce.vim'
let g:text_turkce_advance_to_next_character = 1
" nmap <leader>tr : TexTurkceReplaceOneChar<CR>
nmap tr : TexTurkceReplaceOneChar<CR>
" }
- https://en.wikipedia.org/wiki/Html
- http://webdesign.about.com/od/localization/l/blhtmlcodes-tr.htm
- http://character-code.com/turkish-html-codes.php
This plugin uses :help substitute command of Vim.
Used flags are:
`g` : all occurences in the line.
`I` : do not ignore case for the pattern.
`e` : When the search pattern fails, do not issue an error message
For reference, see :help s_flags
Licensed with 2-clause license ("Simplified BSD License" or "FreeBSD License"). See the LICENSE file.