• Stars
    star
    234
  • Rank 171,630 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created about 11 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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

D-Bus only works with the same user so this won't work with sudo vim. See the fcitx5-server branch for an experimental implementation that supports sudo vim.

By default, it use python3 and D-Bus to toggle IME state. If you set g:fcitx5_remote to the executable path of fcitx5-remote BEFORE loading the plugin, it will use fcitx5-remote instead of python and D-Bus. In this case, python3 support is optional.

Usually fcitx5-remote mode is way faster to start up since Python script need quite some time for the initial load if you don't use any other plugins that load Python. The Python version will be faster while switching.

Base requirements:

  • fcitx 5

Requirements for Python mode (g:fcitx5_remote is not set):

  • Vim with Python 3 compiled in
  • The python-dbus package

Requirements for fcitx5-remote mode (g:fcitx5_remote is set):

  • fcitx5-remote

If you are using fcitx5-rime (which has its own state), let g:fcitx5_rime = 1 in your .vimrc.

The FcitxCurrentIM() function can be used to get current IM's name.

Links:

Warning:

  1. 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.

在离开或重新进入插入模式或搜索模式时自动记录和恢复每个缓冲区各自的输入法状态,以便在普通模式下始终是英文输入模式,切换回插入模式时恢复离开前的输入法输入模式。

D-Bus 只在同一用户时有效,所以使用 sudo vim 时本代码就失效了。在 fcitx5-server 分支有一个实验性的版本支持 sudo vim 的用法。

本插件默认会使用 Python 3 并通过 D-Bus 来切换输入法状态。 但如果你在加载插件之前设置了 g:fcitx5_remote 为你已安装的 fcitx5-remote 可执行文件的路径,那么本插件会使用它来切换输入法状态;此模式下本插件并不需要 Python。

如果你没有其他使用 Python 的 Vim 插件,本插件的 Python 模式初始化可能会显著拖慢启动时间;而 fcitx5-remote 模式则没有这个问题。Python 模式会在切换时更快。

基本要求:

  • fcitx 5

使用 Python 模式的要求(未设置 g:fcitx5_remote):

  • 带有 Python 3 支持的 Vim
  • python-dbus 包

使用 fcitx5-remote 模式的要求(需设置 g:fcitx5_remote):

  • fcitx5-remote

如果使用 fcitx5-rime(它自己有输入状态),在 .vimrc 中设置 let g:fcitx5_rime = 1

FcitxCurrentIM() 函数可以用于获取当前输入法的名字。

链接:

注意事项:

  1. 终端下请设置 Vim 'ttimeoutlen' 选项为较小值(如100),否则退出插入模式时会有较严重的延迟。同样会造成延迟的还有 screen 的 maptimeout 选项以及 tmux 的 escape-time 选项。
  2. 请在 fcitx5-configtool 中确认英语是第一个输入法,中文是第二个输入法,rime 用户可能需要设置 g:fcitx5_rime = 1

More Repositories

1

swapview-rosetta

Print swap usage per process. Implemented in various programming languages
C++
487
star
2

morerssplz

Convert other article sources to RSS feeds
Python
402
star
3

nvchecker

New version checker for software releases
Python
370
star
4

colorizer

A Vim plugin to colorize all text in the form #rrggbb or #rgb.
Vim Script
336
star
5

dotvim

My vim config
Vim Script
274
star
6

pssh

Parallel SSH Tools
Python
262
star
7

luoxu

A Telegram userbot to index Chinese and Japanese group contents.
Python
246
star
8

winterpy

My python scripts started in winter.
Python
218
star
9

myawesomerc

My Awesome WM config files
Lua
84
star
10

dotzsh

My zsh config
Shell
56
star
11

search-and-view

Tools to make searching and viewing easy.
Python
47
star
12

xmpptalk

An XMPP bot to make a chatroom
Python
46
star
13

telegram-cache-decryption

Decrypt the media cache of Telegram Desktop
Python
46
star
14

capture-dns

A simple program to capture and show DNS queries
Rust
41
star
15

wait-online

Wait until we're connected to the Internet
Python
41
star
16

dotconfig

~/.config
Lua
40
star
17

dnssnoop

show which process did what DNS queries
Python
34
star
18

stdoutisatty

Make programs think their stdout is a tty / terminal.
C
34
star
19

ncdu-diff

ncdu fork that can compare and diff results
C
27
star
20

taskmaid

A D-Bus task API for Wayland
Rust
25
star
21

dpms-off

Turn off monitors to save power (for Wayland)
Rust
25
star
22

remotebrowser

open URLs from Windows virtual machines in the host system
Rust
24
star
23

openredir

redirect file open operations via LD_PRELOAD
C
24
star
24

luoxu-web

A web frontend for luoxu.
Svelte
23
star
25

2bbcode

A set of custom Pandoc writers for converting to BBCode.
Lua
23
star
26

abp-rules

My list of Adblock Plus rules, mainly for China websites
22
star
27

gaetalk

A chatroom application run on Google App Engine
Python
22
star
28

userscripts

My user scripts
JavaScript
21
star
29

cgtree

List cgroups info in a tree
Python
21
star
30

swapview

A simple program to view processes' swap usage on Linux.
Rust
20
star
31

archrepo2

Arch Linux repository manager
Python
19
star
32

monitor-control

The fastest way to get / set DDC values for a monitor
Rust
16
star
33

gm-github-tweaks

Tweak GitHub to make it great again.
CSS
16
star
34

udt_py

Python UDT
C++
15
star
35

ircbindxmpp

IRC <-> XMPP bidirectional connection
Python
14
star
36

compare-env

Compare the given environment variable value across all the processes
Rust
14
star
37

chinese-num

A Rust librrary to convert a decimal number to its Chinese form
Rust
13
star
38

spamfightbot

Another Telegram anti-spam bot without disturbance.
Python
13
star
39

fiemap-rs

FIEMAP library and tools for Rust
Rust
12
star
40

tornadochat

A web chatroom using tornado
Python
12
star
41

walkdir-test

a simple and naïve test to see which implementations of directory traversing is faster
Makefile
11
star
42

copy-link-address

Firefox addon to Copy Link Address with accesskey "a"
JavaScript
11
star
43

bluekeyslistener

Listen to bluetooth headphone keys (Linux only)
Rust
10
star
44

mozlz4-tool

A tool to process mozlz4 files
Rust
9
star
45

rpysh

Remote Python shell, for Linux Pythoners coping with Windows.
Python
8
star
46

bookmarked-search

Firefox addon to search the selected text using a search engine from your bookmarked search engines.
JavaScript
8
star
47

gdu-diff

Use gdu to diff and compare directory usages
Python
8
star
48

myhaskells

Haskell programs writing while learning
Haskell
7
star
49

paddleocr-web

A simple PaddleOCR web frontend.
Svelte
7
star
50

accurate-time

Show accurate time in tmux status
Rust
6
star
51

fcitx-lua-scripts

Lua
6
star
52

uniclip

Unify the clipboard operations for X11 and Wayland
Rust
6
star
53

paddleocr-service

Run PaddleOCR as a systemd service.
Shell
6
star
54

paperlike-i2c

i2c program for Dasung Paperlike HD e-ink monitors
Rust
6
star
55

HTTPSEverywhereUserRules

My personal HTTPSEverywhere rules
5
star
56

socat

socat - Multipurpose relay (cloned from git://repo.or.cz/socat.git) http://www.dest-unreach.org/socat/
C
5
star
57

cjk-align

Align CJK and emoji characters correctly on terminals
Rust
5
star
58

vim-foldtree

Fold ASCII tree graphs in Vim
Rust
5
star
59

fcitx-mb

A tool for interactively viewing and modifying fcitx's code tables.
Python
5
star
60

git-linked

git logs with hyperlinks
Python
5
star
61

website-styles

My custom styles for some websites (stylus)
CSS
4
star
62

https-speed

Show HTTPS speed in a terminal
Rust
4
star
63

tailf.vim

asynchronous "tail -f" and other shell commands in Vim 8
Vim Script
4
star
64

simplehist

A simple program to show a histogram on the terminal.
Rust
4
star
65

viewhtmlmsg

View an HTML email message in a browser (for text MUAs like mutt)
Python
4
star
66

android-dedupefs

A filesystem for reading Android dedupe backup
C
4
star
67

filequeue

send logs to Kafka, using the log file like a queue, without rotation.
Rust
4
star
68

fcitx5-dictsync

A tool to synchronize fcitx5 tabledict.
Rust
4
star
69

text-reflow-we

Firefox Android addon to allow click events to reflow text of that tag to fit screen width
JavaScript
3
star
70

srcipfix

fix source IP for UDP packets with netfilter_queue
Rust
3
star
71

roll-it-back

A command-line tool to rollback a possibly-nested btrfs subvolume to a snapshot
Rust
3
star
72

fetchtitle

Asynchronized URL information retriever
Python
3
star
73

cf-pop

Which Cloudflare® datacenter am I visiting? (Firefox addon)
JavaScript
3
star
74

imagestamp

add a stamp / watermark to a couple of images, at a chosen position for each
C
3
star
75

rust-signalbool

A simple crate to catch signals and set a boolean flag for later use.
Rust
3
star
76

mc2tg

A bot to synchronize messages from minecraft server to Telegram and back
Python
3
star
77

lilydjwg.github.io

HTML
2
star
78

x.rs

Extract various archive formats to standalone directory.
Rust
2
star
79

reorder-extensions

Reorder Firefox's extension menu with ease (see https://bugzilla.mozilla.org/show_bug.cgi?id=1831782)
Svelte
2
star
80

fcitx5-paste-primary

Fcitx Addon to Paste Primary selection with Keyboard
C++
2
star
81

open-noatime

Hook `open` and `open64` libc calls to avoid updating atimes while searching or the like.
Rust
2
star
82

fcitx5-tabledict

A tool to manipulate fcitx5 tabledict.
Rust
2
star
83

drop-serverhello

Drop ServerHello with netfilter_queue. For testing bug 1718719 of Firefox.
Rust
2
star
84

expiringdict-rs

A dict / HashMap whose items expire over time
Rust
2
star
85

multimc-bin-pkgbuild

Repackage multimc for Arch Linux in a distribution way
Shell
1
star
86

rust-tokio-anyfd

Use any suitable file descriptor with tokio
Rust
1
star
87

my-trime

My customizations for trime
Shell
1
star
88

pyparsing_fork

My fork for pyparsing, on *GitHub*
Python
1
star
89

pid_children

A simple program outputs descendant process ids for each pid given on the command line
Rust
1
star
90

extsort-lily

An efficient external sort library for Rust
Rust
1
star
91

journal-usage

Analyze systemd journal usage by unit or by date
Rust
1
star
92

netctl-lily

Profile based systemd network management. lilydjwg's fork.
Shell
1
star
93

transgender-pride-3

Transgender Pride 3 is a Firefox theme that changes itself based on system theme kind.
Python
1
star
94

archutils

My personal scripts for Arch Linux
Python
1
star
95

sys-stat

System Statistics Collector
Rust
1
star