Comments (13)
@chuxubank 已添加,谢啦
from pyim.
我仿照上面这个函数写了一个关于helm的switch函数,只要helm buffer打开并激活,就切换为英文输入:
(defun pyim-helm-buffer-active-p ()
(string-prefix-p "helm" (buffer-name (window-buffer (active-minibuffer-window)))))
(setq pyim-english-input-switch-function
'pyim-helm-buffer-active-p)
from pyim.
不知道为什么,我写的用于helm的这个switch函数不能用了,不知道是helm的原因还是chinese-pyim的原因?
from pyim.
pyim这个地方几乎没有变过,是不是helm那更新了?
from pyim.
chinese-pyim 添加了一个新组件: chinese-pyim-probe,专门用于收集探针函数。。。
from pyim.
个人很看好这个输入法,遇到一点问题就是在org或者tex中写中文时,换行后就自动转换回英文,有点不爽。仿照pyim-probe-dynamic-english写了一个函数,当前如果在行首或者indentation的位置,查找之前最近一个非空白字符,确定当前输入方式。
(defun swint-pyim-probe-dynamic-english () "Changed the behaviour of chinese-pyim at beginning of line." (if (or (= (- (point) (point-at-bol)) (current-indentation)) (= (point) (point-at-bol))) (not (or (pyim-string-match-p "\\cc" (save-excursion (if (re-search-backward "[^[:space:]]" nil t) (char-to-string (char-after (point)))))) (> (length pyim-current-key) 0))) (pyim-probe-dynamic-english)))
泪奔,居然不知道怎么在评论中输入代码。。
from pyim.
你说的这个应该是 pyim-probe-dynamic-english 默认的行为,这个probe会识别光标前的一个字符,只有中文字符时,才开启输入法,至于行首关闭输入法,这是为了方便输入 “*” “#+BEGIN” 等控制符的,自定义 probe就是 chinese-pyim 配置的一种方式,你这个功能用的很好
from pyim.
用两个 ”```“ 围起来就可以了
(defun swint-pyim-probe-dynamic-english ()
"Changed the behaviour of chinese-pyim at beginning of line."
(if (or (= (- (point) (point-at-bol))
(current-indentation))
(= (point) (point-at-bol)))
(not (or (pyim-string-match-p
"\\cc"
(save-excursion
(if (re-search-backward "[^[:space:]]" nil t)
(char-to-string (char-after (point))))))
(> (length pyim-current-key) 0)))
(pyim-probe-dynamic-english)))
from pyim.
@hitswint 如果有兴趣,你可以直接 hack pyim-probe-dynamic-english 函数,然后给我发一个pull request
from pyim.
已经发了,第一次弄,不知道弄得对不对。
from pyim.
Thanks!
from pyim.
这个帖子人气太差,关了
from pyim.
org-mode 中的 latex fragment 和 latex 宏指令中自动切换到英文输入.
用于 pyim-english-input-switch-functions
(defun pyim-probe-org-latex-mode ()
(when (eq major-mode 'org-mode)
(or
(not (eq (org-inside-LaTeX-fragment-p) nil))
(not (eq (org-inside-latex-macro-p) nil)))))
from pyim.
Related Issues (20)
- error: Wrong number of arguments: #<subr string-match>, 4 HOT 3
- 【建议】通过检测光标前的两个单词是否都为英语,决定是否切换为英文模式。 HOT 3
- 使用pyim全拼如何输入“nue”和“lue”? HOT 2
- 请问如何当从pyim切换回英文时保留已输入字母? HOT 5
- 即使 pyim-page-tooltip 已经设置成 minibuffer,pyim 依然依赖 posframe HOT 1
- 输入位置越靠后候选词(开启了浮窗)的响应越慢 HOT 8
- Sync latest vertico suuport changes HOT 6
- [FR] Display how to type each candidate in default scheme, when assistant scheme is enabled HOT 3
- How can I diable the "pyim-translate-trigger-char" ? HOT 2
- 关于emacs29词库的报错 HOT 1
- 光标颜色不随主题变化而变化 HOT 1
- 为什么我的候选词后面总出现(buff) HOT 4
- rime-quanpin 情况下上屏的词顺序固定不变 HOT 2
- 固定词频配置 HOT 1
- pyim-isearch-mode开启,无法搜索中括号 [ ] HOT 1
- pyim输入法无法在eww打开的网站(比如百度)的输入框中输入中文 HOT 1
- error: No such file or directory, xr
- 几年未用了。新安装后,词序感觉不太对啊。 HOT 4
- 如何简单的按词库顺序排序 HOT 2
- 默认的输入法打不出lue 忽略的略 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyim.