Giter VIP home page Giter VIP logo

Comments (4)

pi314 avatar pi314 commented on September 28, 2024

雖然子模式的切換讓 plugin 用 trigger 去抓就可以了,但這樣會讓 ime.vim 做一次無用的 match。
還是想一下要怎麼定這個介面吧。

from ime.vim.

pi314 avatar pi314 commented on September 28, 2024

〔不完全相關〕;; 好像是個可行的 change mode key


在現在的構思中,日文模式的兩個模式是永久的,除非使用者自己切換,不然是不自動切換回來的;但注音的標點符號模式則是暫時的,輸入完一個標點以後就會變回注音。

這個介面必須要能支援兩種方式才行,而且不能限制一個 plugin 只能有一個 submode。兩種方式分別需要兩個方向(ime.vim ←→ plugin)的通知。

  • ime.vim → plugin 的方向已經有了(trigger),但需要專用的 function
    • 如果 trigger 沒有結果,ime.vim 會送出 trigger key
    • 技術上是可以回傳 [''] 來 hacking...
    • 還是訂專用的吧,暫定 submode(switch)
    • Plugin 需要再提供 switch keys
  • plugin → ime.vim 的,暫定為 ime#icon(pname, icon)
    • 雖然 vim 是 single thread,但還是要考慮外部 plugin 的可能性,這裡的 pname 是為了只允許目前的 mode 更改 submode

原本有個想法是要讓 plugin 在 info() 就提供所有的 submode,但這樣太麻煩了;考慮到 user 其實只看得到 icon,就讓 plugin 自己改 icon。

如果在 plugin 處於別的 submode 的時候,user 切換到別的模式了,這時候原本的 plugin submode 應該要被 reset;這個情況用 a:switch == '' 來表示。

from ime.vim.

pi314 avatar pi314 commented on September 28, 2024

雖然不能限制一個 plugin 只能有一個 submode,但我想可以對「只有一個 submode 的 plugin」做優化。

ime.vim 也許 可以設定一個 g:ime_switch_submode 之類的變數,如果 plugin 不提供 switch 但又有 submode 的話,就用那個變數來做 mapping。

至於 submode 是暫時還是永久的,就讓 plugin 自己 call ime#icon(pname) 來通知 ime.vim 和 user。

對於只有一個 submode 的 plugin 來說,這樣應該是比較方便的作法,不過還要再想一下。

from ime.vim.

pi314 avatar pi314 commented on September 28, 2024

implemented with 87a141b

from ime.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.