macOS with homebrew

main
Tran Hau 2020-05-22 13:33:45 +07:00
parent e8bcbde824
commit a999531ac4
2 changed files with 20 additions and 7 deletions

View File

@ -9,6 +9,13 @@ In macOS, Bash read `~/.bash_profile` not `~/.bashrc`, so edit `~/.bash_profile`
source ~/.bashrc
```
Add to `~/.bashrc`:
```bash
export HISTCONTROL=ignoreboth:erasedups
export HISTIGNORE="cd:cd *:ls:ls *:pwd:exit"
```
## Bash completion
| Distribution | Package |
@ -20,9 +27,6 @@ In macOS, Bash read `~/.bash_profile` not `~/.bashrc`, so edit `~/.bash_profile`
Add to `~/.bashrc`:
```bash
export HISTCONTROL=ignoreboth:erasedups
export HISTIGNORE="cd:cd *:ls:ls *:pwd:exit"
# Archlinux, Ubuntu
[[ -f /usr/share/bash-completion/bash_completion ]] && \
source /usr/share/bash-completion/bash_completion

View File

@ -4,20 +4,29 @@
| ------------ | ------- |
| Archlinux | `fzf` |
| Ubuntu | `fzf` |
| Homebrew | `fzf` |
Add to `~/.bashrc`:
```bash
[[ -f /usr/share/fzf/key-bindings.bash ]] && \
source /usr/share/fzf/key-bindings.bash
# Archlinux, Ubuntu
[[ -f /usr/share/fzf/completion.bash ]] && \
source /usr/share/fzf/completion.bash
[[ -f /usr/share/fzf/key-bindings.bash ]] && \
source /usr/share/fzf/key-bindings.bash
# Homebrew
[[ -f /usr/local/opt/fzf/shell/completion.bash ]] && \
source /usr/local/opt/fzf/shell/completion.bash
[[ -f /usr/local/opt/fzf/shell/key-bindings.bash ]] && \
source /usr/local/opt/fzf/shell/key-bindings.bash
# Use fd instead of find
export FZF_DEFAULT_COMMAND='fd -H'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
```
| Shorcut | Explain |
| -------- | ------------------------------------ |
| `Ctrl-T` | search through files and directories |
| `Ctrl-R` | search though command-line history |
| `CTRL-T` | search through files and directories |
| `CTRL-R` | search though command-line history |