Skip to content

nvim-cmp を skkeleton の補完バックエンドとして登録する - #4

Open
delphinus wants to merge 1 commit into
uga-rosa:mainfrom
delphinus:feat/register-completion-backend
Open

delphinus wants to merge 1 commit into
uga-rosa:mainfrom
delphinus:feat/register-completion-backend

Conversation

@delphinus

Copy link
Copy Markdown
Contributor

変更内容

skkeleton が補完エンジンを自動判定しなくなった (vim-skk/skkeleton#253) ため、nvim-cmp 用のバックエンド定義をこのプラグインから登録するようにしました。

skkeleton は eggLikeNewline の <CR> で補完候補を確定するために、補完メニューの表示状態と確定キーを知る必要があります。これまでは skkeleton 側が pum#visible() や require("cmp").visible() を直接見て判定していましたが、「バックエンドの定義は追従すべきエンジンの側に置くべき」という方針になり、内蔵していた nvim-cmp / pum.vim の実装が削除されました。

登録はこのプラグインが行うので、ユーザーは名前を選ぶだけです。

vim.fn["skkeleton#config"]({ completionBackend = "nvim-cmp" })
  • 登録は skkeleton-enable-pre で 1 回だけ行います。skkeleton が設定用に案内しているタイミングで、バックエンドは補完メニューが開いている間しか参照されないので間に合います。
  • pcall で包んでいるので、登録 API を持たない古い skkeleton でも何も起きません。このバックエンドを選ばないユーザーにも影響はありません。
  • complete_info は package.loaded.cmp を見るだけで require しません。キー入力の度に呼ばれるためです。

README の「skkeleton 本体が対応しているので」の記述も更新しました。

注意

vim-skk/skkeleton#253 はまだマージされていないので Draft にしています。マージされ次第 ready にします。

skkeleton no longer detects the completion engine on its own
(vim-skk/skkeleton#253). It takes a named definition through
skkeleton#register_completion_backend() and lets the user pick one, so the
definition for nvim-cmp has to come from somewhere. Here is the natural
place: it follows nvim-cmp's API, which is what this plugin already does.

Registration happens on skkeleton-enable-pre, the hook skkeleton documents
for setting itself up, and that is early enough because the backend is only
consulted while a completion menu is open. It is a no-op for users who do
not select this backend, and pcall keeps it quiet on a skkeleton that
predates the API.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@delphinus
delphinus force-pushed the feat/register-completion-backend branch from 8b7a957 to b1196d2 Compare September 9, 2026 07:44
@delphinus
delphinus marked this pull request as ready for review September 10, 2026 09:33
@delphinus

Copy link
Copy Markdown
Contributor Author

Skkeleton の方がマージされましたのでこちらをよろしくお願いします。

delphinus added a commit to delphinus/dotfiles that referenced this pull request Sep 15, 2026
skkeleton 本体から nvim-cmp / pum.vim の backend 定義が外れた
(vim-skk/skkeleton#253) ので、その受け皿を core/skkeleton_cmp.lua に書いて
いたが、同じものを cmp-skkeleton へ PR 済み (uga-rosa/cmp-skkeleton#4) なので
そちらを使う。定義は追従すべき補完エンジンの側に置く、という #253 の方針にも
こちらが沿っている。blink 側で blink-cmp-skkeleton がやっているのと同じ形。

fork のレポジトリ名が cmp-skkeleton2 なので、name でプラグイン名を元に揃える
(lazy-lock.json のキーと lua のモジュール名を変えないため)。マージされたら
branch 指定を外して "uga-rosa/cmp-skkeleton" に戻す。

PR 側は skkeleton-enable-pre で once に登録し、pcall で包んである。設定に
書いていた版は skkeleton の config 内で即時に呼んでいたが、backend は補完
メニューが開いている間しか参照されないのでどちらでも間に合う。

CMP=1 の時だけの経路なので、既定の blink には影響しない。

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant