Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 80326 Details for
Bug 123322
Proposal for Zsh guide section in Gentoo documentation
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Aspelling, history section has been added
zsh.xml (text/plain), 7.90 KB, created by
Henryk Konsek
on 2006-02-20 16:16:46 UTC
(
hide
)
Description:
Aspelling, history section has been added
Filename:
MIME Type:
Creator:
Henryk Konsek
Created:
2006-02-20 16:16:46 UTC
Size:
7.90 KB
patch
obsolete
><?xml version="1.0" encoding="UTF-8"?> ><!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> ><!-- $Header$ --> > ><guide link="/doc/en/zsh.xml" lang="en"> > ><title>zsh Configuration and Installation Guide</title> > ><author title="Author"> > <mail link="hak8@wp.pl">Henryk Konsek</mail> ></author> ><author title="Author"> > <mail link="morritt.andrew@gmail.com">Andrew Morritt</mail> ></author> ><author title="Editor"> > <mail link="chriswhite@gentoo.org">Chris White</mail> ></author> > ><abstract> >This guide shows how to install and configure zsh quickly. After >reading this document you will be able use such zsh features >as advanced tab-completion, command correction and prompt management. ></abstract> > ><!-- The content of this document is licensed under the CC-BY-SA license --> ><!-- See http://creativecommons.org/licenses/by-sa/2.5 --> ><license/> > ><version>1.4</version> ><date>2006-02-21</date> > ><chapter> ><title>Installation</title> ><section> ><title>Acquiring zsh</title> > ><body> ><p> >To install <c>zsh</c> under Gentoo we need to emerge <c>app-shells/zsh</c> >(<c>zsh</c> itself) and <c>app-shells/zsh-completion</c> (<c>zsh</c> >completion scripts) packages. ></p> > ><pre caption="Emerging zsh"> ># <i>emerge zsh zsh-completion</i> ></pre> > ></body> ></section> ></chapter> ><chapter> ><title>Configuration</title> ><section> ><title>Introduction</title> ><body> ><p> >After the installation, <c>zsh</c> seems to be very simple and rather limited >in the area of functionality. To change this, several configuration changes need >to be performed. ></p> ></body> ></section> ><section> ><title>Advanced Tab-completion</title> ><body> > ><p> >To enable the famous <c>zsh</c> tab-completion system, the following commands >must be entered: ></p> > ><pre caption="Enabling completion"> >% <i>autoload -U compinit</i> >% <i>compinit</i> ></pre> > ><p> >Default completion style is quite plain and ugly. If you want to improve >its appearance, enter the following commands: ></p> > ><pre caption="Completion style improvements"> >% <i>zstyle ':completion:*:descriptions' format '%U%B%d%b%u'</i> >% <i>zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'</i> ></pre> > ></body> ></section> ><section> ><title>Command correction</title> ><body> ><p> >It is also a good idea to enable the correction of the commands written under shell. ></p> > ><pre caption="Enabling correction"> >% <i>setopt correctall</i> ></pre> > ></body> ></section> ><section> ><title>Prompts</title> ><body> ><p> >The prompt may seem quite boring however, but we can fix it easily in several >steps. First, we need to initialize advanced prompt support: ></p> > ><pre caption="Enabling advanced prompts"> >% <i>autoload -U promptinit</i> >% <i>promptinit</i> ></pre> > ><p> >Available prompts samples may be printed via the <c>prompt -p</c> command. Now >we can activate our favorite one: ></p> > ><pre caption="Choosing a sample prompt"> ><comment>(Replace oliver with the prompt of your choice)</comment> >% <i>prompt oliver</i> ></pre> > ><p> >Another option is to create your own prompt. To do this you will need to set the PS1 environment variable. ></p> > ><pre caption="A simple custom prompt"> >% <i>export PS1="[Test Prompt] > "</i> >[Test Prompt] > ></pre> > ><p>While it is good to be able to create a custom text prompt, <c>zsh</c> also provides many escape sequences that allow system information to be inserted into the prompt. Some of the escape sequences available are:</p> > ><table> ><tr><th>Sequence</th><th>Printed</th></tr> ><tr><ti>%T</ti><ti>System time (HH:MM)</ti></tr> ><tr><ti>%*</ti><ti>System time (HH:MM:SS)</ti></tr> ><tr><ti>%D</ti><ti>System date (YY-MM-DD)</ti></tr> ><tr><ti>%n</ti><ti>Your username</ti></tr> ><tr><ti>%B - %b</ti><ti>Begin - end bold print</ti></tr> ><tr><ti>%U - %u</ti><ti>Begin - end underlining</ti></tr> ><tr><ti>%d</ti><ti>Your current working directory</ti></tr> ><tr><ti>%~</ti><ti>Your current working directory, relative to ~</ti></tr> ><tr><ti>%M</ti><ti>The server's hostname</ti></tr> ><tr><ti>%m</ti><ti>There server's hostname (trunucated before the first period)</ti></tr> ><tr><ti>%l</ti><ti>Your current tty</ti></tr> ></table> > ><p>These escape sequences may simply be inserted into the the environment variable, PS1, and <c>zsh</c> will parse them automatically.</p> > ><pre caption="A more complex prompt"> >% export PS1="[%* - %D] %d %% " >[08:44:23 - 06-02-18] /home/username % ></pre> > ></body> ></section> > ><section> ><title>History</title> ><body> >Unfortunately default <c>zsh</c> configuration in Gentoo does not include commands >history support. Due to the fact that working with a shell with history >disabled is far more than frustrating, we should enter the following >commands: > ><pre caption="Basic history configuration"> >% <i>export HISTSIZE=2000</i> >% <i>export HISTFILE="$HOME/.history"</i> > ><comment>(otherwise history won't be saved)</comment> >% <i>export SAVEHIST=$HISTSIZE</i> ></pre> > >It is very comfortable to search commands in history using up/down >arrow keys, especially after typing few first letters of desired command >under shell. For example: > ><pre caption="History searching based on the first letters of the commands"> ><comment>(Do not press Enter after typing)</comment> >% <i>vim /etc/</i> ><comment>(Now press up arrow key)</comment> >% <i>vim /etc/fstab</i> ><comment>(Press up arrow key once again)</comment> >% <i>vim /etc/X11/xorg.conf</i> ></pre> > ><p> >To enable the feature above enter the following commands: ></p> > ><pre caption="Setting context searching"> >% <i>bindkey `tput kcuu1` history-beginning-search-backward >/dev/null 2>&1</i> >% <i>bindkey `tput kcud1` history-beginning-search-forward >/dev/null 2>&1 </i> ></pre> > ><p> >To prevent history from recording duplicated entries (such as <c>ls >-l</c> entered many times during single shell session) set ><c>hist_ignore_all_dups</c> option. ></p> > ><pre caption="Setting ignoring of duplicates "> >% <i>setopt hist_ignore_all_dups</i> ></pre> > ><p> >Is also a useful trick to prevent particular entries from being recorded >into a history by preceding them with at least one space. ></p> > ><pre caption="Preventing particular entry from being recorded"> >% <i>setopt hist_ignore_space</i> > ><comment>(This command won't be recorded. Note an extra space before it.)</comment> >% <i> cat /proc/i/do/not/want/to/remember</i> ></pre> > > ></body> ></section> > ><section> ><title>Miscellaneous settings</title> ><body> > ><p> >You can set <c>autocd</c> option if you want to avoid tedious typing of ><c>cd</c> command while changing current directory (for example ><c>/etc</c> instead of <c>cd /etc</c>). ></p> > ><pre caption="Setting autocd option"> >% <i>setopt autocd</i> ></pre> > ><p> >If standard bash-like globbing does not satisfy you, <c>extendedglob</c> >option may be set to enable extended globbing (one similar to >regular expressions). ></p> > ><pre caption="Setting extended globbing"> >% <i>setopt extendedglob</i> ></pre> > ><p> >When option above is set, you are able to use extended globbing queries >such as <c>cp ^*.(tar|bz2|gz)</c>. ></p> > ></body> ></section> > ></chapter> ><chapter> ><title>Saving settings</title> ><section> ><title>Saving zsh settings</title> ><body> ><p> >Once we have customized <c>zsh</c> the way we like it, it is a good idea to save these options as a <c>zsh</c> defaults for the system. >One possible way to achieve this is to write our settings in the ><path>/etc/zsh/zshrc</path> script. Alternatively, we could make them the defaults for our account only be editing <path>~/.zshrc</path>. ></p> > ><pre caption="An example zshrc"> >#!/bin/zsh > ># completion >autoload -U compinit >compinit > ># correction >setopt correctall > ># prompt >autoload -U promptinit >promptinit >prompt oliver ></pre> > ><p> >The last thing we need to do is set the zshrc script as >executable: ></p> > ><pre caption="Making zshrc executable"> >% <i>chmod a+x /etc/zsh/zshrc</i> ></pre> ></body> ></section> ></chapter> ></guide>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 123322
:
80129
|
80133
|
80134
|
80144
|
80319
|
80320
|
80326
|
80327
|
93612
|
95857
|
95873