3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

fisherman によるキーバインド設定を制御する方法がわからない

Posted at

前置き

fisherman を使うと、プラグインがもつキーバインド設定(key_bindings.fish の中身)が fish_user_key_bindings 関数にコピーされる。このとき、プラグイン由来ではない自分で書き加えたキーバインド設定があれば、それは fish_user_key_bindings 関数の先頭に移動される。

悩み

C-fC-t も勝手にバインドされると困る。

試行錯誤

余計な設定をするプラグインは使わない

最終手段。

ローカルのプラグイン

プラグインになっていれば、(たぶん)プラグイン名の辞書順で並んで fish_user_key_bindings にコピーされるので、適当に後ろに並ぶような名前のプラグインを作れば解決しそう。

fisher <path> でプラグインを追加した時は期待通りの結果を得られたが、 fisher up した時に上に持って行かれた。残念。ローカルプラグインは、なぜ fishfile に追加されないのか。

gist のプラグイン

ローカルがダメなら gist でどうかと試した結果、だいたい期待通りの結果を得られた。が、gist に含めたファイルを key_bindings.fish のみとした結果、gist の名前が key_bindings となり、プラグイン名も key_bindings として管理される結果に。

k より後に並ぶ名前のプラグインをどうしたものか。

GitHub リポジトリのプラグイン

そこまでしたくない。

fish 自体の何かズバリな仕組み

知りたい。

fisher がコピーしたやつは無視

関数上部にへばりつく挙動を前提に、自分で書く設定の最後を return にしてしまう案。プラグインが追加する関数にバインドしたいものがあれば、自分でコピペする。

~/.config/fish/functions/fish_user_key_bindings.fish
function fish_user_key_bindings
    bind \cf 'forward-char'
    bind -M insert \cf 'forward-char'

    return
    ...
    ### fzf ###
end

正直、色々めんどくさくなってこれで良い気がしている。

まとめ

fisherman なんて使わなければ良い気がしている。とはいえ、スニペット共有リポジトリ的な観点からは便利そう。

プラグイン定義のキーバインドを手軽に on/off する良い感じの方法を知りたい。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?