• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

joom/latex-unicoder.vim: A plugin to type Unicode chars in Vim, using their LaTe ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

joom/latex-unicoder.vim

开源软件地址(OpenSource Url):

https://github.com/joom/latex-unicoder.vim

开源编程语言(OpenSource Language):

Vim Script 100.0%

开源软件介绍(OpenSource Introduction):

latex-unicoder.vim

A plugin to type Unicode chars in Vim, using their LaTeX names. This is a more extensive version of rtdavis22/latex2unicode.

I obtained the LaTeX-character map from here.

If you'd like to write Agda in Vim, you can use this as a substitute for agda-input, even though the character names are different.

Demo

asciicast

Usage

When in normal mode or insert mode, use the shortcut C-l (l standing for LaTeX), and then type the LaTeX code of the symbol to the status bar. Even though the plugin takes you to normal mode, you will be taken back to insert mode if you were in insert mode before pressing C-l.

I wanted the shortcut to be usable in insert mode too, so I used a modifier key in it.

If you don't want to type the entire thing, just type the first characters and press Tab, the plugin will complete it for you. If you're looking for something else that starts with the same characters, press Tab again. You can also omit the backslash in the beginning and let the autocomplete type it for you.

If you are in visual mode, you can select a LaTeX code and press C-l. The plugin will convert the selected text, say, \lambda, to λ for you. This can be used on multiple characters as well; for example, if you type \forall \alpha \in A : \exists a \in A : a \cdot \alpha = 1, select it and press C-l, your selection will be converted to ∀ α ∈ A : ∃ a ∈ A : a ⋅ α = 1!

Installation

You can install it the way you install any other plugin with Vundle or Pathogen.

You also have the option to cancel the default mappings and create the mappings for yourself. You can change and add these lines to your .vimrc as you wish:

let g:unicoder_cancel_normal = 1
let g:unicoder_cancel_insert = 1
let g:unicoder_cancel_visual = 1
nnoremap <C-l> :call unicoder#start(0)<CR>
inoremap <C-l> <Esc>:call unicoder#start(1)<CR>
vnoremap <C-l> :<C-u>call unicoder#selection()<CR>

You can add additional custom symbols by defining g:unicode_map in your .vimrc, for instance:

let g:unicode_map = {
  \ "\\box" : "" ,
  \ "\\sep" : "" ,
  \ }

Contributions

There might be certain symbols and aliases that I miss. Pull requests are welcome. If you have other suggestions about the plugin usage, I'd like to hear them as well.

License

MIT




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap