Переход на zcomet
This commit is contained in:
parent
b3d70173c1
commit
31e1dface0
8
.zshenv
8
.zshenv
@ -1,3 +1,11 @@
|
||||
# Запрет чтения настроек из системного каталога /etc
|
||||
unsetopt GLOBAL_RCS
|
||||
|
||||
# Базовые каталоги
|
||||
export XDG_CONFIG_HOME="$HOME/.config"
|
||||
export XDG_CACHE_HOME="$HOME/.cache"
|
||||
export XDG_DATA_HOME="$HOME/.local/share"
|
||||
|
||||
export ZSH_CACHE_DIR="$XDG_CACHE_HOME/zsh"
|
||||
export ZSH_COMPDUMP="$ZSH_CACHE_DIR/zcompdump-${HOST/.*/}-$ZSH_VERSION"
|
||||
|
||||
|
15
.zshrc
15
.zshrc
@ -1,22 +1,15 @@
|
||||
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh/.zshrc.
|
||||
# Initialization code that may require console input (password prompts, [y/n]
|
||||
# confirmations, etc.) must go above this block; everything else may go below.
|
||||
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
||||
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
|
||||
fi
|
||||
|
||||
for S in \
|
||||
05-start \
|
||||
15-env \
|
||||
25-history \
|
||||
35-options \
|
||||
42-zcomet \
|
||||
45-prompt \
|
||||
48-plugins \
|
||||
55-agents \
|
||||
65-scripts \
|
||||
75-aliases \
|
||||
82-plugins \
|
||||
85-compinit \
|
||||
88-ohmyzsh \
|
||||
85-completion \
|
||||
95-finish
|
||||
do
|
||||
N="${S//[0-9\-]/}"
|
||||
@ -28,4 +21,4 @@ do
|
||||
done
|
||||
|
||||
# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
|
||||
[[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh
|
||||
[[ ! -f "${ZDOTDIR}/.p10k.zsh" ]] || source "${ZDOTDIR}/.p10k.zsh"
|
||||
|
@ -1,8 +0,0 @@
|
||||
function add_custom_plugin()
|
||||
{
|
||||
if [ ! -d "$ZSH_CUSTOM/plugins/$2" ]; then
|
||||
git clone "$1" "$ZSH_CUSTOM/plugins/$2"
|
||||
fi
|
||||
plugins+=($2)
|
||||
}
|
||||
|
14
15-env.zsh
14
15-env.zsh
@ -1,17 +1,3 @@
|
||||
export XDG_CONFIG_HOME="$HOME/.config"
|
||||
export XDG_CACHE_HOME="$HOME/.cache"
|
||||
export XDG_DATA_HOME="$HOME/.local/share"
|
||||
|
||||
export ZSH_CACHE_DIR="$XDG_CACHE_HOME/zsh"
|
||||
export ZSH="$ZSH_CACHE_DIR/ohmyzsh"
|
||||
export ZSH_CUSTOM="$ZSH_CACHE_DIR/custom"
|
||||
export ZSH_COMPDUMP="${ZSH_CACHE_DIR}/zcompdump-${HOST/.*/}-${ZSH_VERSION}"
|
||||
plugins=()
|
||||
|
||||
if ps $PPID | grep mc; then
|
||||
export ZSH_IS_SUBSHELL=1
|
||||
fi
|
||||
|
||||
# PATH
|
||||
for P in \
|
||||
"$HOME/bin" \
|
||||
|
@ -2,7 +2,7 @@ setopt AUTO_PUSHD # Push the current directory visited on the stack.
|
||||
setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack.
|
||||
setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd.
|
||||
|
||||
autoload -Uz allopt zed zmv zcalc colors
|
||||
autoload -Uz allopt zed zmv zcalc colors is-at-least
|
||||
colors
|
||||
|
||||
zmodload zsh/terminfo
|
||||
@ -14,6 +14,10 @@ bindkey -M vicmd v edit-command-line
|
||||
autoload -Uz select-word-style
|
||||
select-word-style shell
|
||||
|
||||
if is-at-least 5.1; then
|
||||
autoload -Uz bracketed-paste-magic
|
||||
zle -N bracketed-paste bracketed-paste-magic
|
||||
fi
|
||||
autoload -Uz url-quote-magic
|
||||
zle -N self-insert url-quote-magic
|
||||
|
||||
|
13
42-zcomet.zsh
Normal file
13
42-zcomet.zsh
Normal file
@ -0,0 +1,13 @@
|
||||
export ZCOMET_DIR="${ZSH_CACHE_DIR}/zcomet"
|
||||
|
||||
zstyle ':zcomet:*' home-dir "${ZCOMET_DIR}"
|
||||
zstyle ':zcomet:*' repos-dir "${ZCOMET_DIR}/repos"
|
||||
zstyle ':zcomet:*' snippets-dir "${ZCOMET_DIR}/snippets"
|
||||
zstyle ':zcomet:compinit' dump-file "${ZSH_COMPDUMP}"
|
||||
|
||||
#
|
||||
if [[ ! -f "${ZCOMET_DIR}/bin/zcomet.zsh" ]]; then
|
||||
command git clone --depth=1 https://github.com/agkozak/zcomet.git "${ZCOMET_DIR}/bin"
|
||||
fi
|
||||
source "${ZCOMET_DIR}/bin/zcomet.zsh"
|
||||
|
@ -1,40 +1,12 @@
|
||||
# Theme
|
||||
# Install powerline font
|
||||
SPACESHIP_PROMPT_ORDER=(
|
||||
user # Username section
|
||||
dir # Current directory section
|
||||
host # Hostname section
|
||||
git # Git section (git_branch + git_status)
|
||||
hg # Mercurial section (hg_branch + hg_status)
|
||||
exec_time # Execution time
|
||||
line_sep # Line break
|
||||
vi_mode # Vi-mode indicator
|
||||
jobs # Background jobs indicator
|
||||
exit_code # Exit code section
|
||||
char # Prompt character
|
||||
)
|
||||
|
||||
|
||||
SPACESHIP_PROMPT_ADD_NEWLINE=false
|
||||
SPACESHIP_PROMPT_SEPARATE_LINE=false
|
||||
SPACESHIP_CHAR_SYMBOL="❯"
|
||||
SPACESHIP_CHAR_SUFFIX=" "
|
||||
|
||||
# Simplify prompt if we're using Hyper
|
||||
if [[ "$TERM_PROGRAM" == "Hyper" ]]; then
|
||||
SPACESHIP_PROMPT_SEPARATE_LINE=false
|
||||
SPACESHIP_DIR_SHOW=false
|
||||
SPACESHIP_GIT_BRANCH_SHOW=false
|
||||
fi
|
||||
|
||||
autoload -Uz is-at-least
|
||||
if is-at-least "5.1" "$ZSH_VERSION"; then
|
||||
ZSH_THEME="powerlevel10k"
|
||||
if [ ! -d "$ZSH_CUSTOM/themes/${ZSH_THEME}" ]; then
|
||||
git clone --depth=1 https://github.com/romkatv/powerlevel10k "$ZSH_CUSTOM/themes/${ZSH_THEME}"
|
||||
ln -s "${ZSH_CUSTOM}/themes/${ZSH_THEME}/${ZSH_THEME}.zsh-theme" "${ZSH_CUSTOM}/themes/${ZSH_THEME}.zsh-theme"
|
||||
if is-at-least 5.1; then
|
||||
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
|
||||
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
|
||||
fi
|
||||
else
|
||||
ZSH_THEME="eastwood"
|
||||
fi
|
||||
|
||||
if [[ ! -f "${ZCOMET_DIR}/prompt/powerlevel10k/powerlevel10k.zsh-theme" ]]; then
|
||||
command git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZCOMET_DIR}/prompt/powerlevel10k"
|
||||
fi
|
||||
source "${ZCOMET_DIR}/prompt/powerlevel10k/powerlevel10k.zsh-theme"
|
||||
else
|
||||
zcomet load agkozak/agkozak-zsh-prompt
|
||||
fi
|
||||
|
70
48-plugins.zsh
Normal file
70
48-plugins.zsh
Normal file
@ -0,0 +1,70 @@
|
||||
zcomet trigger zhooks agkozak/zhooks
|
||||
|
||||
zcomet load willghatch/zsh-saneopt
|
||||
zcomet load mafredri/zsh-async
|
||||
zcomet load djui/alias-tips
|
||||
|
||||
export ZSHZ_CASE=smart
|
||||
export ZSHZ_DATA="${ZSH_CACHE_DIR}/z"
|
||||
zcomet load agkozak/zsh-z
|
||||
|
||||
if [[ "$DISPLAY" != '' ]] && command -v xdotool > /dev/null 2>&1 && command -v wmctrl > /dev/null 2>&1; then
|
||||
zstyle ':notify:*' expire-time 5000
|
||||
zstyle ':notify:*' command-complete-timeout 20
|
||||
zstyle ':notify:*' enable-on-ssh yes
|
||||
zcomet load marzocchi/zsh-notify
|
||||
fi
|
||||
if command -v peco > /dev/null 2>&1; then
|
||||
zcomet load jimeh/zsh-peco-history
|
||||
fi
|
||||
|
||||
zcomet load ohmyzsh plugins/autojump
|
||||
zcomet load ohmyzsh plugins/command-not-found
|
||||
zcomet load ohmyzsh plugins/common-aliases
|
||||
zcomet load ohmyzsh plugins/debian
|
||||
zcomet load ohmyzsh plugins/isodate
|
||||
zcomet load ohmyzsh plugins/nmap
|
||||
zcomet load ohmyzsh plugins/rsync
|
||||
zcomet load ohmyzsh plugins/systemadmin
|
||||
zcomet load ohmyzsh plugins/web-search
|
||||
|
||||
if command -v fzf > /dev/null 2>&1; then
|
||||
zcomet load junegunn/fzf shell completion.zsh key-bindings.zsh
|
||||
(( ${+commands[fzf]} )) || ~[fzf]/install --bin
|
||||
fi
|
||||
if command -v git > /dev/null 2>&1; then
|
||||
GIT_AUTO_FETCH_INTERVAL=3600
|
||||
zcomet load ohmyzsh plugins/git
|
||||
zcomet load ohmyzsh plugins/gitfast
|
||||
zcomet load ohmyzsh plugins/git-auto-fetch
|
||||
zcomet load ohmyzsh plugins/git-extras
|
||||
zcomet load ohmyzsh plugins/github
|
||||
zcomet load paulirish/git-open
|
||||
fi
|
||||
if command -v grc > /dev/null 2>&1; then
|
||||
zcomet load ohmyzsh plugins/grc
|
||||
fi
|
||||
if command -v psql > /dev/null 2>&1; then
|
||||
zcomet load ohmyzsh plugins/postgres
|
||||
fi
|
||||
if command -v sudo > /dev/null 2>&1; then
|
||||
zcomet load ohmyzsh plugins/sudo
|
||||
fi
|
||||
if command -v systemctl > /dev/null 2>&1; then
|
||||
zcomet load ohmyzsh plugins/systemd
|
||||
fi
|
||||
if command -v vim > /dev/null 2>&1; then
|
||||
zcomet load ohmyzsh plugins/vim-interaction
|
||||
fi
|
||||
if command -v tmux > /dev/null 2>&1; then
|
||||
zcomet load ohmyzsh plugins/tmux
|
||||
zstyle ':prezto:module:tmux:auto-start' local 'no'
|
||||
zstyle ':prezto:module:tmux:auto-start' remote 'yes'
|
||||
zstyle ':prezto:module:tmux:session' name "$(hostname)"
|
||||
zcomet load laggardkernel/zsh-tmux
|
||||
zcomet snippet https://github.com/jreese/zsh-titles/blob/master/titles.plugin.zsh
|
||||
fi
|
||||
if command -v kitty > /dev/null 2>&1; then
|
||||
zcomet load redxtech/zsh-kitty
|
||||
fi
|
||||
|
@ -6,12 +6,12 @@
|
||||
# zstyle :omz:plugins:ssh-agent agent-forwarding on
|
||||
# zstyle :omz:plugins:ssh-agent identities id_rsa
|
||||
# zstyle :omz:plugins:ssh-agent lifetime 10h
|
||||
# plugins+=(ssh-agent)
|
||||
# zcomet load ohmyzsh plugins/ssh-agent
|
||||
|
||||
##
|
||||
# GPG agent
|
||||
##
|
||||
# plugins+=(gpg-agent)
|
||||
# zcomet load ohmyzsh plugins/gpg-agent
|
||||
|
||||
##
|
||||
# Keychain
|
||||
@ -19,5 +19,4 @@
|
||||
# zstyle :omz:plugins:keychain identities id_rsa 01234567
|
||||
# zstyle :omz:plugins:keychain options --quiet --inherit local-once --noask --nocolor --quick
|
||||
# zstyle :omz:plugins:keychain agents gpg,ssh
|
||||
# plugins+=(keychain)
|
||||
|
||||
# zcomet load ohmyzsh plugins/keychain
|
||||
|
@ -1,63 +0,0 @@
|
||||
[ -e "$ZDOTDIR/12-functions.zsh" ] && source "$ZDOTDIR/12-functions.zsh"
|
||||
|
||||
if [ ! -e "$ZSH/oh-my-zsh.sh" ]; then
|
||||
git clone --depth=1 "https://github.com/ohmyzsh/ohmyzsh" "$ZSH"
|
||||
fi
|
||||
|
||||
if [ ! -d "$ZSH_CUSTOM" ]; then
|
||||
mkdir -p "$ZSH_CUSTOM"
|
||||
fi
|
||||
|
||||
add_custom_plugin "https://github.com/tautomer/update-ohmyzsh-custom-plugins.git" update-custom-plugins
|
||||
add_custom_plugin "https://github.com/willghatch/zsh-saneopt" saneopt
|
||||
add_custom_plugin "https://github.com/mafredri/zsh-async" async
|
||||
add_custom_plugin "https://github.com/djui/alias-tips" alias-tips
|
||||
add_custom_plugin "https://github.com/rupa/z" z
|
||||
|
||||
if [[ "$DISPLAY" != '' ]] && command -v xdotool > /dev/null 2>&1 && command -v wmctrl > /dev/null 2>&1; then
|
||||
add_custom_plugin "https://github.com/marzocchi/zsh-notify" notify
|
||||
zstyle ':notify:*' expire-time 5000
|
||||
zstyle ':notify:*' command-complete-timeout 20
|
||||
zstyle ':notify:*' enable-on-ssh yes
|
||||
fi
|
||||
if command -v peco > /dev/null 2>&1; then
|
||||
add_custom_plugin "https://github.com/jimeh/zsh-peco-history" zsh-peco-history
|
||||
fi
|
||||
|
||||
plugins+=(autojump command-not-found common-aliases debian isodate nmap rsync systemadmin web-search)
|
||||
|
||||
if command -v fzf > /dev/null 2>&1; then
|
||||
export DISABLE_FZF_KEY_BINDINGS=true
|
||||
plugins+=(fzf)
|
||||
# fzf
|
||||
[ -e /usr/share/doc/fzf/examples/key-bindings.zsh ] && source /usr/share/doc/fzf/examples/key-bindings.zsh
|
||||
[ -e /usr/share/doc/fzf/examples/completion.zsh ] && source /usr/share/doc/fzf/examples/completion.zsh
|
||||
fi
|
||||
if command -v git > /dev/null 2>&1; then
|
||||
GIT_AUTO_FETCH_INTERVAL=3600
|
||||
plugins+=(git git-auto-fetch git-extras github)
|
||||
add_custom_plugin "https://github.com/paulirish/git-open" git-open
|
||||
fi
|
||||
if command -v psql > /dev/null 2>&1; then
|
||||
plugins+=(postgres)
|
||||
fi
|
||||
if command -v sudo > /dev/null 2>&1; then
|
||||
plugins+=(sudo)
|
||||
fi
|
||||
if command -v systemctl > /dev/null 2>&1; then
|
||||
plugins+=(systemd)
|
||||
fi
|
||||
if command -v vim > /dev/null 2>&1; then
|
||||
plugins+=(vim-interaction)
|
||||
fi
|
||||
if command -v tmux > /dev/null 2>&1; then
|
||||
plugins+=(tmux)
|
||||
zstyle ':prezto:module:tmux:auto-start' local 'no'
|
||||
zstyle ':prezto:module:tmux:auto-start' remote 'yes'
|
||||
zstyle ':prezto:module:tmux:session' name "$(hostname)"
|
||||
add_custom_plugin "https://github.com/laggardkernel/zsh-tmux" zsh-tmux
|
||||
fi
|
||||
if command -v kitty > /dev/null 2>&1; then
|
||||
add_custom_plugin "https://github.com/redxtech/zsh-kitty" zsh-kitty
|
||||
fi
|
||||
|
@ -1,7 +1,3 @@
|
||||
[ -e "$ZDOTDIR/12-functions.zsh" ] && source "$ZDOTDIR/12-functions.zsh"
|
||||
|
||||
add_custom_plugin "https://github.com/zsh-users/zsh-autosuggestions" zsh-autosuggestions
|
||||
|
||||
# Speed up autocomplete, force prefix mapping
|
||||
zstyle ':completion:*' accept-exact '*(N)'
|
||||
zstyle ':completion:*' use-cache on
|
||||
@ -28,6 +24,7 @@ zstyle ':completion:*:(ssh|scp|rsync):*:hosts-domain' ignored-patterns '<->.<->.
|
||||
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^<->.<->.<->.<->' '127.0.0.<->'
|
||||
|
||||
# Вызов в этом месте и в таком порядке
|
||||
add_custom_plugin "https://github.com/zsh-users/zsh-syntax-highlighting" zsh-syntax-highlighting
|
||||
add_custom_plugin "https://github.com/zsh-users/zsh-history-substring-search" zsh-history-substring-search
|
||||
zcomet load zsh-users/zsh-syntax-highlighting
|
||||
zcomet load zsh-users/zsh-history-substring-search
|
||||
zcomet load zsh-users/zsh-autosuggestions
|
||||
|
@ -1,12 +0,0 @@
|
||||
zstyle ':omz:update' mode disabled
|
||||
|
||||
# following commands will be prevented to have filename correction:
|
||||
# cp, ebuild, gist, heroku, hpodder, man, mkdir, mv, mysql, sudo
|
||||
ENABLE_CORRECTION=true
|
||||
|
||||
HYPHEN_INSENSITIVE=true
|
||||
|
||||
COMPLETION_WAITING_DOTS=true
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
@ -0,0 +1,2 @@
|
||||
zcomet compinit
|
||||
|
36
README.md
36
README.md
@ -1,15 +1,15 @@
|
||||
# Установка
|
||||
|
||||
Установка необходимых пакетов:
|
||||
Установка оболочки [`Zsh`](https://www.zsh.org):
|
||||
|
||||
```sh
|
||||
sudo apt-get install zsh
|
||||
sudo apt-get install git zsh
|
||||
```
|
||||
|
||||
Установка желательных пакетов:
|
||||
|
||||
```sh
|
||||
sudo apt-get install keychain peco fzf wmctrl xdotool autojump
|
||||
sudo apt-get install autojump fzf grc keychain peco wmctrl xdotool
|
||||
```
|
||||
|
||||
Клонирование репозитория в каталог `~/.config/zsh`:
|
||||
@ -30,7 +30,7 @@ sudo ${EDITOR:-mcedit} /etc/zsh/zshenv
|
||||
и добавить строку
|
||||
|
||||
```sh
|
||||
[[ -z "$ZDOTDIR" ]] && export ZDOTDIR=$HOME/.config/zsh
|
||||
[[ -z "$ZDOTDIR" ]] && export ZDOTDIR="$HOME/.config/zsh"
|
||||
```
|
||||
|
||||
Установить интерпретатор Zsh по умолчанию для пользователя `username`.
|
||||
@ -52,8 +52,8 @@ cp ~/.config/zsh/55-agents.zsh ~/.config/zsh/55-agents.user.zsh
|
||||
|
||||
Раскомментировать в файле ` ~/.config/zsh/55-agents.user.zsh` строки:
|
||||
|
||||
```text
|
||||
# plugins+=(gpg-agent)
|
||||
```sh
|
||||
# zcomet load ohmyzsh plugins/gpg-agent
|
||||
```
|
||||
|
||||
Пример файла настройки GPG агента `~/.config/gnupg/gpg-agent.conf`:
|
||||
@ -76,11 +76,11 @@ pinentry-program /usr/bin/pinentry-qt
|
||||
|
||||
Раскомментировать в файле ` ~/.config/zsh/55-agents.user.zsh` строки:
|
||||
|
||||
```text
|
||||
```sh
|
||||
# zstyle :omz:plugins:ssh-agent agent-forwarding on
|
||||
# zstyle :omz:plugins:ssh-agent identities id_rsa
|
||||
# zstyle :omz:plugins:ssh-agent lifetime 10h
|
||||
# plugins+=(ssh-agent)
|
||||
# zcomet load ohmyzsh plugins/ssh-agent
|
||||
```
|
||||
|
||||
Добавить в конец файла `~/.ssh/config` правило для разрешения агенту сохранять ключи:
|
||||
@ -96,15 +96,19 @@ Host *
|
||||
|
||||
Программа Keychain позволит использовать агенты GPG и SSH между входами в систему.
|
||||
Для её работы необходимо отключить в системе все автоматические запуски агентов,
|
||||
например в файле `/etc/X11/Xsession.options`.
|
||||
например в файле `/etc/X11/Xsession.options` удалить строку:
|
||||
|
||||
```sh
|
||||
use-ssh-agent
|
||||
```
|
||||
|
||||
Раскомментировать в файле ` ~/.config/zsh/55-agents.user.zsh` строки:
|
||||
|
||||
```text
|
||||
```sh
|
||||
# zstyle :omz:plugins:keychain identities id_rsa 01234567
|
||||
# zstyle :omz:plugins:keychain options --quiet --inherit local-once --noask --nocolor --quick
|
||||
# zstyle :omz:plugins:keychain agents gpg,ssh
|
||||
# plugins+=(keychain)
|
||||
# zcomet load ohmyzsh plugins/keychain
|
||||
```
|
||||
|
||||
Отредактировать файлы настроек для агента GPG и SSH, как это описано в разделах выше.
|
||||
@ -112,20 +116,20 @@ Host *
|
||||
|
||||
## Инициализация
|
||||
|
||||
После редактирования файлов настройки запустить `zsh`, в результате чего будет
|
||||
загружен фреймворк [Oh My Zsh](https://github.com/ohmyzsh/ohmyzsh) и сторонние плагины.
|
||||
После редактирования файлов настройки запустить `zsh`. Автоматически будет загружен
|
||||
менеджер [zcomet](https://github.com/agkozak/zcomet) и необходимые плагины.
|
||||
|
||||
|
||||
## Обновление
|
||||
|
||||
Обновление фреймворка:
|
||||
Обновление `zcomet`:
|
||||
|
||||
```sh
|
||||
omz update
|
||||
zcomet self-update
|
||||
````
|
||||
|
||||
Обновление плагинов:
|
||||
|
||||
```sh
|
||||
update-custom-plugins
|
||||
zcomet update
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user