3
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

posted at

updated at

zsh/bashのカスタマイズ

zsh

zshをデフォルトで使用

~/.zshrc
LANG=ja_JP.UTF-8

# 最新のディレクトリのみ表示
PS1="%1~ %(!.#.$) "

# ヒストリの設定
HISTFILE=~/.zsh_history
HISTSIZE=1000000
SAVEHIST=1000000

# cd した先のディレクトリをディレクトリスタック(履歴)に追加する
# `cd +<Tab>` でディレクトリの履歴(新しい順)が表示され、そこに移動できる
setopt AUTO_PUSHD

"~/.zshrc" 50L, 1110C

DIRSTACKSIZE=100

autoload -Uz compinit && compinit

zstyle ':completion:*' menu select
zstyle ':completion:*:cd:*' ignore-parents parent pwd
# zstyle ':completion:*:descriptions' format '%BCompleting%b %U%d%u'

# エイリアス設定
alias ls='ls -F'
alias la='ls -a'
alias ll='ls -l'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias mkdir='mkdir -p'

# ディレクトリ移動
alias ..='cd ../'
alias ...='cd ../..'
alias ....='cd ../../..'

# 関数
# 差分表示
function diff(){
        git diff $1 --name-only
}

# 差分のみでzipをつくる
function zip(){
        git diff $1 --name-only | xargs -I {} zip $1.zip {} -x .DS_Store
}

bash

~/.bash_profile
export PATH="$PATH:$HOME/bin"

if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi
~/.bashrc
LANG=ja_JP.UTF-8
PS1='\W \$ '
export LESS='--no-init'

set -o ignoreeof

# コマンド履歴設定
shopt -s histappend
HISTSIZE=1000000
HISTFILESIZE=1000000

※ 例えばaliasに登録したlsを一時的に無効に(本来のlsを実行)する場合はcommand ls もしくは \ls

参考
新しいLinuxの教科書

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
3
Help us understand the problem. What are the problem?