Project Paper A4 5mm

清書したメモが置かれる

fish 3.0.2でgit switch/restoreの補完をする

結論

git switch、restoreの補完がfishで効かないのでmasterからcompletionsをもってくる | けんちゃんくんさんのWeb日記に書いてあります。

環境

  • Windows 10 (Version 10.0.17763.973)
  • WSL
  • Ubuntu 18.04.3 LTS (Bionic Beaver)
  • apt 1.6.12
  • fish 3.0.2
  • git 2.25.0

背景

fish 3.0.2 (released Feb 19, 2019) にはgit restore, switchの補完追加 (Aug 22, 2019) が入ってない。Pre-release 3.1b1では実装されているがapt(の標準リポジトリ)だと3.0.2を見ている(のでapt update & upgradeで解決はない)。

fish_update_completionsで補完をmanコマンドから追加できるらしいが、git-switchにmanがあるのでgit switchの補完は追加されない(と思っている)。

解決手段

結論で述べたとおり、参照先のページに書いてあります。 以下は私の環境(ghqとln)の方法

ghq get --shallow fish-shell/fish-shell
ln -s (ghq root)/github.com/fish-shell/fish-shell/share/completions/git.fish $__fish_config_dir/completions/git.fish
source $__fish_config_dir/config.fish

restoreの補完

よくわからんが、git restoreの時点では補完がない。git restore --まで打つと補完候補が出てくる。

補足

ghq get --shallow ..

With '--shallow' option, a "shallow clone" will be performed (for Git repositories only, 'git clone --depth 1 …​' eg.).
x-motemen/ghq: Remote repository management made easy

(ghq root)

bashだと$(ghq root) 、サブコマンドの展開をする

$__fish_config_dir

一般的には$HOME/.config/fishです。

fish: Documentation

雑談

Pre-releaseをcloneしてmake & make installが一番幸せ