sponsor Vim development Vim logo Vim Book Ad

fcitx.vim : keep and restore fcitx state when leaving/re-entering insert mode

 script karma  Rating 159/61, Downloaded by 8730  Comments, bugs, improvements  Vim wiki

created by
script type
Keep and restore fcitx state for each buffer separately when leaving/re-entering insert mode. Like always typing English in normal mode, but Chinese in insert mode.

Requires: fcitx 3.6 or later, 4.0 or later will be better.

Settings: environment variable $FCITX_SOCKET specifies a socket to connect instead of figuring out itself. This can be an abstract socket address starting with "@" from version 1.2.4 on.

Git repo: https://github.com/lilydjwg/fcitx.vim
www.vim.org: http://www.vim.org/scripts/script.php?script_id=3764

1, It will be faster and better with Python (3 or 2) enabled Vim. But some old version Vim enabled both Python 2 & 3 may have some issues.
2, If you use Vim in terminal, to avoid the Esc delay, please set 'ttimeoutlen' to 100 or some other value. And check screen's 'maptimeout' or tmux's 'escape-time' option if you use it too.


要求: fcitx 版本 3.6 以上,建议 fcitx 4.0 以上。

配置:环境变量 $FCITX_SOCKET 指定要连接的套接字路径,而非默认的。自版本 1.2.4 起,此变量若以 "@" 字符开头,则被认为是抽象套接字地址。

Git 仓库: https://github.com/lilydjwg/fcitx.vim
www.vim.org: http://www.vim.org/scripts/script.php?script_id=3764

1. Vim 如有 Python 3或2 支持可以获得更快更好的效果。但对于较旧的 Vim 版本,如果同时编译了 Python 2 & 3 支持,因为此 Vim 不能同时运行两个版本的 Python,而本脚本首先检查 Python 3,所以会导致出错或者 Python 2 不可用。
2. 终端下请设置 Vim 'ttimeoutlen' 选项为较小值(如100),否则退出插入模式时会有较严重的延迟。同样会造成延迟的还有 screen 的 maptimeout 选项以及 tmux 的 escape-time 选项。

如果你想跨主机使用 fcitx.vim,请参考此文: https://blog.lilydjwg.me/2012/7/27/using-fcitx-remote-interface-remotely-via-socat.34729.html
install details
Just extract it to ~/.vim. If your vim doesn't have Python support and you aren't going to use it, you can just put so/fcitx.vim to ~/.vim/plugin.

解压到 ~/.vim 下即可。如果没有并且不准备使用 Python 接口,可只将 so/fcitx.vim 放到 ~/.vim/plugin 目录下。

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
fcitx.vim.tar.gz 1.2.6 2019-05-22 7.0 lilydjwg support fcitx5
fcitx.vim.tar.gz 1.2.5 2017-05-24 7.0 lilydjwg * improved error message and connection handling
* recognized MacVim
* added timeouts
fcitx.vim.tar.gz 1.2.4 2013-11-05 7.0 lilydjwg * add abstract socket support
fcitx.tar.gz 1.2.3 2012-12-10 7.0 lilydjwg * ignore empty recv result
fcitx.tar.gz 1.2.2 2012-11-30 7.0 lilydjwg * so/fcitx.vim: update environment check
fcitx.tar.gz 1.2.1 2012-10-04 7.0 lilydjwg forgot to add the pure vimscript version: so/fcitx.vim
fcitx.tar.gz 1.2 2012-07-27 7.0 lilydjwg support to specify fcitx socket file by environment variable $FCITX_SOCKET
fcitx.tar.gz 1.1.1 2012-05-17 7.0 lilydjwg forgot to compress the tarball.
fcitx.tar.gz 1.1 2012-05-17 7.0 lilydjwg * remove warning about not using Python interface
* messages translate into English as fcitx supports more and more languages
fcitx.zip 1.0 2011-10-07 7.0 lilydjwg Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.