Created
February 19, 2017 16:19
-
-
Save chew-z/45aecc0b56dd628afaa2bacbc884a6f8 to your computer and use it in GitHub Desktop.
My simple and humble .zshrc
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
| # homebrew configuration | |
| export HOMEBREW_INSTALL_BADGE="☕️ " | |
| # | |
| # https://iterm2.com/shell_integration.html | |
| source ${HOME}/.iterm2_shell_integration.zsh | |
| # z is the new j (installed from brew) | |
| source "$(brew --prefix)/etc/profile.d/z.sh" | |
| # Fuzzy search - fzf & Co | |
| # Ctrl-R - command history | |
| # Ctrl-T - files - full paths | |
| # Alt-C - folders under current dir [left Alt -> Esc+ in iTerm2] | |
| # Alt-Z - recent folders (fzf-z) | |
| # or use something like vim **<TAB> | |
| # also for process IDs, host names, environment variables / aliases | |
| [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh | |
| # --bind ctrl-b:page-up,ctrl-f:page-down | |
| export FZF_DEFAULT_OPTS=' | |
| --color fg:242,bg:236,hl:65,fg+:15,bg+:239,hl+:108 | |
| --color info:108,prompt:109,spinner:108,pointer:168,marker:168' | |
| # Ctrl-T or Tab do not work on empty line. But work without any '**'. vim (Ctrl-T) | |
| # Instead of using TAB key with a trigger sequence, you can assign a dedicated key for fuzzy completion while retaining the default behavior of TAB key. Then CTRL-T will trigger context-aware fuzzy completion. | |
| export FZF_COMPLETION_TRIGGER='' | |
| # bindkey '^T' fzf-completion | |
| # bindkey '^I' $fzf_default_completion | |
| # Setting ag as the default source for fzf | |
| # export FZF_DEFAULT_COMMAND='ag -g ""' | |
| # using ripgrep instead of ag - https://elliotekj.com/2016/10/30/using-ripgrep-and-fzf-instead-of-the-silver-searcher-and-ctrlp/ | |
| # --files: List files that would be searched but do not search | |
| # --no-ignore: Do not respect .gitignore, etc... | |
| # --hidden: Search hidden files and folders | |
| # --follow: Follow symlinks | |
| # --smart-case: be smart about case sensitive search | |
| # --glob: Additional conditions for search (in this case ignore everything in the .git/ folder) | |
| export FZF_DEFAULT_COMMAND='rg --files --hidden --follow --smart-case --glob "!.git/*"' | |
| export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" | |
| # You can preview the content of the file under the cursor by setting --preview option. | |
| export FZF_CTRL_T_OPTS="--preview '(highlight -O ansi -l {} 2> /dev/null || cat {} || tree -C {}) 2> /dev/null | head -200'" | |
| # We can use --preview option to display the full command on the preview window. In the following example, we bind ? key for toggling the preview window | |
| export FZF_CTRL_R_OPTS="--sort --preview 'echo {}' --preview-window down:3:hidden --bind '?:toggle-preview'" | |
| # The following example uses tree command to show the entries of the directory. | |
| export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'" | |
| # fzf-z - magic powers of z & fzf combined - | |
| # Alt-z -> recent folders history and goto | |
| export FZFZ_SUBDIR_LIMIT | |
| # export FZFZ_EXTRA_DIRS="~/Documents ~/Downloads" | |
| source /usr/local/share/zsh/site-functions/fzf-z | |
| # Ctrl-P - cd to dir or edit file with fzf | |
| source /usr/local/share/zsh/site-functions/ctrl-p | |
| # | |
| PURE_PROMPT_SYMBOL= | |
| PURE_PROMPT_COLOR="white" | |
| PURE_PROMPT_COLOR_ERROR="red" | |
| PURE_CMD_MAX_EXEC_TIME=45 | |
| # pure i async are symlinked to ~/Documents/Shell/pure | |
| autoload -Uz async; async | |
| autoload -U promptinit; promptinit | |
| prompt pure | |
| # | |
| # zsh-syntax-highlighting (installed from brew) | |
| export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/usr/local/share/zsh-syntax-highlighting/highlighters | |
| source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | |
| # | |
| # add italics to terminal (iTerm2) | |
| { infocmp -1 xterm-256color ; gecho -e "\tsitm=\\E[3m,\n\tritm=\\E[23m,"; } >! /tmp/xterm-256color.terminfo | |
| tic /tmp/xterm-256color.terminfo | |
| # and last thing | |
| source "$HOME/.aliases" | |
| # | |
| # reset key bindings to emacs (just in case some plugin set vi) | |
| bindkey -e | |
| ### bindkey -r <key_combination> - unbind keymapping (if makes trouble) | |
| # bing right arrow to | |
| # bindkey '^[[C' expand-or-complete | |
| # unbind <Tab> | |
| # bindkey -r '^I' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment