最近日本語で書かれたディレクトリが多くてディレクトリ移動が億劫になっていた。 しかしディレクトリ移動を再帰的に繰り返して目的のファイルを開くためだけにファイラを開くのも億劫なので、 ターミナル上でそれができるツールを作った。
絶対どこかに同じことをしようとしてもっと良いものを作っている人がいると思うので、これを読んだ人は知ってたら教えてほしい……
前提としてpecoをインストールする必要がある。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
file-select() { | |
( | |
cd "${1}" | |
path=$(ls -a | peco) | |
path=(readlink−f"{path}") | |
if [[ -d "${path}" ]]; then | |
file-select "${path}" | |
elif [[ -f "${path}" ]]; then | |
echo "${path}" | |
else | |
exit 1 | |
fi | |
) | |
} | |
file-select "${1:-pwd}" |