新規/グラフエディタをエディタリストに追加

新規/グラフエディタをエディタリストに追加

お問い合わせいたしました今後、そして編集者リストにleafpadを追加したかったのですが、それはできませんでした。

[$] sudo update-alternatives --set editor /usr/bin/leafpad                                                                       
update-alternatives: error: alternative /usr/bin/leafpad for editor not registered; not setting

このリストを一目見ましたが——

└─[$] sudo update-alternatives --config editor

There are 8 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /usr/bin/le          60        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
  3            /usr/bin/emacs24     0         manual mode
  4            /usr/bin/le          60        manual mode
  5            /usr/bin/ne          20        manual mode
  6            /usr/bin/nedit       40        manual mode
  7            /usr/bin/vim.basic   30        manual mode
  8            /usr/bin/vim.tiny    15        manual mode

Press <enter> to keep the current choice[*], or type selection number: ^C

なぜleafpadが有効なエディタで登録できないのかわかりません。コンソールにダンプされて何らかの理由でグラフィカルエディタが利用できない場合は、いつでもsudo update-alternatves --configエディタを実行して同じ問題を解決できます。これはバグですか、それともリーフパッドまたはupdate-alternatives / dpkg側で修正する必要がありますか?

ベストアンサー1

構文は通常

update-alternatives --install link name path priority

(追加で省略したいくつかのオプションのパラメータもあります)。

だからあなたはこれを行うことができます:

update-alternatives --install /usr/bin/editor editor /usr/bin/leafpad  0

その後、同じコマンドを再実行してleafpadエディタとして選択できます。

私の例では、優先順位を0に設定しました。さまざまなものを選択できます。選択肢が自動モードに切り替わる場合にのみ機能します。ただし、Leafpadに高い優先順位を与えないでください。問題が発生してパッケージが独自に再構成される場合に備えて、グラフィックエディタがデフォルトの選択になることは望ましくありません。

おすすめ記事