LoginSignup
0

More than 1 year has passed since last update.

fish環境でクソ便利なpecoを導入する

Posted at

はじめに

この記事は自分用に書いているので読んでもわかりにくいかもしれない。

あくまでも備忘録代わりで書かせてもらう。

この記事では、fish環境でpecoを導入する方法を記述する。

pecoとは

過去に入力したコマンドなどを閲覧・検索・使用できるコマンド
字面がもう便利

環境

Ubuntu 20.04 LTS

多分Ubuntuなら動く

必要なもの

fish

peco

oh-my-fish(peco導入時に使用)

導入

まずはfishの導入からです。(すでにfish導入済みの方はpecoの導入へ)
インストール
  sudo apt-add-repository ppa:fish-shell/release-3; sudo apt update; sudo apt install fish;
デフォルトシェルにするためにgeditでshellのリストに追記する
   sudo gedit /etc/shell; または sudo gedit /etc/shells; (私は後者だった)
gedit内
  # /etc/shells: valid login shells
  /bin/sh
  /bin/bash
  /usr/bin/bash
  /bin/rbash
  /usr/bin/rbash
  /bin/dash
  /usr/bin/dash
  /usr/bin/fish  <<<追加!!
デフォルトシェルに変更するコマンド
  chsh -s /usr/bin/fish;
これでfishの導入は終わりです
続いてpecoの導入です。
pecoを入れるにはoh-my-fishが必要なので入れます
  curl -L http://get.oh-my.fish | fish
その後、pecoを入れます。
  omf install peco
しかしこのままではCtrl+Rでの呼び出しが出来ないままです。
なのでconfigファイルに記述します。
  gedit .condig/fish/congig.fish
gedit内
  #peco
  function fish_user_key_bindings
    bind \cr peco_select_history
  end
これでpecoの導入が完了です。
試しにCtrl+Rを押してみます。
  clear
  cd ..
  cd
  sudo apt update
  sudo apt upgrade
  sudo apt-get update
  sudo apt-get upgrade
  sudo apt-add-repository ppa:fish-shell/release-3; sudo apt update; sudo apt install fish;
  sudo gedit /etc/shells;
  chsh -s /usr/bin/fish;
  curl -L http://get.oh-my.fish | fish
  omf install peco
  gedit .condig/fish/congig.fish
  QUERY>

最後の行にQUERYとありますが、ここでコマンドの検索が出来ます(部分一致)
↓↑キーで選んで実行できます。

あとがき

まじで使いやすい

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