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

update from 98c409c to 63e4c62 #62

Merged
merged 10 commits into from
Nov 22, 2015
Prev Previous commit
Next Next commit
update from 98c409c to 63e4c6: A-git-in-other-envi
  • Loading branch information
pismute committed Nov 21, 2015
commit 76215952e58f92c58e60fe429da3433726d96a2c
43 changes: 35 additions & 8 deletions book/A-git-in-other-environments/sections/zsh.asc
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

(((zsh)))(((tab completion, zsh)))(((shell prompts, zsh)))
//////////////////////////
Git also ships with a tab-completion library for Zsh.
Just copy `contrib/completion/git-completion.zsh` to your home directory and source it from your `.zshrc`.
Zsh also ships with a tab-completion library for Git.
To use it, simply run `autoload -Uz compinit && compinit` in your `.zshrc`.
Zsh's interface is a bit more powerful than Bash's:
//////////////////////////
Git에는 Zsh용 탭 자동완성 스크립트도 들어 있다.
`contrib/completion/git-completion.zsh`를 홈 디렉토리에 복사하고 `.zshrc`에 설정(Source)한다.
Zsh에는 Git용 탭 자동완성 스크립트가 들어 있다.
`.zshrc` 파일에서 단순히 `autoload -Uz compinit && compinit` 명령을 실행하면 된다.
Zsh은 Bash보다 더 강력하다.

[source,console]
Expand All @@ -26,10 +26,10 @@ cherry-pick -- apply changes introduced by some existing commits

//////////////////////////
Ambiguous tab-completions aren't just listed; they have helpful descriptions, and you can graphically navigate the list by repeatedly hitting tab.
This works with Git commands, their arguments, and names of things inside the repository (like refs and remotes), as well filenames and all the other things Zsh knows how to tab-complete.
This works with Git commands, their arguments, and names of things inside the repository (like refs and remotes), as well as filenames and all the other things Zsh knows how to tab-complete.
//////////////////////////
Zsh은 선택지가 여러 개일 때 단순히 이름만 보여주지 않는다. 간단한 설명도 함께 보여주고 탭 키로 고를 수 있다.
Git 명령어만이 아니라 아규먼트도 자동완성해준다. 게다가 저장소의 리모트나 Refs같은 이름과 파일 이름 같은 것도 자동완성한다. Zsh은 아는 모든 것을 제시한다.
Git 명령어만이 아니라 아규먼트도 자동완성해준다. 게다가 저장소의 리모트나 Refs 이름과 파일 이름 같은 것도 자동완성한다. Zsh은 아는 모든 것을 제시한다.

//////////////////////////
Zsh happens to be fairly compatible with Bash when it comes to prompt customization, but it allows you to have a right-side prompt as well.
Expand All @@ -38,19 +38,32 @@ To include the branch name on the right side, add these lines to your `~/.zshrc`
Zsh 프롬프트는 Bash과 많이 비슷하지만 오른쪽 프롬프트가 더 있다.
오른쪽 프롬프트에 브랜치 이름을 나오게 하려면 `~/.zshrc` 파일에 아래 라인을 추가한다.

//////////////////////////
Zsh ships with a framework for getting information from version control systems, called `vcs_info`.
To include the branch name in the prompt on the right side, add these lines to your `~/.zshrc` file:
//////////////////////////
Zsh에는 `vcs_info`라는 프레임워크가 포함돼 있다. 여기에는 현재 사용하는 VCS정보가 들어있다.
`~/.zshrc` 파일에 아래 라인을 추가하면 오른쪽 프롬프트에 브랜치 이름이 표시된다.

[source,console]
----
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
setopt prompt_subst
. ~/git-prompt.sh
export RPROMPT=$'$(__git_ps1 "%s")'
RPROMPT=\$vcs_info_msg_0_
# PROMPT=\$vcs_info_msg_0_'%# '
zstyle ':vcs_info:git:*' formats '%b'
----

//////////////////////////
This results in a display of the current branch on the right-hand side of the terminal window, whenever your shell is inside a Git repository.
(The left side is supported as well, of course; just uncomment the assignment to PROMPT.)
It looks a bit like this:
//////////////////////////
쉘에서 Git 저장소 디렉토리로 이동하면 터미널 오른쪽에 현 브랜치 이름을
아래와 같이 보여준다.
(물론 주석 처리한 것만 돌리면 왼쪽 프롬프트에서도 잘 된다.)

//////////////////////////
.Customized `zsh` prompt.
Expand All @@ -59,6 +72,20 @@ image::images/zsh-prompt.png[Customized `zsh` prompt.]
.`zsh` 프롬프트 설정.
image::images/zsh-prompt.png[`zsh` 프롬프트 설정.]

//////////////////////////
For more information on vcs_info, check out its documentation
in the `zshcontrib(1)` manual page,
or online at http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Version-Control-Information[].
//////////////////////////
vcs_info에 대한 자세한 정보는 `zshcontrib(1)` 메뉴얼 페이지를 보거나
http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Version-Control-Information[]에서 확인한다.

//////////////////////////
Instead of vcs_info, you might prefer the prompt customization script that ships with Git, called `git-prompt.sh`; see http://git-prompt.sh[] for details.
`git-prompt.sh` is compatible with both Bash and Zsh.
//////////////////////////
vcs_info말고 Git에 들어 있는 `git-prompt.sh`를 직접 수정해서 사용해도 된다. 자세한 내용은 http://git-prompt.sh[]에서 확인한다. `git-prompt.sh`는 Bash와 Zsh 모두 호환된다.

//////////////////////////
Zsh is powerful enough that there are entire frameworks dedicated to making it better.
One of them is called "oh-my-zsh", and it can be found at https://github.com/robbyrussell/oh-my-zsh[].
Expand Down