12/08/2018, 14:20
Introducing to zsh shell and auto-completions
What is the point to to this? You don't need to remember all the command For example you can see all the command and help when you type git (Tab) For ubuntu sudo apt-get install zsh cat /etc/shells chsh /path/to/zsh extentions zsh-completions zsh-autosuggestions my setting file ...
What is the point to to this?
You don't need to remember all the command For example you can see all the command and help when you type git (Tab)
For ubuntu
sudo apt-get install zsh cat /etc/shells chsh /path/to/zsh
extentions
zsh-completions
zsh-autosuggestions
my setting file is this(but this may be different for other os)
you should set your path setting by yourself
# source ~/.zsh.d/zsh-autosuggestions/zsh-autosuggestions.zsh # enabling color setting autoload -Uz colors colors # emacs key binding # bindkey -v # automatically ls after cd chpwd() { ls } #function homestead() { # ( cd ~/Homestead && vagrant $* ) #} ############################### # PATH settings <= this is up to your environment!Be careful # export XDEBUG_CONFIG="idekey=sublime.xdebug" # export PATH=/usr/sbin:$PATH # export PATH=/bin:/usr/bin:/usr/local/bin:${PATH} #mysql # export PATH=$PATH:/usr/local/mysql/bin #composer # export PATH=~/.composer/vendor/bin:$PATH # export PATH=/usr/local/bin:$PATH # nodebrew # export PATH=$HOME/.nodebrew/current/bin:$PATH # geckodriver # export PATH=$PATH:/usr/local/bin/geckodriver # export PATH="$HOME/.anyenv/bin:$PATH" # export PATH="$HOME/.anyenv/envs/rbenv/shims:$PATH" # export PATH="/usr/local/sbin:$PATH" if [ -d $HOME/.anyenv ] ; then export PATH="$HOME/.anyenv/bin:$PATH" eval "$(anyenv init -)" # tmux対応 for D in `ls $HOME/.anyenv/envs/` do export PATH="$HOME/.anyenv/envs/$D/shims:$PATH" done fi fpath=(/usr/local/Cellar/zsh-completions $fpath) ######################## ## history file settings HISTFILE=~/.zsh_history HISTSIZE=10000000 SAVEHIST=$HISTSIZE setopt hist_ignore_dups setopt hist_ignore_space setopt inc_append_history setopt share_history setopt no_flow_control ###################### # prompt settings # oneline # PROMPT="%~ %# " # two lines PROMPT="%{${fg[green]}%}[%n@%m]%{${reset_color}%} %~ %# " # setting for dividing word autoload -Uz select-word-style select-word-style default # these letters are treated as dividing letters zstyle ':zle:*' word-chars " /=;@:{}, |" zstyle ':zle:*' word-style unspecified ######################################## ## autocomplete autoload -Uz compinit && compinit -u zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' zstyle ':completion:*' ignore-parents parent pwd .. zstyle ':completion:*' menu select interactive setopt menu_complete zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin zstyle ':completion:*:processes' command 'ps x -o pid, s, args' zstyle ':completion:*' verbose yes zstyle ':completion:*' completer _expand _complete _match _prefix _approximate _list _history zstyle ':completion:*:messages' format '%F{YELLOW}%d'$DEFAULT zstyle ':completion:*:warnings' format '%F{RED}No matches for:'%F{YELLOW} %d'$DEFAULT zstyle ':completion:*:descriptions' format '%F{YELLOW}completing %B%d%b'$DEFAULT zstyle ':completion:*:options' description 'yes' zstyle ':completion:*:descriptions' format '%F{yellow}Completing %B%d%b%f'$DEFAULT zstyle ':completion:*' group-name ' setopt auto_list setopt list_packed autoload predict-on zle -N predict-on zle -N predict-off bindkey '^X^Z' predict-on bindkey '^Z' predict-off zstyle ':predict' verbose true ######################################## ## vcs_info autoload -Uz vcs_info autoload -Uz add-zsh-hook zstyle ':vcs_info:*' formats '%F{green}(%s)-[%b]%f' zstyle ':vcs_info:*' actionformats '%F{red}(%s)-[%b|%a]%f' function _update_vcs_info_msg() { LANG=en_US.UTF-8 vcs_info RPROMPT="${vcs_info_msg_0_}" } add-zsh-hook precmd _update_vcs_info_msg ######################################## ## options ## enable japanese letters setopt print_eight_bit setopt no_beep setopt no_flow_control setopt ignore_eof # after '#' treated as comments in terminal setopt interactive_comments # cd with only directory name setopt auto_cd setopt auto_pushd setopt pushd_ignore_dups setopt share_history setopt hist_ignore_all_dups setopt hist_ignore_space setopt hist_reduce_blanks setopt extended_glob setopt auto_menu # 補完キー連打で順に補完候補を自動で補完 setopt transient_rprompt ######################################## # キーバインド # ^R で履歴検索をするときに * でワイルドカードを使用出来るようにする bindkey '^R' history-incremental-pattern-search-backward ######################################## ## aliases alias la='ls -a' alias ll='ls -l' alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' alias mkdir='mkdir -p' #cd alias c='cd' alias c-='cd -' alias ..='cd ..' alias ...='cd ../..' alias ....='cd ../../..' alias .....='cd ../../../..' alias ......='cd ../../../../..' # grep alias gf='grep --with-filename --line-number' alias gr='grep --with-filename --line-number --recursive --exclude-dir=.svn' # enable aliases for sudo commands alias sudo='sudo ' alias -g L='| less' alias -g G='| grep' alias xcode="open -a Xcode" alias subl='open -a "Sublime Text"' # copy to clipboard by C # mollifier delta blog : http://mollifier.hatenablog.com/entry/20100317/p1 if which pbcopy >/dev/null 2>&1 ; then # Mac alias -g C='| pbcopy' elif which xsel >/dev/null 2>&1 ; then # Linux alias -g C='| xsel --input --clipboard' elif which putclip >/dev/null 2>&1 ; then # Cygwin alias -g C='| putclip' fi ######################################## # OS 別の設定 case ${OSTYPE} in darwin*) #Mac用の設定 export CLICOLOR=1 alias ls='ls -G -F' ;; linux*) #Linux用の設定 alias ls='ls -F --color=auto' ;; esac # vim:set ft=zsh: # source ~/.zsh.d/.git-flow-completion.zsh