Zsh

De Linuxmemo.

Sommaire

[modifier] Install

apt-get install zsh
chsh -s /bin/zsh

[modifier] Config

~/.zshrc

[modifier] "oh-my-zsh"

.zshrc tout prèt et ultra complet (thèmes, plugins...)

  • url site

http://ohmyz.sh/

  • install
via curl
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
via wget
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
Clonage Git dans '/home/user/.oh-my-zsh'...
Looking for an existing zsh config...
Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh
Using the Oh My Zsh template file and adding it to ~/.zshrc
Copying your current PATH and adding it to the end of ~/.zshrc for you.
Time to change your default shell to zsh!
  • Acitivation des Thèmes et des plugins

Via ~/.zshrc

  • liste des thèmes

https://github.com/robbyrussell/oh-my-zsh/wiki/Themes

  • Liste des plugins

https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins

[modifier] Utilisation

[modifier] changement de rep via menu

<tab> + <tab> + flèches

[modifier] complétion sur path

cd /u/lo/sh <Tab> ( deviens /usr/local/share )

[modifier] les alias

-='cd -'
...=../..
....=../../..
.....=../../../..
......=../../../../..
1='cd -'
2='cd -2'
3='cd -3'
4='cd -4'
5='cd -5'
6='cd -6'
7='cd -7'
8='cd -8'
9='cd -9'

[modifier] dernière commande

début de la commande déjà tapée + flèche haute (puis remonter dans l'historique)

[modifier] remplacement de variable

${HOME} + <Tab>
/home/user

[modifier] options des commandes

kill - <Tab>

[modifier] recherche de fichiers par filtre

*(<filtre>)
**/*(<filtre>)
ls **/*(mh-1)

http://zsh.sourceforge.net/Doc/Release/Expansion.html#Filename-Generation

[modifier] identifiants de commande

kill + <Tab> <Tab>
fonctionne avec  jobs bg ...

[modifier] historique des commandes

!!
!-2
!-3

[modifier] Thème Powerlevel9k

git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k
sudo apt install fonts-powerline
vim ~/.zshrc
export TERM="xterm-256color"
ZSH_THEME="powerlevel9k/powerlevel9k"
source ~/.zshrc
Outils personnels