Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Converts Turkish characters to their Tex representation and back.
VimL
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
plugin
.gitignore
LICENSE
README.markdown

README.markdown

tex_turkce.vim

Converts Turkish characters to their TeX and HTML 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

Changelog

  • 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 or TrFrom does not find a suitable converter function.
  • 2013-10-30
    • Added generic TrTo and TrFrom commands which calls the appropriate conversion function according to the file type.
  • 2013-10-06
    • Conversion in selection instead of whole file.
    • If no selection is provided, whole file is used.
    • Commands renamed as TrToTex and TrFromTex
    • The script is now a plugin instead of ftplugin, 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.

Installation

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.

Supported Environments

  • Vim (no +Python required)

Usage

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.

TeX Character Conversion

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.

tex_turkce1.png

HTML Character Conversion

Whe natively typed Turkish characters are encoded using :TrToHtml command,

html_code1.png

this is what is seen on the web page when no any encoding applied:

html_webpage1.png

Commands

: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

Configuration

This plugin currently requires no configuration.

References

Turkish

TeX

HTML

Vim

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

License

Licensed with 2-clause license ("Simplified BSD License" or "FreeBSD License"). See the LICENSE file.

Contact Info

You can find me on Google+

Feel free to send bug reports, or ask questions.

Something went wrong with that request. Please try again.