Ⅰ. 插件描述
Converts Turkish characters to their Tex representation and back.Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'caglartoklu/tex-turkce'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'caglartoklu/tex-turkce'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'caglartoklu/tex-turkce'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/caglartoklu/tex_turkce.vim
Ⅳ. 文档说明
# tex_turkce.vim
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
Changelog
2019-03-14
- Added
TexTurkceReplaceOneCharcommand.
- Added
2013-10-31
- Added
TrToAnsicommand.
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
TrToorTrFromdoes not find a suitable
converter function.
- Added
2013-10-30
- Added generic
TrToandTrFromcommands 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
TrToTexandTrFromTex - The script is now a
plugininstead offtplugin, since it will
not be limited with.texfiles 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 yourplugin directory.
Supported Environments
- Vim (no
+Pythonrequired)
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.

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

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

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
: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 => ç
Configuration
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>
" }
References
Turkish
TeX
HTML
- https://en.wikipedia.org/wiki/Html
- http://webdesign.about.com/od/localization/l/blhtmlcodes-tr.htm
- http://character-code.com/turkish-html-codes.php
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.