1. git-completion.bash 작성
cd ~
vi git-completion.bash
vim 편집기가 뜨면, https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
여기 내용을 복사 후, 편집기에서
**** p를 누른다 **** (복사됨. 직접 복사 후 붙여넣기 시 매우 오래 걸림)
이후 :wq를 눌러 저장.
2. git-prompt.sh 작성
vi git-prompt.sh
역시 vim 편집기가 뜨면, https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh
여기 내용을 복사 후, 편집기에서 p, :wq를 눌러 붙여넣고 저장한다.
3. .bash_profile_course 작성
vi .bash_profile
vim 편집기가 뜨면, 아래 내용을 복사해 p로 붙여넣는다.
# Enable tab completion
source ~/git-completion.bash
# colors!
green="\[\033[0;32m\]"
blue="\[\033[0;34m\]"
purple="\[\033[0;35m\]"
reset="\[\033[0m\]"
# Change command prompt
source ~/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
# '\u' adds the name of the current user to the prompt
# '\$(__git_ps1)' adds git-related stuff
# '\W' adds the name of the current directory
export PS1="$purple\u$green\$(__git_ps1)$blue \W $ $reset"
+ 자동완성 추가
touch ~/.bashrc
## git 자동완성 추가
mkdir ~/bash_completion.d
curl -o ~/bash_completion.d/git https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
echo "source ~/bash_completion.d/git" >> ~/.bashrc
# Docker CLI:
curl -o ~/bash_completion.d/docker https://raw.githubusercontent.com/docker/cli/master/contrib/completion/bash/docker
echo "source ~/bash_completion.d/docker" >> ~/.bashrc
# Docker Machine
curl -o ~/bash_completion.d/docker-machine https://raw.githubusercontent.com/docker/machine/v0.16.0/contrib/completion/bash/docker-machine.bash
echo "source ~/bash_completion.d/docker-machine" >> ~/.bashrc
# Docker Compose:
curl -o ~/bash_completion.d/docker-compose https://raw.githubusercontent.com/docker/compose/1.25.3/contrib/completion/bash/docker-compose
echo "source ~/bash_completion.d/docker-compose" >> ~/.bashrc
끝!