# ZSH

Основная информация в [wiki Arch Linux](https://wiki.archlinux.org/title/Zsh).

## Установка

```shell
pikaur -S zsh zsh-completions
```

Установить `zsh` оболочкой по умолчанию (потребуется ввести пароль пользователя):

```shell
chsh -s /bin/zsh
```

Скопировать всё необходимое из `.bashrc` в `.zshrc` и из `.bash_profile` в `.zprofile`.

[Установить шрифты](https://kb.fallback.ru/books/arch-linux/page/nastroika-sriftov "Настройка шрифтов") (обязательно `ttf-meslo-nerd-font-powerlevel10k`) и настроить шрифт в терминале (см. [инструкцию](https://github.com/romkatv/powerlevel10k?tab=readme-ov-file#meslo-nerd-font-patched-for-powerlevel10k)).

## Oh My ZSH и Powerlevel10k

Установить <span class="s1">[фреймворк Oh My Zsh](https://github.com/ohmyzsh/ohmyzsh) и [тему Powerlevel10k](https://github.com/romkatv/powerlevel10k):</span>

```shell
pikaur -S oh-my-zsh-git zsh-theme-powerlevel10k-git
```

Установить (переопределить) в `.zshrc` переменную `ZSH`:

```
# Path to your oh-my-zsh installation.
export ZSH="/usr/share/oh-my-zsh"
```

Подключить тему в `.zshrc`:

```
#ZSH_THEME="robbyrussell"
source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme
```

Запустить `zsh` и выполнить предложенную настройку темы.

## Подсветка синтаксиса и автодополнение

Установить дополнения:

```shell
pikaur -S zsh-syntax-highlighting zsh-autosuggestions
```

Добавить в `.zshrc`:

```
# Fish-like syntax highlighting and autosuggestions
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
```

## Обработка неизвестных команд

Подробнее см. в [wiki Arch Linux](https://wiki.archlinux.org/title/Pkgfile).

Установить `pkgfile`:

```shell
pikaur -S pkgfile
```

Инициализировать базу данных:

```
sudo pkgfile --update
```

Включить автоматическое обновление базы:

```shell
sudo systemctl enable pkgfile-update.timer
sudo systemctl start pkgfile-update.timer
```

Добавить в `.zshrc`:

```
# pkgfile "command not found" handler
source /usr/share/doc/pkgfile/command-not-found.zsh
```

## Включение плагинов

Включить плагин sudo (добавление команды `sudo` в по двойному ESC) в .zshrc:

```
plugins=(git sudo)
```