64
54

More than 5 years have passed since last update.

毎度毎度cdとlsを打つ悲劇をなくすために.zshrcさらす

Posted at

おすすめの設定があったら教えてください。

一番気に入っている設定

cdなしでディレクトリ名を直接指定して移動し、移動後自動でlsする

setopt auto_cd
function chpwd() { ls }

自分のzshrc

## Environment variable configuration
#
# LANG
#文字コード設定
export LANG=ja_JP.UTF-8

# auto directory pushd that you can get dirs list by cd -[tab]
#  historyの自動保管
#  cd -[tab]でcdのhistoryを閲覧できる
#setopt auto_pushd

# command correct edition before each completion attempt
#コマンドをtypoしたときに聞きなおしてくれる
setopt correct

# compacked complete list display
#表示を詰めてくれる
setopt list_packed

# no beep sound when complete list displayed
#beepを消す
setopt nolistbeep

## Keybind configuration
#
# vim like keybind (e.x. Ctrl-a goes to head of a line and Ctrl-e goes 
#   to end of it)
#vimライクに入力をできる(コマンドモードや入力モードがある)
#ddとかもつかえる
bindkey -v

# historical backward/forward search with linehead string binded to ^P/^N
#history系の設定
#autoload history-search-end
#zle -N history-beginning-search-backward-end history-search-end
#zle -N history-beginning-search-forward-end history-search-end
#bindkey "^P" history-beginning-search-backward-end
#bindkey "^N" history-beginning-search-forward-end

## Command history configuration
#
#HISTFILE=~/.zsh_history
#HISTSIZE=100
#SAVEHIST=100
#setopt hist_ignore_dups     # ignore duplication command history list
#setopt share_history        # share command history data

## Completion configuration
#
#予測変換
autoload predict-on
predict-on

autoload -U compinit
compinit

PROMPT="%/%% "
PROMPT2="%_%% "
SPROMPT="%r is correct? [n,y,a,e]:] "
#ls色付け
export LSCOLORS=exfxcxdxbxegedabagacad
export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'

#便利aliasたち
alias ls="ls -G -w"
alias gls="gls --color"
alias where="command -v"
alias j="jobs -l"
alias la="ls -a"
alias lf="ls -F"
alias ll="ls -l"

alias du="du -h"
alias df="df -h"

alias su="su -l"
#保管色付け
zstyle ':completion:*' list-colors 'di=34' 'ln=35' 'so=32' 'ex=31' 'bd=46;34' 'cd=43;34'

#cdとlsの省略
setopt auto_cd
function chpwd() { ls }

#
# Goolge Search by Google Chrome
# terminalからググったりqiita検索をできる
#
google() {
    local str opt
    if [ $# != 0 ]; then
        for i in $*; do
            # $strが空じゃない場合、検索ワードを+記号でつなぐ(and検索)
            str="$str${str:++}$i"
        done
        opt='search?num=100'
        opt="${opt}&q=${str}"
    fi
    open -a Google\ Chrome http://www.google.co.jp/$opt
}

qiita() {
    local str opt
    if [ $# != 0 ]; then
        for i in $*; do
            # $strが空じゃない場合、検索ワードを+記号でつなぐ(and検索)
            str="$str${str:++}$i"
        done
        opt='search?num=100'
        opt="${opt}&q=${str}"
    fi
    open -a Google\ Chrome http://qiita.com/$opt
}

参考

漢のzsh
http://news.mynavi.jp/column/zsh/001/index.html

cd後に自動でls
http://d.hatena.ne.jp/shichiseki/20071230/1199008858

64
54
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
64
54