Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use zsh #12

Merged
merged 13 commits into from
Sep 13, 2014
Merged

Use zsh #12

merged 13 commits into from
Sep 13, 2014

Conversation

takatoshiono
Copy link
Owner

やりたいこと

そろそろ zsh を使おうかと思った

TO-DO

  • やったことを記録しておく
  • zsh をインストールする
  • 必要な設定をする
  • oh-my-zsh を入れる
  • zsh をログインシェルにする

oh-my-zsh は別のプルリクで導入する予定

@takatoshiono
Copy link
Owner Author

Install

[usr0600268@pmac056s .dotfiles (use-zsh)]$ brew info zsh
zsh: stable 5.0.6 (bottled)
http://www.zsh.org/
Not installed
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/zsh.rb
==> Dependencies
Required: gdbm ✘, pcre ✔
==> Options
--disable-etcdir
        Disable the reading of Zsh rc files in /etc
==> Caveats
Add the following to your zshrc to access the online help:
  unalias run-help
  autoload run-help
  HELPDIR=/usr/local/share/zsh/help
[usr0600268@pmac056s .dotfiles (use-zsh)]$ brew install zsh
==> Installing zsh dependency: gdbm
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/gdbm-1.11.mountain_lion.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gdbm-1.11.mountain_lion.bottle.tar.gz
�  /usr/local/Cellar/gdbm/1.11: 16 files, 420K
==> Installing zsh
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/zsh-5.0.6.mountain_lion.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring zsh-5.0.6.mountain_lion.bottle.1.tar.gz
==> Caveats
Add the following to your zshrc to access the online help:
  unalias run-help
  autoload run-help
  HELPDIR=/usr/local/share/zsh/help
==> Summary
�  /usr/local/Cellar/zsh/5.0.6: 1084 files, 11M

@takatoshiono
Copy link
Owner Author

起動してみた

[usr0600268@PMAC056S ~]$ zsh
This is the Z Shell configuration function for new users,
zsh-newuser-install.
You are seeing this message because you have no zsh startup files
(the files .zshenv, .zprofile, .zshrc, .zlogin in the directory
~).  This function can help you with a few settings that should
make your use of the shell easier.

You can:

(q)  Quit and do nothing.  The function will be run again next time.

(0)  Exit, creating the file ~/.zshrc containing just a comment.
     That will prevent this function being run again.

(1)  Continue to the main menu.

--- Type one of the keys in parentheses --- 

1 を入力

Please pick one of the following options:

(1)  Configure settings for history, i.e. command lines remembered
     and saved by the shell.  (Recommended.)

(2)  Configure the new completion system.  (Recommended.)

(3)  Configure how keys behave when editing command lines.  (Recommended.)

(4)  Pick some of the more common shell options.  These are simple "on"
     or "off" switches controlling the shell's features.  

(0)  Exit, creating a blank ~/.zshrc file.

(a)  Abort all settings and start from scratch.  Note this will overwrite
     any settings from zsh-newuser-install already in the startup file.
     It will not alter any of your other settings, however.

(q)  Quit and do nothing else.  The function will be run again next time.
--- Type one of the keys in parentheses --- 

4 を入力

Common shell options
====================

The following are some of the shell options that are most often used.
The descriptions are very brief; if you would like more information,
read the zshoptions manual page (type "man zshoptions").

# (1) Change directory given just path.
# unsetopt autocd                                                                                                                                                                                                                                                (no value set)
# (2) Use additional pattern matching features.
# unsetopt extendedglob                                                                                                                                                                                                                                          (no value set)
# (3) Append new history lines instead of overwriting.
# unsetopt appendhistory                                                                                                                                                                                                                                         (no value set)
# (4) Unmatched patterns cause an error.
# setopt nomatch                                                                                                                                                                                                                                                 (no value set)
# (5) Beep on errors.
# setopt beep                                                                                                                                                                                                                                                    (no value set)
# (6) Immediately report changes in background job status.
# unsetopt notify                                                                                                                                                                                                                                                (no value set)

# (0) or (q)  Return to main menu (no changes made yet)

--- Type one of the keys in parentheses --- 

q --> 1

History configuration
=====================

# (1) Number of lines of history kept within the shell.
HISTSIZE=1000                                                                                                                                                                                                                                                   (not yet saved)
# (2) File where history is saved.
HISTFILE=~/.histfile                                                                                                                                                                                                                                            (not yet saved)
# (3) Number of lines of history to save to $HISTFILE.
SAVEHIST=1000                                                                                                                                                                                                                                                   (not yet saved)

# (0)  Remember edits and return to main menu (does not save file yet)
# (q)  Abandon edits and return to main menu

--- Type one of the keys in parentheses --- 

0 --> 2

The new completion system (compsys) allows you to complete
commands, arguments and special shell syntax such as variables.  It provides
completions for a wide range of commonly used commands in most cases simply
by typing the TAB key.  Documentation is in the zshcompsys manual page.
If it is not turned on, only a few simple completions such as filenames
are available but the time to start the shell is slightly shorter.

You can:
  (1)  Turn on completion with the default options.

  (2)  Run the configuration tool (compinstall).  You can also run
       this from the command line with the following commands:
        autoload -Uz compinstall
        compinstall
       if you don't want to configure completion now.

  (0)  Don't turn on completion.

--- Type one of the keys in parentheses --- 

1 --> 3

Default editing configuration
=============================

The keys in the shell's line editor can be made to behave either
like Emacs or like Vi, two common Unix editors.  If you have no
experience of either, Emacs is recommended.  If you don't pick one,
the shell will try to guess based on the EDITOR environment variable.
Usually it's better to pick one explicitly.

# (1) Change default editing configuration
bindkey -e                                                                                                                                                                                                                                                      (not yet saved)

# (0)  Remember edits and return to main menu (does not save file yet)
# (q)  Abandon edits and return to main menu

--- Type one of the keys in parentheses --- 1
Pick a keymap (set of keys) to use when editing.
Type:
  (e) for Emacs keymap (recommended unless you are vi user)
  (v) for Vi keymap
  (n) not to set a keymap (allow shell to choose)
  (k) to keep the current setting, (e):
--- Type one of the keys in parentheses ---

1 --> e --> 0 --> 0

The function will not be run in future, but you can run
it yourself as follows:
  autoload -Uz zsh-newuser-install
  zsh-newuser-install -f

The code added to ~/.zshrc is marked by the lines
# Lines configured by zsh-newuser-install
# End of lines configured by zsh-newuser-install
You should not edit anything between these lines if you intend to
run zsh-newuser-install again.  You may, however, edit any other part
of the file.
PMAC056S% 

ふぅ、起動しただけで疲れた...

Configured by zsh-newuser-install
@takatoshiono
Copy link
Owner Author

env

PMAC056S% echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/usr0600268/.rbenv/shims:/Users/usr0600268/.rbenv/bin:/Users/usr0600268/.composer/vendor/bin:/usr/local/heroku/bin:/Users/usr0600268/perl5/perlbrew/bin:/Users/usr0600268/perl5/perlbrew/perls/perl-5.8.8/bin:/Users/usr0600268/bin
PMAC056S% env
MANPATH=/usr/share/man:/usr/local/share/man:/Users/usr0600268/perl5/perlbrew/perls/perl-5.8.8/man:/usr/local/share/man/ja
PERLBREW_VERSION=0.58
TERM_PROGRAM=Apple_Terminal
PERLBREW_PERL=perl-5.8.8
TERM=xterm-256color
SHELL=/bin/bash
TMPDIR=/var/folders/v_/2m54czdx5t77mrhb9w179mf40000gn/T/
Apple_PubSub_Socket_Render=/tmp/launch-F5VlbN/Render
TERM_PROGRAM_VERSION=309
TERM_SESSION_ID=7254085A-F5B6-41C3-8487-63DCEB86D1A5
USER=usr0600268
COMMAND_MODE=unix2003
PERLBREW_BASHRC_VERSION=0.58
SSH_AUTH_SOCK=/tmp/launch-zWzW3Z/Listeners
__CF_USER_TEXT_ENCODING=0x1F5:1:14
Apple_Ubiquity_Message=/tmp/launch-MLCdzp/Apple_Ubiquity_Message
PERLBREW_ROOT=/Users/usr0600268/perl5/perlbrew
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/usr0600268/.rbenv/shims:/Users/usr0600268/.rbenv/bin:/Users/usr0600268/.composer/vendor/bin:/usr/local/heroku/bin:/Users/usr0600268/perl5/perlbrew/bin:/Users/usr0600268/perl5/perlbrew/perls/perl-5.8.8/bin:/Users/usr0600268/bin
PWD=/Users/usr0600268
EDITOR=/usr/bin/vi
LANG=ja_JP.UTF-8
PERLBREW_HOME=/Users/usr0600268/.perlbrew
FS_TRASHER_SOCKET=/tmp/launch-PlWiA1/ListeningSocket
SHLVL=2
HOME=/Users/usr0600268
PERLBREW_MANPATH=/Users/usr0600268/perl5/perlbrew/perls/perl-5.8.8/man
PERLBREW_PATH=/Users/usr0600268/perl5/perlbrew/bin:/Users/usr0600268/perl5/perlbrew/perls/perl-5.8.8/bin
LOGNAME=usr0600268
GOPATH=/Users/usr0600268
SECURITYSESSIONID=186a5
_=/usr/bin/env
OLDPWD=/Users/usr0600268

@takatoshiono
Copy link
Owner Author

必要な設定をする

「必要な設定」とは?
というか、それを楽しよういうのが oh-my-zsh なのだから、それを入れればいいのでは

@takatoshiono
Copy link
Owner Author

oh-my-zsh を入れてみた
テンプレの zshrc をコピペしただけだけど、見た目すごいかわって、alias もいろいろ定義されていた(特に git 系が多いかな?)

@takatoshiono
Copy link
Owner Author

あと MacVim を使うように設定が必要

@takatoshiono
Copy link
Owner Author

以下をやった

  • /etc/shells/usr/local/bin/zshを追加
  • シェルを変更
$ chpass -s /usr/local/bin/zsh

@takatoshiono
Copy link
Owner Author

そろそろマージしようかな

@takatoshiono takatoshiono changed the title [WIP] Use zsh Use zsh Sep 13, 2014
takatoshiono added a commit that referenced this pull request Sep 13, 2014
@takatoshiono takatoshiono merged commit bb119c3 into master Sep 13, 2014
@takatoshiono takatoshiono deleted the use-zsh branch September 13, 2014 14:50
@takatoshiono takatoshiono mentioned this pull request Sep 13, 2014
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant