Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/solareenlo/bashrc
Ubuntu18.04のカスタム.bashrc
https://github.com/solareenlo/bashrc
Last synced: 4 days ago
JSON representation
Ubuntu18.04のカスタム.bashrc
- Host: GitHub
- URL: https://github.com/solareenlo/bashrc
- Owner: solareenlo
- Created: 2019-01-25T16:24:40.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-05T05:21:11.000Z (over 5 years ago)
- Last Synced: 2024-11-08T02:46:27.251Z (about 2 months ago)
- Language: Shell
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bashrc
ubntu18.04の.bashrcの追加要素## Usage
### まずgit-completion.bashとgit-prompt.shをインストールする
```bash
wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -O ~/.git-completion.bash
chmod a+x ~/.git-completion.bash
wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -O ~/.git-prompt.sh
chmod a+x ~/.git-prompt.sh
```### .bashrcに以下を追加する
- 以下は当該部分を置き換える.
```bash
# \u ユーザ名
# \h ホスト名
# \W カレントディレクトリ
# \w カレントディレクトリのパス
# \n 改行
# \d 日付
# \[ 表示させない文字列の開始
# \] 表示させない文字列の終了
# \$ $if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[01;31m\]$(__git_ps1)\[\033[00m\]\n\[\033[01;35m\]-> \$\[\033[00m\] '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
```
- 以下は追加する.
```bash
# gitに色を付ける
source ~/.git-completion.bash
source ~/.git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWSTASHSTATE=true
GIT_PS1_SHOWUNTRACKEDFILES=true
GIT_PS1_SHOWUPSTREAM="auto"
GIT_PS1_SHOWCOLORHINTS=true
```## Reference
- [「Git補完をしらない」「git statusを1日100回は使う」そんなあなたに朗報【git-completionとgit-prompt】](https://qiita.com/varmil/items/9b0aeafa85975474e9b6)