Compare commits
176 Commits
a57427797d
...
master
Author | SHA1 | Date | |
---|---|---|---|
eea38195a1 | |||
c7bb09d5bc | |||
0ab8f29d9e | |||
ffb71f5600 | |||
ee02aea5a7 | |||
1df17fc702 | |||
62670c583c | |||
faa5c5a550 | |||
4d8052da4b | |||
bb4f1bbb53 | |||
44111962f2 | |||
9c38804a6a | |||
6562cc7774 | |||
d8eb4a6049 | |||
0246176d38 | |||
6d35685e33 | |||
312733c575 | |||
a7e2a48581 | |||
442480e151 | |||
b25739c78b | |||
88efc82376 | |||
9e58e8e04f | |||
c0c1920574 | |||
842b64bfe1 | |||
484a4b943f | |||
a288ff89ed | |||
48902750b9 | |||
ce3d65d15b | |||
ab88a647c0 | |||
0d440310bd | |||
566cca7844 | |||
188e40834e | |||
3819c3ee74 | |||
8364968e2f | |||
b1ab03e165 | |||
020da06b8a | |||
01f900a450 | |||
dd91f10bb4 | |||
0943137da8 | |||
5e593ade5e | |||
2b8ea8a194 | |||
edf4ef872c | |||
9730fc1f5c | |||
9aa3dec349 | |||
834a086fbc | |||
c7b2bbb92f | |||
a545d3be52 | |||
9dc78aa73d | |||
ebbc50dc4c | |||
75c47072f9 | |||
41cc096839 | |||
33eb5a63e1 | |||
505bccc687 | |||
8321fb3a86 | |||
1be479ca64 | |||
43a6deb60c | |||
3df25cc280 | |||
bc176b9f3a | |||
d7f8f98895 | |||
addc2bbc65 | |||
8d6f4d0a0c | |||
345d23e0dc | |||
a20d17eb8b | |||
df7bc41b32 | |||
e09e731101 | |||
a8f767c95d | |||
0d1192758c | |||
311c596fca | |||
193684d640 | |||
fb5782101b | |||
5773b855f3 | |||
19280ec6fc | |||
6b44017c88 | |||
723cf0b917 | |||
4514bed79d | |||
fc40d816f9 | |||
785476f0b2 | |||
b61cbee31d | |||
bb3ea52f23 | |||
3877f9aacc | |||
120501c27a | |||
b40c45ed19 | |||
eeaa1d8b55 | |||
d0292e504b | |||
3239797775 | |||
16c0331040 | |||
e6831d7126 | |||
227ba485f2 | |||
bf2bee47e4 | |||
a091c15045 | |||
c00e6d09ef | |||
e57fe1194e | |||
c4b37c2c5b | |||
51f06cefb6 | |||
6f6855c87d | |||
497f23c115 | |||
c95c869728 | |||
04758ba487 | |||
a79fd61f94 | |||
f9beb69853 | |||
ffe045607c | |||
4c9802e35b | |||
0348458331 | |||
38c56ac271 | |||
5701f67a36 | |||
6029a95324 | |||
e6e01d8917 | |||
ab498eb5a9 | |||
b2370ee807 | |||
5d3f3ea6ea | |||
e6823abbb3 | |||
4b1fbca444 | |||
2bd3607a7a | |||
ecc46ef2da | |||
3821972789 | |||
8ab92f830a | |||
b0986af849 | |||
1b628d45d5 | |||
abf4a8f35f | |||
5b466f5203 | |||
38278f06df | |||
93e084e94f | |||
c1ef48141d | |||
31e1dface0 | |||
b3d70173c1 | |||
9d5f93b0dc | |||
cd72c1cfa0 | |||
8d03a2ed06 | |||
97d234df5f | |||
061989e556 | |||
943fc1d242 | |||
dc2ac2eef7 | |||
026199797d | |||
22197ae61a | |||
00bd63ccc6 | |||
e9b976f5f2 | |||
098834c637 | |||
a040a92a2d | |||
c49d89dc1a | |||
d868d4f8ae | |||
21adbc8e43 | |||
2e052d7d19 | |||
f362f02879 | |||
4c980e0da6 | |||
5c9556f8a0 | |||
506eda17f4 | |||
ff8bccb541 | |||
ba6c92a2ce | |||
a3b19b9f4c | |||
ceb8f4c9df | |||
f895320362 | |||
ecbcc2e8cd | |||
2631d43e21 | |||
c419c6f8f2 | |||
c2ce0cbff3 | |||
3494732ae4 | |||
46541ea6fd | |||
2baad93acc | |||
a8520fc7d9 | |||
469ffa4da1 | |||
994fa2897a | |||
7e4221b74f | |||
058459dc8f | |||
4ae82b99b7 | |||
ee2fdf6f27 | |||
05a0baf925 | |||
f949c5c453 | |||
406995f72b | |||
f52309d2d9 | |||
e2170afdba | |||
6c98fb13c3 | |||
6ac27b6087 | |||
ba04ed4f22 | |||
d578ba6b1a | |||
8498b7f0e0 | |||
3520c9f73c |
9
.gitignore
vendored
9
.gitignore
vendored
@ -1,4 +1,7 @@
|
|||||||
.zcompdump*
|
*.post.zsh
|
||||||
keychain-config.zsh
|
*.pre.zsh
|
||||||
*.user.zsh
|
*.user.zsh
|
||||||
|
.zshenv.user
|
||||||
|
.zcalc_history
|
||||||
|
.zcompdump*
|
||||||
|
*.zwc
|
||||||
|
1652
.p10k.8colors.zsh
Normal file
1652
.p10k.8colors.zsh
Normal file
File diff suppressed because it is too large
Load Diff
82
.zshenv
Normal file
82
.zshenv
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
# vim: ft=sh
|
||||||
|
|
||||||
|
# Запрет чтения настроек из системного каталога /etc
|
||||||
|
unsetopt GLOBAL_RCS
|
||||||
|
|
||||||
|
# PATH {{{
|
||||||
|
# Ruby
|
||||||
|
if command -v ruby >/dev/null && command -v gem >/dev/null; then
|
||||||
|
path=("$(ruby -r rubygems -e 'puts Gem.user_dir')/bin" $path)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Поиск в домашнем каталоге
|
||||||
|
path=("$HOME/bin" "$HOME/.local/bin" $path)
|
||||||
|
|
||||||
|
# Удалить дубликаты в массиве
|
||||||
|
typeset -aU path
|
||||||
|
# }}}
|
||||||
|
|
||||||
|
# Базовые каталоги {{{
|
||||||
|
export XDG_CONFIG_HOME="$HOME/.config"
|
||||||
|
export XDG_CACHE_HOME="$HOME/.cache"
|
||||||
|
export XDG_DATA_HOME="$HOME/.local/share"
|
||||||
|
export XDG_STATE_HOME="$HOME/.local/state"
|
||||||
|
# }}}
|
||||||
|
|
||||||
|
export ZSH_CACHE_DIR="$XDG_CACHE_HOME/zsh"
|
||||||
|
export ZSH_COMPDUMP="$ZSH_CACHE_DIR/zcompdump-${HOST/.*/}-$ZSH_VERSION"
|
||||||
|
|
||||||
|
typeset -g POWERLEVEL9K_INSTANT_PROMPT=off
|
||||||
|
|
||||||
|
# Короткое имя компьютера, обязательно нужно для ssh-agent.
|
||||||
|
# Часто используется в OhMyZsh.
|
||||||
|
export SHORT_HOST="${SHORT_HOST:-${(%):-%m}}"
|
||||||
|
|
||||||
|
# Отключаем некоторые плагины, если запуск в качестве подоболочки mc
|
||||||
|
# Bug: https://midnight-commander.org/ticket/4253
|
||||||
|
[ "$(ps -p $PPID -o cmd=)" = "mc" ] && ZSH_MC_SUBSHELL=1
|
||||||
|
|
||||||
|
# GnuPG
|
||||||
|
export GNUPGHOME="$XDG_CONFIG_HOME/gnupg"
|
||||||
|
|
||||||
|
# askpass # {{{
|
||||||
|
if [[ -n ${DISPLAY+set} ]]; then
|
||||||
|
if command -v /usr/lib/openssh/gnome-ssh-askpass >/dev/null 2>&1; then
|
||||||
|
# Gnome
|
||||||
|
export SSH_ASKPASS=/usr/lib/openssh/gnome-ssh-askpass
|
||||||
|
elif command -v /usr/bin/lxqt-openssh-askpass >/dev/null 2>&1; then
|
||||||
|
# LxQt
|
||||||
|
export SSH_ASKPASS=/usr/bin/lxqt-openssh-askpass
|
||||||
|
elif command -v /usr/bin/ssh-askpass >/dev/null 2>&1; then
|
||||||
|
# X11
|
||||||
|
export SSH_ASKPASS=/usr/bin/ssh-askpass
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# }}}
|
||||||
|
|
||||||
|
if command -v bat >/dev/null; then
|
||||||
|
export PAGER=bat
|
||||||
|
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Uncrustify
|
||||||
|
export UNCRUSTIFY_CONFIG="${XDG_CONFIG_HOME}/uncrustify/uncrustify.cfg"
|
||||||
|
[ ! -r "${UNCRUSTIFY_CONFIG}" ] && unset UNCRUSTIFY_CONFIG
|
||||||
|
|
||||||
|
# Intel OneAPI #{{{
|
||||||
|
if [[ -n ${ENABLE_INTEL_STUDIO+set} ]]; then
|
||||||
|
#export COMPILERVARS_ARCHITECTURE=intel64
|
||||||
|
#export COMPILERVARS_PLATFORM=linux
|
||||||
|
INTEL_VARS=( /opt/intel/oneapi/advisor/latest/advixe-vars.sh
|
||||||
|
/opt/intel/oneapi/compiler/latest/env/vars.sh
|
||||||
|
/opt/intel/oneapi/vtune/latest/vtune-vars.sh )
|
||||||
|
|
||||||
|
for f in "${INTEL_VARS[@]}"; do
|
||||||
|
if [ -r "$f" ]; then source "$f" >/dev/null; fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
# }}}
|
||||||
|
|
||||||
|
[ -r "$ZDOTDIR/.zshenv.user" ] && source "$ZDOTDIR/.zshenv.user"
|
||||||
|
|
45
.zshrc
45
.zshrc
@ -1,22 +1,31 @@
|
|||||||
source $ZDOTDIR/env.zsh
|
# shellcheck shell=bash
|
||||||
[ -e $ZDOTDIR/env.user.zsh ] && source $ZDOTDIR/env.user.zsh
|
# vim: ft=sh
|
||||||
|
|
||||||
source $ZDOTDIR/history.zsh
|
# Profiling start
|
||||||
[ -e $ZDOTDIR/history.user.zsh ] && source $ZDOTDIR/history.user.zsh
|
# zmodload zsh/zprof
|
||||||
|
|
||||||
source $ZDOTDIR/options.zsh
|
for S in \
|
||||||
[ -e $ZDOTDIR/options.user.zsh ] && source $ZDOTDIR/options.user.zsh
|
05-start \
|
||||||
|
15-options \
|
||||||
|
25-history \
|
||||||
|
42-zinit \
|
||||||
|
45-plugins \
|
||||||
|
55-agents \
|
||||||
|
62-scripts \
|
||||||
|
68-aliases \
|
||||||
|
72-widgets \
|
||||||
|
78-keybindings \
|
||||||
|
82-completion \
|
||||||
|
88-prompt \
|
||||||
|
95-finish
|
||||||
|
do
|
||||||
|
N="${S//[0-9\-]/}"
|
||||||
|
if [[ -r "$ZDOTDIR/$S.pre.zsh" ]]; then source "$ZDOTDIR/$S.pre.zsh"; fi
|
||||||
|
if [[ -r "$ZDOTDIR/$S.zsh" ]]; then source "$ZDOTDIR/$S.zsh"; fi
|
||||||
|
if [[ -r "$ZDOTDIR/$S.user.zsh" ]]; then source "$ZDOTDIR/$S.user.zsh"; fi
|
||||||
|
if [[ -r "$ZDOTDIR/$N.user.zsh" ]]; then source "$ZDOTDIR/$N.user.zsh"; fi
|
||||||
|
if [[ -r "$ZDOTDIR/$S.post.zsh" ]]; then source "$ZDOTDIR/$S.post.zsh"; fi
|
||||||
|
done
|
||||||
|
|
||||||
source $ZDOTDIR/plugins.zsh
|
# zprof
|
||||||
[ -e $ZDOTDIR/plugins.user.zsh ] && source $ZDOTDIR/plugins.user.zsh
|
|
||||||
|
|
||||||
source $ZDOTDIR/agents.zsh
|
|
||||||
[ -e $ZDOTDIR/agents.user.zsh ] && source $ZDOTDIR/agents.user.zsh
|
|
||||||
|
|
||||||
source $ZDOTDIR/aliases.zsh
|
|
||||||
[ -e $ZDOTDIR/aliases.user.zsh ] && source $ZDOTDIR/aliases.user.zsh
|
|
||||||
|
|
||||||
source $ZDOTDIR/prompt.zsh
|
|
||||||
[ -e $ZDOTDIR/prompt.user.zsh ] && source $ZDOTDIR/prompt.user.zsh
|
|
||||||
|
|
||||||
true
|
|
||||||
|
12
05-start.zsh
Normal file
12
05-start.zsh
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
# vim: ft=sh
|
||||||
|
|
||||||
|
# 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}/p10k-instant-prompt-${(%):-%n}.zsh" ]; then
|
||||||
|
source "${XDG_CACHE_HOME}/p10k-instant-prompt-${(%):-%n}.zsh"
|
||||||
|
fi
|
||||||
|
|
30
15-options.zsh
Normal file
30
15-options.zsh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
# vim: ft=sh
|
||||||
|
|
||||||
|
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 is-at-least
|
||||||
|
colors
|
||||||
|
|
||||||
|
zmodload zsh/terminfo
|
||||||
|
|
||||||
|
autoload -Uz edit-command-line
|
||||||
|
zle -N edit-command-line
|
||||||
|
|
||||||
|
autoload -Uz select-word-style
|
||||||
|
select-word-style shell
|
||||||
|
|
||||||
|
if [ -z ${DISABLE_MAGIC_FUNCTIONS+set} ]; then
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Подсветка вывода основных команд
|
||||||
|
if [[ -r /etc/grc.zsh ]]; then source /etc/grc.zsh; fi
|
||||||
|
|
@ -1,9 +1,12 @@
|
|||||||
HISTFILE="$HOME/.cache/zsh/history"
|
# shellcheck shell=bash
|
||||||
HISTSIZE=10000000
|
# vim: ft=sh
|
||||||
SAVEHIST=10000000
|
|
||||||
|
HISTFILE="$ZSH_CACHE_DIR/history"
|
||||||
|
HISTSIZE=600000
|
||||||
|
SAVEHIST=500000
|
||||||
HISTDUP=erase
|
HISTDUP=erase
|
||||||
|
|
||||||
[ ! -d "$HOME/.cache/zsh" ] && mkdir -p "$HOME/.cache/zsh"
|
[ ! -d "$ZSH_CACHE_DIR" ] && mkdir -p "$ZSH_CACHE_DIR"
|
||||||
|
|
||||||
setopt BANG_HIST # Treat the '!' character specially during expansion.
|
setopt BANG_HIST # Treat the '!' character specially during expansion.
|
||||||
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
|
setopt EXTENDED_HISTORY # Write the history file in the ":start:elapsed;command" format.
|
||||||
@ -19,4 +22,3 @@ setopt HIST_REDUCE_BLANKS # Remove superfluous blanks before recording en
|
|||||||
setopt HIST_VERIFY # Don't execute immediately upon history expansion.
|
setopt HIST_VERIFY # Don't execute immediately upon history expansion.
|
||||||
setopt HIST_BEEP # Beep when accessing nonexistent history.
|
setopt HIST_BEEP # Beep when accessing nonexistent history.
|
||||||
|
|
||||||
|
|
27
42-zinit.zsh
Normal file
27
42-zinit.zsh
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
# vim: ft=sh
|
||||||
|
|
||||||
|
declare -A ZINIT
|
||||||
|
ZINIT[VERSION]="3.14.0"
|
||||||
|
ZINIT[HOME_DIR]="$ZSH_CACHE_DIR/zinit-${ZINIT[VERSION]}"
|
||||||
|
ZINIT[PLUGINS_DIR]="$ZSH_CACHE_DIR/plugins"
|
||||||
|
ZINIT[SNIPPETS_DIR]="$ZSH_CACHE_DIR/snippets"
|
||||||
|
ZINIT[ZCOMPDUMP_PATH]="$ZSH_CACHE_DIR/zcompdump"
|
||||||
|
ZPFX="$ZSH_CACHE_DIR/polaris"
|
||||||
|
|
||||||
|
if [ ! -d "${ZINIT[HOME_DIR]}" ]; then
|
||||||
|
curl -sL "https://github.com/zdharma-continuum/zinit/archive/refs/tags/v${ZINIT[VERSION]}.tar.gz" | tar zxf - -C "$ZSH_CACHE_DIR"
|
||||||
|
sed -i 's/.*zinit-self-update -q//' "${ZINIT[HOME_DIR]}/zinit-autoload.zsh"
|
||||||
|
zcompile "${ZINIT[HOME_DIR]}/zinit.zsh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
source "${ZINIT[HOME_DIR]}/zinit.zsh"
|
||||||
|
autoload -Uz _zinit
|
||||||
|
(( ${+_comps} )) && _comps[zinit]=_zinit
|
||||||
|
|
||||||
|
# Расширение zinit для загрузки файлов
|
||||||
|
zinit light zdharma-continuum/z-a-patch-dl
|
||||||
|
|
||||||
|
# Расширение zinit для запуска программ и скриптов, расположенных вне $PATH
|
||||||
|
zinit light zdharma-continuum/z-a-bin-gem-node
|
||||||
|
|
103
45-plugins.zsh
Normal file
103
45-plugins.zsh
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
# vim: ft=sh
|
||||||
|
|
||||||
|
zinit light willghatch/zsh-saneopt
|
||||||
|
zinit light mafredri/zsh-async
|
||||||
|
|
||||||
|
export ZSHZ_CASE=smart
|
||||||
|
export ZSHZ_DATA="${ZSH_CACHE_DIR}/z"
|
||||||
|
zinit ice lucid wait'0' depth'1'
|
||||||
|
zinit light agkozak/zsh-z
|
||||||
|
|
||||||
|
zinit snippet OMZP::pj
|
||||||
|
|
||||||
|
if [[ "$(id -u)" != "0" ]] && [[ -n "${DISPLAY+set}" ]]; then
|
||||||
|
zstyle ':notify:*' expire-time 5000
|
||||||
|
zstyle ':notify:*' command-complete-timeout 20
|
||||||
|
zstyle ':notify:*' enable-on-ssh yes
|
||||||
|
zinit light marzocchi/zsh-notify
|
||||||
|
fi
|
||||||
|
|
||||||
|
zinit snippet OMZL::functions.zsh
|
||||||
|
zinit snippet OMZL::clipboard.zsh
|
||||||
|
zinit snippet OMZL::key-bindings.zsh
|
||||||
|
zinit snippet OMZL::termsupport.zsh
|
||||||
|
|
||||||
|
zinit light marlonrichert/zsh-hist
|
||||||
|
|
||||||
|
if [ -x /usr/lib/command-not-found ]; then
|
||||||
|
zinit snippet OMZP::command-not-found
|
||||||
|
fi
|
||||||
|
zinit snippet OMZP::common-aliases
|
||||||
|
zinit snippet OMZP::debian
|
||||||
|
zinit snippet OMZP::isodate
|
||||||
|
if command -v mosh > /dev/null 2>&1; then
|
||||||
|
zinit snippet OMZP::mosh
|
||||||
|
fi
|
||||||
|
if command -v nmap > /dev/null 2>&1; then
|
||||||
|
zinit snippet OMZP::nmap
|
||||||
|
fi
|
||||||
|
if command -v pre-commit > /dev/null 2>&1; then
|
||||||
|
zinit snippet OMZP::pre-commit
|
||||||
|
fi
|
||||||
|
if command -v rsync > /dev/null 2>&1; then
|
||||||
|
zinit snippet OMZP::rsync
|
||||||
|
fi
|
||||||
|
zinit snippet OMZP::vscode
|
||||||
|
zinit snippet OMZP::web-search
|
||||||
|
if command -v git-lfs > /dev/null 2>&1; then
|
||||||
|
zinit light brymck/print-alias
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v fzf > /dev/null 2>&1; then
|
||||||
|
FZF_DEFAULT_OPTS='--height 60% --layout=reverse --border'
|
||||||
|
if command -v fd > /dev/null 2>&1; then
|
||||||
|
FZF_DEFAULT_COMMAND="fd --type f"
|
||||||
|
FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
|
||||||
|
FZF_ALT_C_COMMAND="fd --type d"
|
||||||
|
fi
|
||||||
|
FZF_VERSION="$(fzf --version | sed -r 's/([0-9]+\.[0-9]+).*/\1/' )"
|
||||||
|
zinit ice lucid wait'0' mv"completion.zsh -> _fzf" pick"_fzf" as"completion"
|
||||||
|
if is-at-least "0.54" "$FZF_VERSION"; then
|
||||||
|
zinit snippet "https://raw.githubusercontent.com/junegunn/fzf/refs/tags/v${FZF_VERSION}.0/shell/completion.zsh"
|
||||||
|
zinit snippet "https://raw.githubusercontent.com/junegunn/fzf/refs/tags/v${FZF_VERSION}.0/shell/key-bindings.zsh"
|
||||||
|
else
|
||||||
|
zinit snippet "https://raw.githubusercontent.com/junegunn/fzf/refs/tags/${FZF_VERSION}.0/shell/completion.zsh"
|
||||||
|
zinit snippet "https://raw.githubusercontent.com/junegunn/fzf/refs/tags/${FZF_VERSION}.0/shell/key-bindings.zsh"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v git > /dev/null 2>&1; then
|
||||||
|
GIT_AUTO_FETCH_INTERVAL=3600
|
||||||
|
zinit snippet OMZL::git.zsh
|
||||||
|
zinit snippet OMZP::git
|
||||||
|
zinit snippet OMZP::git-extras
|
||||||
|
zinit snippet OMZP::github
|
||||||
|
[ -z ${SSH_CONNECTION+set} ] && zinit snippet OMZP::git-auto-fetch
|
||||||
|
zinit light unixorn/git-extra-commands
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v psql > /dev/null 2>&1; then
|
||||||
|
zinit snippet OMZP::postgres
|
||||||
|
fi
|
||||||
|
if command -v sudo > /dev/null 2>&1; then
|
||||||
|
zinit snippet OMZP::sudo
|
||||||
|
fi
|
||||||
|
if command -v systemctl > /dev/null 2>&1; then
|
||||||
|
zinit snippet OMZP::systemd
|
||||||
|
fi
|
||||||
|
if command -v vim > /dev/null 2>&1; then
|
||||||
|
zinit snippet OMZP::vim-interaction
|
||||||
|
fi
|
||||||
|
if command -v tmux > /dev/null 2>&1; then
|
||||||
|
zstyle ':prezto:module:tmux:auto-start' local 'no'
|
||||||
|
zstyle ':prezto:module:tmux:auto-start' remote 'no'
|
||||||
|
zstyle ':prezto:module:tmux:session' name "$(hostname)"
|
||||||
|
zinit ice pick'init.zsh'
|
||||||
|
zinit light laggardkernel/zsh-tmux
|
||||||
|
zinit light amyreese/zsh-titles
|
||||||
|
fi
|
||||||
|
if command -v kitty > /dev/null 2>&1; then
|
||||||
|
zinit light redxtech/zsh-kitty
|
||||||
|
fi
|
||||||
|
|
40
55-agents.zsh
Normal file
40
55-agents.zsh
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
# vim: ft=sh
|
||||||
|
|
||||||
|
# Copy this file to 55-agents.user.zsh and modify to your needs
|
||||||
|
|
||||||
|
# SSH agent #{{{
|
||||||
|
# if command -v ssh-agent >/dev/null 2>&1; then
|
||||||
|
# zstyle :omz:plugins:ssh-agent agent-forwarding on
|
||||||
|
# zstyle :omz:plugins:ssh-agent identities id_rsa
|
||||||
|
# zstyle :omz:plugins:ssh-agent lifetime 10h
|
||||||
|
# zinit snippet OMZP::ssh-agent
|
||||||
|
# fi
|
||||||
|
#}}}
|
||||||
|
|
||||||
|
# GPG agent #{{{
|
||||||
|
# if command -v gpg-agent >/dev/null 2>&1; then
|
||||||
|
# zinit snippet OMZP::gpg-agent
|
||||||
|
# if command -v gpg-conf >/dev/null 2>&1; then
|
||||||
|
# gpgconf --create-socketdir
|
||||||
|
# fi
|
||||||
|
# fi
|
||||||
|
#}}}
|
||||||
|
|
||||||
|
# Keychain #{{{
|
||||||
|
# if command -v keychain >/dev/null 2>&1; then
|
||||||
|
# zstyle :omz:plugins:keychain identities id_rsa 01234567
|
||||||
|
# zstyle :omz:plugins:keychain options --quiet --inherit any-once --noask --nocolor --absolute --dir ~/.cache/keychain
|
||||||
|
# zstyle :omz:plugins:keychain agents gpg,ssh
|
||||||
|
# zinit snippet OMZP::keychain
|
||||||
|
# fi
|
||||||
|
#}}}
|
||||||
|
|
||||||
|
# Keychain: вариант только для ssh-agent #{{{
|
||||||
|
# if command -v keychain >/dev/null 2>&1; then
|
||||||
|
# zstyle :omz:plugins:keychain identities id_rsa
|
||||||
|
# zstyle :omz:plugins:keychain options --quiet --inherit any-once --noask --nocolor
|
||||||
|
# zstyle :omz:plugins:keychain agents ssh
|
||||||
|
# zinit snippet OMZP::keychain
|
||||||
|
# fi
|
||||||
|
#}}}
|
96
62-scripts.zsh
Normal file
96
62-scripts.zsh
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
# vim: ft=sh
|
||||||
|
|
||||||
|
# Обновление конфигурации zsh, менеджера zinit и плагинов
|
||||||
|
zu() {
|
||||||
|
git -C $ZDOTDIR rev-parse 2>/dev/null && git -C $ZDOTDIR pull
|
||||||
|
zinit update --parallel --all
|
||||||
|
exec zsh
|
||||||
|
}
|
||||||
|
|
||||||
|
gpsr() {
|
||||||
|
git push -u "$1" "$(git branch --show-current)"
|
||||||
|
}
|
||||||
|
|
||||||
|
ch() {
|
||||||
|
curl -s "https://cheat.sh/$1" | less -R
|
||||||
|
}
|
||||||
|
|
||||||
|
exf() {
|
||||||
|
case "$1" in
|
||||||
|
*.tar.bz2) tar xjf "$1" ;;
|
||||||
|
*.tar.gz) tar xzf "$1" ;;
|
||||||
|
*.tar.xz) tar xJf "$1" ;;
|
||||||
|
*.tbz2) tar xjf "$1" ;;
|
||||||
|
*.tgz) tar xzf "$1" ;;
|
||||||
|
*.tar) tar xf "$1" ;;
|
||||||
|
*.zip) unzip "$1" ;;
|
||||||
|
*.7z) 7z x "$1" ;;
|
||||||
|
*.iso) 7z x "$1" ;;
|
||||||
|
*.rar) unrar x "$1" ;;
|
||||||
|
*) echo "'$1' cannot be extracted" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
exfl() {
|
||||||
|
for F in "$@"
|
||||||
|
do
|
||||||
|
if [ -f "$F" ]; then
|
||||||
|
exf "$F"
|
||||||
|
else
|
||||||
|
echo "'$F' is not a valid file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
exd() {
|
||||||
|
case "$1" in
|
||||||
|
*.tar.bz2) b=${1%.tar.bz2}; mkdir -p "$b">/dev/null; tar xjf "$1" -C "$b" ;;
|
||||||
|
*.tar.gz) b=${1%.tar.gz}; mkdir -p "$b">/dev/null; tar xzf "$1" -C "$b" ;;
|
||||||
|
*.tar.xz) b=${1%.tar.xz}; mkdir -p "$b">/dev/null; tar xJf "$1" -C "$b" ;;
|
||||||
|
*.tbz2) b=${1%.tbz2}; mkdir -p "$b">/dev/null; tar xjf "$1" -C "$b" ;;
|
||||||
|
*.tgz) b=${1%.tgz}; mkdir -p "$b">/dev/null; tar xzf "$1" -C "$b" ;;
|
||||||
|
*.tar) b=${1%.tar}; mkdir -p "$b">/dev/null; tar xf "$1" -C "$b" ;;
|
||||||
|
*.zip) b=${1%.zip}; unzip "$1" -d "$b" ;;
|
||||||
|
*.7z) b=${1%.7z}; 7z x -o"$b" "$1" ;;
|
||||||
|
*.iso) b=${1%.iso}; 7z x -o"$b" "$1" ;;
|
||||||
|
*.rar) b=${1%.rar}; rar x "$1" "$b" ;;
|
||||||
|
*) echo "'$1' cannot be extracted" ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
exdl() {
|
||||||
|
for F in "$@"
|
||||||
|
do
|
||||||
|
if [ -f "$F" ]; then
|
||||||
|
exd "$F"
|
||||||
|
else
|
||||||
|
echo "'$F' is not a valid file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
psgrep() {
|
||||||
|
ps aux | grep "${1:-.}" | grep -v grep
|
||||||
|
}
|
||||||
|
|
||||||
|
# Kills any process that matches a regexp passed to it
|
||||||
|
killit() {
|
||||||
|
ps aux | grep -v grep | grep "$@" | awk '{print $2}' | xargs sudo kill
|
||||||
|
}
|
||||||
|
|
||||||
|
# gather external ip address
|
||||||
|
geteip() {
|
||||||
|
curl -s -S -4 https://icanhazip.com
|
||||||
|
curl -s -S -6 https://icanhazip.com
|
||||||
|
}
|
||||||
|
|
||||||
|
# determine local IP address(es)
|
||||||
|
getip() {
|
||||||
|
if (( ${+commands[ip]} )); then
|
||||||
|
ip addr | awk '/inet /{print $2}' | command grep -v 127.0.0.1
|
||||||
|
else
|
||||||
|
ifconfig | awk '/inet /{print $2}' | command grep -v 127.0.0.1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
95
68-aliases.zsh
Normal file
95
68-aliases.zsh
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
# vim: ft=sh
|
||||||
|
|
||||||
|
# zmv
|
||||||
|
alias zcp='zmv -C'
|
||||||
|
alias zln='zmv -L'
|
||||||
|
|
||||||
|
# shellcheck disable=SC2154
|
||||||
|
alias path='print -l $path'
|
||||||
|
alias mkdir='mkdir -pv'
|
||||||
|
|
||||||
|
# APT
|
||||||
|
alias aptu='sudo apt-get update'
|
||||||
|
alias aptn='sudo apt-get update && sudo apt-get dist-upgrade'
|
||||||
|
alias apti='sudo apt-get install'
|
||||||
|
alias aptp='sudo apt-get purge'
|
||||||
|
alias aptr='sudo apt-get remove'
|
||||||
|
alias aptc='sudo apt-get --purge autoremove && sudo apt-get clean'
|
||||||
|
alias aptk='sudo apt-key add'
|
||||||
|
alias apts='apt-cache show'
|
||||||
|
aptf() {
|
||||||
|
[ -z "$1" ] && return 1
|
||||||
|
if [ -z "$2" ]; then
|
||||||
|
apt-cache search "$1"
|
||||||
|
else
|
||||||
|
apt-cache search "$1" | grep "$2"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
alias lzg='lazygit'
|
||||||
|
alias lzd='lazydocker'
|
||||||
|
alias tldr='tealdeer'
|
||||||
|
|
||||||
|
# Youtube
|
||||||
|
if command -v yt-dlp > /dev/null 2>&1; then
|
||||||
|
alias ydlbest="yt-dlp --merge-output-format mkv -f 'bestvideo+bestaudio'"
|
||||||
|
alias ydlaudio="yt-dlp -f bestaudio"
|
||||||
|
alias ydl="yt-dlp --merge-output-format mkv"
|
||||||
|
alias youtube-dl="yt-dlp"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# feh
|
||||||
|
command -v feh > /dev/null 2>&1 && alias feh="feh --cache-size 256 --version-sort --sort filename --image-bg black"
|
||||||
|
|
||||||
|
# Замена шрифта у заголовка окна в i3 при использовании ssh или mosh
|
||||||
|
if [ -n "${DISPLAY+set}" ] ; then
|
||||||
|
if command -v i3-msg >/dev/null 2>&1 ; then
|
||||||
|
i3-mosh () {
|
||||||
|
i3-msg -q title_format "<span foreground='#AAAAFF' font-weight='bold'>%title</span>"
|
||||||
|
mosh "$@"
|
||||||
|
i3-msg -q title_format "%title"
|
||||||
|
}
|
||||||
|
alias mosh=i3-mosh
|
||||||
|
i3-ssh () {
|
||||||
|
i3-msg -q title_format "<span foreground='#AAAAFF' font-weight='bold'>%title</span>"
|
||||||
|
ssh "$@"
|
||||||
|
i3-msg -q title_format "%title"
|
||||||
|
}
|
||||||
|
alias ssh=i3-ssh
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# git
|
||||||
|
alias gpa="git remote | xargs -L1 git push --all"
|
||||||
|
alias gu="git pull"
|
||||||
|
alias gur="git pull --recurse-submodules"
|
||||||
|
alias gsui="git submodule update --recursive --init"
|
||||||
|
alias gsur="git submodule update --recursive --init --remote"
|
||||||
|
|
||||||
|
alias ycal="ncal $(date +%Y)"
|
||||||
|
|
||||||
|
# gdu вместо ncdu
|
||||||
|
command -v gdu > /dev/null 2>&1 && alias ncdu=gdu
|
||||||
|
|
||||||
|
# Фильтры (H,T,G,L определены в common-aliases)
|
||||||
|
alias -g N1='1>/dev/null'
|
||||||
|
alias -g N2='2>/dev/null'
|
||||||
|
alias -g NN='&>/dev/null'
|
||||||
|
|
||||||
|
alias -g S='| sort'
|
||||||
|
alias -g SU='| sort -u'
|
||||||
|
|
||||||
|
alias -g S0='| sort -z'
|
||||||
|
alias -g SU0='| sort -u -z'
|
||||||
|
|
||||||
|
alias -g X='| xargs'
|
||||||
|
alias -g X0='| xargs -0'
|
||||||
|
|
||||||
|
alias -g XS='| sort | xargs'
|
||||||
|
alias -g XS0='| sort -z | xargs -0'
|
||||||
|
|
||||||
|
alias -g Z='| fzf'
|
||||||
|
|
||||||
|
# shellcheck disable=SC1073,SC1064,SC1072
|
||||||
|
audio-join() ffmpeg -i "concat:${(j:|:)@[2,-1]}" -acodec copy $1
|
48
72-widgets.zsh
Normal file
48
72-widgets.zsh
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
# vim: ft=sh
|
||||||
|
|
||||||
|
# Navi
|
||||||
|
if command -v navi > /dev/null 2>&1; then
|
||||||
|
zinit snippet https://github.com/denisidoro/navi/blob/master/shell/navi.plugin.zsh
|
||||||
|
function magic-ctrl-g {
|
||||||
|
if ! (( $#BUFFER )) && [[ "$CONTEXT" == start ]]; then _navi_widget; fi
|
||||||
|
}
|
||||||
|
zle -N magic-ctrl-g
|
||||||
|
bindkey '^G' magic-ctrl-g
|
||||||
|
fi
|
||||||
|
|
||||||
|
# FZF #{{{
|
||||||
|
if command -v fzf > /dev/null 2>&1; then
|
||||||
|
function magic-ctrl-f {
|
||||||
|
if ! (( $#BUFFER )) && [[ "$CONTEXT" == start ]]; then fzf-file-widget; fi
|
||||||
|
}
|
||||||
|
zle -N magic-ctrl-f
|
||||||
|
bindkey '^F' magic-ctrl-f
|
||||||
|
fi
|
||||||
|
#}}}
|
||||||
|
|
||||||
|
ZSH_FZF_PASTE_KEY=enter
|
||||||
|
ZSH_FZF_EXEC_KEY=ctrl-r
|
||||||
|
fzf-kill-proc-by-list() {
|
||||||
|
local cmd=$([ "$UID" != '0' ] && echo "ps -f -u $UID" || echo 'ps -ef')
|
||||||
|
local res=$(${=cmd} \
|
||||||
|
| FZF_DEFAULT_OPTS="${FZF_DEFAULT_OPTS}
|
||||||
|
--no-sort
|
||||||
|
--reverse
|
||||||
|
--bind=\"${ZSH_FZF_PASTE_KEY}:execute@echo kill -9 \$(echo {} | awk '{print \$2}')@+abort\"
|
||||||
|
--bind=\"${ZSH_FZF_EXEC_KEY}:execute@kill -9 \$(echo {} | awk '{print \$2}')@+abort\"
|
||||||
|
" $(__fzfcmd))
|
||||||
|
|
||||||
|
if [[ -n "$res" ]]; then
|
||||||
|
LBUFFER=${LBUFFER}$res
|
||||||
|
zle redisplay
|
||||||
|
else
|
||||||
|
zle reset-prompt
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if command -v fzf > /dev/null 2>&1; then
|
||||||
|
zle -N fzf-kill-proc-by-list
|
||||||
|
bindkey '^Z' fzf-kill-proc-by-list
|
||||||
|
fi
|
||||||
|
|
6
78-keybindings.zsh
Normal file
6
78-keybindings.zsh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
# vim: ft=sh
|
||||||
|
|
||||||
|
# [Esc] [Esc]
|
||||||
|
bindkey '\e\e' send-break
|
||||||
|
|
53
82-completion.zsh
Normal file
53
82-completion.zsh
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
# vim: ft=sh
|
||||||
|
|
||||||
|
# Speed up autocomplete, force prefix mapping
|
||||||
|
zstyle ':completion:*' accept-exact '*(N)'
|
||||||
|
zstyle ':completion:*' use-cache on
|
||||||
|
zstyle ':completion:*' cache-path "$ZSH_CACHE_DIR"
|
||||||
|
zstyle ':completion:*' menu select
|
||||||
|
|
||||||
|
zstyle ':completion:*:processes' command 'ps -ax'
|
||||||
|
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;32'
|
||||||
|
zstyle ':completion:*:*:kill:*' menu yes select
|
||||||
|
zstyle ':completion:*:*:kill:*' force-list always
|
||||||
|
zstyle ':completion:*:*:kill:*' insert-ids single
|
||||||
|
|
||||||
|
zstyle ':completion:*:processes-names' command 'ps -e -o comm='
|
||||||
|
zstyle ':completion:*:*:killall:*' menu yes select
|
||||||
|
zstyle ':completion:*:killall:*' force-list always
|
||||||
|
|
||||||
|
# SSH/SCP/RSYNC
|
||||||
|
zstyle ':completion:*:(ssh|scp|rsync):*' hosts off
|
||||||
|
zstyle ':completion:*:(scp|rsync):*' tag-order 'hosts:-host hosts:-domain:domain hosts:-ipaddr:ip\ address *'
|
||||||
|
zstyle ':completion:*:(scp|rsync):*' group-order users files all-files hosts-domain hosts-host hosts-ipaddr
|
||||||
|
zstyle ':completion:*:ssh:*' tag-order users 'hosts:-host hosts:-domain:domain hosts:-ipaddr:ip\ address *'
|
||||||
|
zstyle ':completion:*:ssh:*' group-order hosts-domain hosts-host users hosts-ipaddr
|
||||||
|
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-host' ignored-patterns '*.*' loopback localhost
|
||||||
|
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^*.*' '*@*'
|
||||||
|
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^<->.<->.<->.<->' '127.0.0.<->'
|
||||||
|
|
||||||
|
# marlonrichert/zsh-autocomplete
|
||||||
|
|
||||||
|
zinit wait'0' lucid light-mode depth'1' for \
|
||||||
|
atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay" \
|
||||||
|
zdharma-continuum/fast-syntax-highlighting \
|
||||||
|
blockf \
|
||||||
|
zsh-users/zsh-completions \
|
||||||
|
atload"!_zsh_autosuggest_start" \
|
||||||
|
zsh-users/zsh-autosuggestions
|
||||||
|
|
||||||
|
zinit wait'0' lucid light-mode depth'1' for \
|
||||||
|
atload"bindkey '^[[A' history-substring-search-up; \
|
||||||
|
bindkey '^[[B' history-substring-search-down" \
|
||||||
|
zsh-users/zsh-history-substring-search
|
||||||
|
|
||||||
|
#[ "$(lsb_release -c -s)" = "orel" ] && ZSH_HISTORY_SEARCH_MULTI_WORD_MODE=1
|
||||||
|
#[ -n "${SSH_CONNECTION}" ] && ZSH_HISTORY_SEARCH_MULTI_WORD_MODE=2
|
||||||
|
#zstyle ':history-search-multi-word' page-size "$((LINES/2))"
|
||||||
|
#zstyle ':plugin:history-search-multi-word' clear-on-cancel 'yes'
|
||||||
|
#zinit ice if'[[ -z ${ZSH_HISTORY_SEARCH_MULTI_WORD_MODE+set} ]]' \
|
||||||
|
# wait'0' lucid light-mode depth'1' for \
|
||||||
|
# atload"bindkey '^K' history-search-multi-word"
|
||||||
|
#zinit light zdharma-continuum/history-search-multi-word
|
||||||
|
|
20
88-prompt.zsh
Normal file
20
88-prompt.zsh
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
# vim: ft=sh
|
||||||
|
|
||||||
|
if is-at-least 5.3; then
|
||||||
|
zinit ice depth"1" # git clone depth
|
||||||
|
zinit light romkatv/powerlevel10k
|
||||||
|
|
||||||
|
# To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
|
||||||
|
if [[ -r "$ZDOTDIR/.p10k.user.zsh" ]]; then
|
||||||
|
source "$ZDOTDIR/.p10k.user.zsh"
|
||||||
|
else
|
||||||
|
if [[ "$TERM" = "xterm" ]]; then
|
||||||
|
[[ -r "$ZDOTDIR/.p10k.8colors.zsh" ]] && source "$ZDOTDIR/.p10k.8colors.zsh"
|
||||||
|
else
|
||||||
|
[[ -r "$ZDOTDIR/.p10k.zsh" ]] && source "$ZDOTDIR/.p10k.zsh"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
zinit light agkozak/agkozak-zsh-prompt
|
||||||
|
fi
|
3
95-finish.zsh
Normal file
3
95-finish.zsh
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
# vim: ft=sh
|
||||||
|
|
183
README.md
183
README.md
@ -1,36 +1,48 @@
|
|||||||
|
# Быстрая установка
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo apt-get install curl
|
||||||
|
sh -c "$(curl -fsSL https://git.246060.ru/config/zsh/raw/branch/master/install.sh)"
|
||||||
|
```
|
||||||
|
|
||||||
# Установка
|
# Установка
|
||||||
|
|
||||||
Установка необходимых пакетов:
|
Установить оболочку [Zsh](https://www.zsh.org) и git:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo apt-get install zsh antibody
|
sudo apt-get install git zsh curl
|
||||||
```
|
```
|
||||||
|
|
||||||
Установка желательных пакетов:
|
На системах, где нет пакета Zsh или есть только старая версия, можно установить статически
|
||||||
|
скомпилированную версию программы командой:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo apt-get install keychain peco wmctrl xdotool
|
sh -c "$(curl -fsSL https://raw.githubusercontent.com/romkatv/zsh-bin/master/install)"
|
||||||
```
|
```
|
||||||
|
|
||||||
Клонирование репозитория в каталог `~/.config/zsh`:
|
Установить рекомендуемые пакеты:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://git.246060.ru/f1x1t/zshrc ~/.config/zsh
|
sudo apt-get install command-not-found grc grepcidr kitty-terminfo wmctrl xdotool
|
||||||
|
```
|
||||||
|
|
||||||
|
Установить дополнительные программы по [инструкции](https://git.246060.ru/config/eget/).
|
||||||
|
|
||||||
|
|
||||||
|
Клонировать репозиторий с настройками Zsh в каталог `~/.config/zsh`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone https://git.246060.ru/config/zsh ~/.config/zsh
|
||||||
```
|
```
|
||||||
|
|
||||||
# Базовая настройка
|
# Базовая настройка
|
||||||
|
|
||||||
С правами суперпользователя открыть файл `/etc/zsh/zshenv`
|
Создать файл `$HOME/.zshenv` со следующим содержимым:
|
||||||
в редакторе командой
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo ${EDITOR:-mcedit} /etc/zsh/zshenv
|
|
||||||
```
|
|
||||||
|
|
||||||
и добавить строку
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
# Загрузка конфигурации из каталога $ZDOTDIR
|
||||||
export ZDOTDIR=$HOME/.config/zsh
|
export ZDOTDIR=$HOME/.config/zsh
|
||||||
|
source $ZDOTDIR/.zshenv
|
||||||
```
|
```
|
||||||
|
|
||||||
Установить интерпретатор Zsh по умолчанию для пользователя `username`.
|
Установить интерпретатор Zsh по умолчанию для пользователя `username`.
|
||||||
@ -39,21 +51,67 @@ export ZDOTDIR=$HOME/.config/zsh
|
|||||||
sudo usermod -s /usr/bin/zsh username
|
sudo usermod -s /usr/bin/zsh username
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Установка шрифтов
|
||||||
|
|
||||||
|
```sh
|
||||||
|
wget -A ".deb" -c -q -np -nd -r -l 1 https://deb.246060.ru/bin/fonts/pool/main/f/fonts-iosevka-prog/
|
||||||
|
wget -A ".deb" -c -q -np -nd -r -l 1 https://deb.246060.ru/bin/fonts/pool/main/f/fonts-iosevka-prog-nerd/
|
||||||
|
sudo dpkg -i fonts*deb
|
||||||
|
```
|
||||||
|
|
||||||
# Настройка агентов
|
# Настройка агентов
|
||||||
|
|
||||||
Существует несколько вариантов настройки агентов для SSH и/или GPG.
|
Существует несколько вариантов настройки агентов для SSH и/или GPG.
|
||||||
Для любого из вариантов следует скопировать шаблонный файл для настроек:
|
Для любого из вариантов следует скопировать шаблонный файл для настроек:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cp ~/.config/zsh/agents.zsh ~/.config/zsh/agents.user.zsh
|
cp ~/.config/zsh/55-agents.zsh ~/.config/zsh/55-agents.user.zsh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Настройка SSH агента
|
||||||
|
|
||||||
|
Установить необходимые пакеты:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo apt install openssh-client
|
||||||
|
```
|
||||||
|
|
||||||
|
Раскомментировать в файле ` ~/.config/zsh/55-agents.user.zsh` строки:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# if command -v ssh-agent >/dev/null 2>&1; then
|
||||||
|
# zstyle :omz:plugins:ssh-agent agent-forwarding on
|
||||||
|
# zstyle :omz:plugins:ssh-agent identities id_rsa
|
||||||
|
# zstyle :omz:plugins:ssh-agent lifetime 10h
|
||||||
|
# zinit snippet OMZP::ssh-agent
|
||||||
|
# fi
|
||||||
|
```
|
||||||
|
|
||||||
|
Добавить в конец файла `~/.ssh/config` правило для разрешения агенту сохранять ключи:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Host *
|
||||||
|
AddKeysToAgent yes
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Настройка GPG агента
|
## Настройка GPG агента
|
||||||
|
|
||||||
Раскомментировать в файле ` ~/.config/zsh/agents.user.zsh` строки:
|
Установить необходимые пакеты:
|
||||||
|
|
||||||
```text
|
```sh
|
||||||
# antibody bundle ohmyzsh/ohmyzsh path:plugins/gpg-agent
|
sudo apt install openssh-client gpg-agent gpgconf
|
||||||
|
```
|
||||||
|
|
||||||
|
Раскомментировать в файле ` ~/.config/zsh/55-agents.user.zsh` строки:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# if command -v gpg-agent >/dev/null 2>&1; then
|
||||||
|
# zinit snippet OMZP::gpg-agent
|
||||||
|
# if command -v gpg-conf >/dev/null 2>&1; then
|
||||||
|
# gpgconf --create-socketdir
|
||||||
|
# fi
|
||||||
|
# fi
|
||||||
```
|
```
|
||||||
|
|
||||||
Пример файла настройки GPG агента `~/.config/gnupg/gpg-agent.conf`:
|
Пример файла настройки GPG агента `~/.config/gnupg/gpg-agent.conf`:
|
||||||
@ -69,43 +127,80 @@ pinentry-program /usr/bin/pinentry-qt
|
|||||||
```
|
```
|
||||||
|
|
||||||
Чтобы включить в GPG агенте поддержку SSH, нужно раскомментировать
|
Чтобы включить в GPG агенте поддержку SSH, нужно раскомментировать
|
||||||
последнюю строку.
|
последнюю строку и отредактировать файл `~/.ssh/config`, как это описано
|
||||||
|
в разделе настройки SSH.
|
||||||
|
|
||||||
## Настройка SSH агента
|
|
||||||
|
|
||||||
Раскомментировать в файле ` ~/.config/zsh/agents.user.zsh` строки:
|
|
||||||
|
|
||||||
```text
|
|
||||||
# zstyle :omz:plugins:ssh-agent agent-forwarding on
|
|
||||||
# zstyle :omz:plugins:ssh-agent identities id_rsa
|
|
||||||
# zstyle :omz:plugins:ssh-agent lifetime 10h
|
|
||||||
# antibody bundle ohmyzsh/ohmyzsh path:plugins/ssh-agent
|
|
||||||
```
|
|
||||||
|
|
||||||
Добавить в конец файла `~/.ssh/config` правило для разрешения агенту сохранять ключи:
|
|
||||||
|
|
||||||
```text
|
|
||||||
Host *
|
|
||||||
AddKeysToAgent yes
|
|
||||||
IdentityFile ~/.ssh/id_rsa
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Настройка Keychain
|
## Настройка Keychain
|
||||||
|
|
||||||
Программа Keychain позволит использовать агенты GPG и SSH между входами в систему.
|
Программа Keychain позволит использовать агенты GPG и SSH между входами в систему.
|
||||||
Для её работы необходимо отключить в системе все автоматические запуски агентов,
|
Для её работы необходимо отключить в системе все автоматические запуски агентов,
|
||||||
например в файле `/etc/X11/Xsession.options`.
|
например в файле `/etc/X11/Xsession.options` удалить строку:
|
||||||
|
|
||||||
Раскомментировать в файле ` ~/.config/zsh/agents.user.zsh` строки:
|
```sh
|
||||||
|
use-ssh-agent
|
||||||
|
```
|
||||||
|
|
||||||
```text
|
Установить необходимые пакеты:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo apt install keychain openssh-client gpg-agent gpgconf
|
||||||
|
```
|
||||||
|
|
||||||
|
Раскомментировать в файле ` ~/.config/zsh/55-agents.user.zsh` строки:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# if command -v keychain >/dev/null 2>&1; then
|
||||||
# zstyle :omz:plugins:keychain identities id_rsa 01234567
|
# zstyle :omz:plugins:keychain identities id_rsa 01234567
|
||||||
# zstyle :omz:plugins:keychain options --quiet --inherit local-once --noask --nocolor --quick
|
# zstyle :omz:plugins:keychain options --quiet --inherit any-once --noask --nocolor --absolute --dir ~/.cache/keychain
|
||||||
# zstyle :omz:plugins:keychain agents gpg,ssh
|
# zstyle :omz:plugins:keychain agents gpg,ssh
|
||||||
# antibody bundle ohmyzsh/ohmyzsh path:plugins/keychain
|
# zinit snippet OMZP::keychain
|
||||||
|
# fi
|
||||||
```
|
```
|
||||||
|
|
||||||
Отредактировать файлы настроек для агента GPG и SSH, как это описано в разделах выше.
|
Отредактировать файлы настроек для агента GPG и SSH, как это описано в разделах выше.
|
||||||
|
|
||||||
|
|
||||||
|
## Инициализация
|
||||||
|
|
||||||
|
После редактирования файлов настройки запустить `zsh`. Автоматически будет загружен
|
||||||
|
менеджер [zinit](https://github.com/zdharma-continuum/zinit) и необходимые плагины.
|
||||||
|
|
||||||
|
|
||||||
|
## Обновление
|
||||||
|
|
||||||
|
Обновление `zinit` и плагинов:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
zu
|
||||||
|
````
|
||||||
|
|
||||||
|
## Устранение проблем
|
||||||
|
|
||||||
|
Для решения некоторых проблем необходимо загрузить файл с дополнительными
|
||||||
|
командами в терминале:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
source $HOME/.config/zsh/fixes.zsh
|
||||||
|
```
|
||||||
|
|
||||||
|
Если в системе установлена программа `fzf` версии ниже `0.53.0`, то может
|
||||||
|
не работать поиск по истории, файлам и автодополнение. Исправление:
|
||||||
|
|
||||||
|
```
|
||||||
|
fix-update-fzf
|
||||||
|
```
|
||||||
|
|
||||||
|
Для обеспечения поддержки терминала `kitty` на системах, где недоступно
|
||||||
|
его описание, можно выполнить команду:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
fix-kitty-terminal-support
|
||||||
|
```
|
||||||
|
|
||||||
|
Для исправления работы файлового менеджера Midnight Commander в терминале
|
||||||
|
`kitty`, можно выполнить команду:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
fix-mc-kitty-support -f
|
||||||
|
```
|
||||||
|
23
agents.zsh
23
agents.zsh
@ -1,23 +0,0 @@
|
|||||||
# Copy this file to agents.user.zsh and modify to your needs
|
|
||||||
|
|
||||||
##
|
|
||||||
# SSH agent
|
|
||||||
##
|
|
||||||
# zstyle :omz:plugins:ssh-agent agent-forwarding on
|
|
||||||
# zstyle :omz:plugins:ssh-agent identities id_rsa
|
|
||||||
# zstyle :omz:plugins:ssh-agent lifetime 10h
|
|
||||||
# antibody bundle ohmyzsh/ohmyzsh path:plugins/ssh-agent
|
|
||||||
|
|
||||||
##
|
|
||||||
# GPG agent
|
|
||||||
##
|
|
||||||
# antibody bundle ohmyzsh/ohmyzsh path:plugins/gpg-agent
|
|
||||||
|
|
||||||
##
|
|
||||||
# Keychain
|
|
||||||
##
|
|
||||||
# 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
|
|
||||||
# antibody bundle ohmyzsh/ohmyzsh path:plugins/keychain
|
|
||||||
|
|
12
aliases.zsh
12
aliases.zsh
@ -1,12 +0,0 @@
|
|||||||
# Dotdrop
|
|
||||||
alias dotdrop="$HOME/etc/dotdrop.sh" --cfg="$HOME/etc/config.yaml"
|
|
||||||
|
|
||||||
# APT
|
|
||||||
alias u='sudo apt-get update && sudo apt-get dist-upgrade'
|
|
||||||
|
|
||||||
# Youtube
|
|
||||||
alias ydlbest="youtube-dl --merge-output-format mkv -f 'bestvideo+bestaudio'"
|
|
||||||
|
|
||||||
# feh
|
|
||||||
alias feh="feh --cache-size 256 --version-sort --sort filename --image-bg black"
|
|
||||||
|
|
22
env.zsh
22
env.zsh
@ -1,22 +0,0 @@
|
|||||||
export XDG_CONFIG_HOME=$HOME/.config
|
|
||||||
export XDG_CACHE_HOME=$HOME/.cache
|
|
||||||
export XDG_DATA_HOME=$HOME/.local/share
|
|
||||||
|
|
||||||
export PATH=$HOME/bin:$HOME/.local/bin:$PATH
|
|
||||||
|
|
||||||
# Удалить дубликаты в PATH
|
|
||||||
typeset -U PATH
|
|
||||||
|
|
||||||
export GNUPGHOME=$HOME/.config/gnupg
|
|
||||||
export SVDIR=$HOME/sv
|
|
||||||
|
|
||||||
# Настройка uncrustify
|
|
||||||
UNCRUSTIFY_CONFIG="${XDG_CONFIG_HOME}/uncrustify/default.cfg"
|
|
||||||
[ -e "${UNCRUSTIFY_CONFIG}" ] && export UNCRUSTIFY_CONFIG
|
|
||||||
|
|
||||||
# Настройка компилятора Intel (если установлен)
|
|
||||||
[ -e /opt/intel/bin/compilervars.sh ] && source /opt/intel/bin/compilervars.sh intel64 > /dev/null
|
|
||||||
[ -e /opt/intel/vtune_amplifier/amplxe-vars.sh ] && source /opt/intel/vtune_amplifier/amplxe-vars.sh > /dev/null
|
|
||||||
[ -e /opt/intel/inspector/inspxe-vars.sh ] && source /opt/intel/inspector/inspxe-vars.sh > /dev/null
|
|
||||||
[ -e /opt/intel/advisor/advixe-vars.sh ] && source /opt/intel/advisor/advixe-vars.sh > /dev/null
|
|
||||||
|
|
32
fixes.zsh
Normal file
32
fixes.zsh
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Установка файла описания терминала kitty на системы,
|
||||||
|
# где отсутствует пакет kitty-terminfo
|
||||||
|
fix-kitty-terminal-support() {
|
||||||
|
mkdir -p $HOME/.terminfo/x
|
||||||
|
curl -fsSL https://github.com/kovidgoyal/kitty/raw/master/terminfo/x/xterm-kitty > $HOME/.terminfo/x/xterm-kitty
|
||||||
|
}
|
||||||
|
|
||||||
|
# Настройка mc для работы в терминале kitty
|
||||||
|
# Необходимо закрыть все экземпляры mc для текущего пользователя
|
||||||
|
# При вызове функции с параметром -f текущие настройки клавиш
|
||||||
|
# для работы mc в терминале kitty будут перезаписаны
|
||||||
|
fix-mc-kitty-support() {
|
||||||
|
local cfg="${HOME}/.config/mc/ini"
|
||||||
|
|
||||||
|
[[ "$1" == "-f" ]] && sed -i '/\[terminal:xterm-kitty\]/,/^$/{d}' "${cfg}"
|
||||||
|
if [ -w "${cfg}" ]; then
|
||||||
|
if ! grep -qF "[terminal:xterm-kitty]" "${cfg}" ; then
|
||||||
|
echo >> "${cfg}"
|
||||||
|
echo "[terminal:xterm-kitty]" >> "${cfg}"
|
||||||
|
echo "copy=xterm" >> "${cfg}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Новые версии плагинов для поиска используют функционал fzf версии 0.54.1.
|
||||||
|
fix-update-fzf() {
|
||||||
|
mkdir -p $HOME/bin
|
||||||
|
wget -O- https://github.com/junegunn/fzf/releases/download/v0.54.1/fzf-0.54.1-linux_amd64.tar.gz | tar -zxf - -C $HOME/bin
|
||||||
|
}
|
||||||
|
|
20
install.sh
Normal file
20
install.sh
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
sudo apt-get install git zsh curl wget
|
||||||
|
git clone https://git.246060.ru/config/zsh $HOME/.config/zsh
|
||||||
|
|
||||||
|
cat <<EOF > $HOME/.zshenv
|
||||||
|
# Загрузка конфигурации из каталога \$ZDOTDIR
|
||||||
|
export ZDOTDIR=\$HOME/.config/zsh
|
||||||
|
source \$ZDOTDIR/.zshenv
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sudo usermod -s $(which zsh) $(whoami)
|
||||||
|
|
||||||
|
TEMP="${XDG_RUNTIME_DIR:-/tmp}"
|
||||||
|
wget -P "$TEMP" -c -r -nd --no-parent -A "fonts-iosevka-prog-nerd_*_all.deb" https://deb.246060.ru/bin/fonts/pool/main/f/fonts-iosevka-prog-nerd/
|
||||||
|
sudo dpkg -i "$TEMP"/fonts-iosevka-prog-nerd_*_all.deb
|
||||||
|
rm -f "$TEMP"/fonts-iosevka-prog-nerd_*_all.deb
|
||||||
|
|
16
options.zsh
16
options.zsh
@ -1,16 +0,0 @@
|
|||||||
# https://github.com/wting/autojump
|
|
||||||
# apt-get install autojump
|
|
||||||
[[ -s /usr/share/autojump/autojump.sh ]] && source /usr/share/autojump/autojump.sh
|
|
||||||
|
|
||||||
# Автодополнение
|
|
||||||
autoload -Uz compinit
|
|
||||||
|
|
||||||
typeset -i updated_at=$(date +'%j' -r ~/.zcompdump 2>/dev/null || stat -f '%Sm' -t '%j' ~/.zcompdump 2>/dev/null)
|
|
||||||
if [ $(date +'%j') != $updated_at ]; then
|
|
||||||
compinit -i
|
|
||||||
else
|
|
||||||
compinit -C -i
|
|
||||||
fi
|
|
||||||
|
|
||||||
zmodload -i zsh/complist
|
|
||||||
|
|
22
plugins.zsh
22
plugins.zsh
@ -1,22 +0,0 @@
|
|||||||
# Менеджер плагинов antibody
|
|
||||||
source <(antibody init)
|
|
||||||
|
|
||||||
# Плагины
|
|
||||||
antibody bundle zdharma/fast-syntax-highlighting
|
|
||||||
antibody bundle zsh-users/zsh-autosuggestions
|
|
||||||
antibody bundle zsh-users/zsh-history-substring-search
|
|
||||||
antibody bundle zsh-users/zsh-completions
|
|
||||||
antibody bundle marzocchi/zsh-notify
|
|
||||||
antibody bundle buonomo/yarn-completion
|
|
||||||
antibody bundle jimeh/zsh-peco-history
|
|
||||||
|
|
||||||
antibody bundle ohmyzsh/ohmyzsh path:plugins/command-not-found
|
|
||||||
antibody bundle ohmyzsh/ohmyzsh path:plugins/common-aliases
|
|
||||||
antibody bundle ohmyzsh/ohmyzsh path:plugins/debian
|
|
||||||
antibody bundle ohmyzsh/ohmyzsh path:plugins/git
|
|
||||||
antibody bundle ohmyzsh/ohmyzsh path:plugins/postgres
|
|
||||||
antibody bundle ohmyzsh/ohmyzsh path:plugins/sudo
|
|
||||||
antibody bundle ohmyzsh/ohmyzsh path:plugins/systemd
|
|
||||||
antibody bundle ohmyzsh/ohmyzsh path:plugins/vim-interaction
|
|
||||||
antibody bundle ohmyzsh/ohmyzsh path:plugins/web-search
|
|
||||||
|
|
31
prompt.zsh
31
prompt.zsh
@ -1,31 +0,0 @@
|
|||||||
# 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
|
|
||||||
|
|
||||||
antibody bundle denysdovhan/spaceship-prompt
|
|
||||||
|
|
Reference in New Issue
Block a user