0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

(おま環かもしれないけど)Windows Terminal > WSL2 Ubuntu > fish shell という環境で Ctrl+BackSpace (以下Ctrl+BS)しても機能しない問題があったので修正した。

Ctrl+BSを入力することで単語ごとに入力内容を削除されるのが期待値。

修正方法(v4.3.3)

最新版じゃないって?修正試す前にアプデしてね
バージョン確認コマンド:fish -v

  1. 以下のファイルを開く
    • ~/.config/fish/config.fish
  2. 以下のようなコードを上の方に追加する
    if status is-interactive
        # Ctrl+BackSpace
        bind ctrl-h backward-kill-word
    end
    
  3. fish shellを再起動して動作確認する

↑なにこれ

fish shell(v4.3.3)がWindows Terminalのキー入力に対応していなかったので追加した。

入力したキーがどのキーに割り当てられているか調べる

fish_key_readerコマンドを用いる。

~> fish_key_reader
Press a key:

bind ctrl-h 'do something'

Windows Terminalだと何故かctrl-h扱いになる。
なお、Ctrl+BSが正常に動作するVS Codeの組み込みターミナルではctrl-wになる。
(Windows Terminal側の設定で調整できるかもしれないが、自分はその方法を見つけられなかった)

仕方がないので新しいキーバインドを追加する

fish.configというシェル呼び出し時に読み込まれるスクリプトファイルがあるので、上述の通りそこに必要なバインディング処理を追加した。
bind ctrl-h backward-kill-word

よく読めばわかるが、Ctrl+Hを押しても同じ動作をしてしまっている。
邪魔な場合は調整が必要。

参考

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?