From c5f634a4e789eef85fcd3ac72f19779d4d87b59e Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Fri, 19 Nov 2021 15:46:22 +0300 Subject: [PATCH] Splitted zsh rc files --- zsh/.zsh/env/005history.zsh | 3 + zsh/.zsh/env/005irc.zsh | 2 + zsh/.zsh/env/005less.zsh | 4 + zsh/.zsh/env/005ls.zsh | 2 + zsh/.zsh/env/005lynx.zsh | 3 + zsh/.zsh/env/005paths.zsh | 18 ++ zsh/.zsh/env/005redo.zsh | 2 + zsh/.zsh/env/005sdcv.zsh | 2 + zsh/.zsh/env/005term.zsh | 4 + zsh/.zsh/env/005xdg.zsh | 4 + zsh/.zsh/env/010c.zsh | 3 + zsh/.zsh/env/010go.zsh | 5 + zsh/.zsh/env/010python.zsh | 3 + zsh/.zsh/env/010tabbed.zsh | 2 + zsh/.zsh/rc/005basic.zsh | 8 + zsh/.zsh/rc/005history.zsh | 3 + zsh/.zsh/rc/005home,end.zsh | 2 + zsh/.zsh/rc/005vi.zsh | 2 + zsh/.zsh/rc/010aliases.zsh | 12 ++ zsh/.zsh/rc/010cd...zsh | 7 + zsh/.zsh/rc/010cf.zsh | 8 + zsh/.zsh/rc/010f.zsh | 3 + zsh/.zsh/rc/010git.zsh | 12 ++ zsh/.zsh/rc/010gpg.zsh | 1 + zsh/.zsh/rc/010grep.zsh | 15 ++ zsh/.zsh/rc/010history.zsh | 13 ++ zsh/.zsh/rc/010mail.zsh | 7 + zsh/.zsh/rc/010mime.zsh | 2 + zsh/.zsh/rc/010popd.zsh | 6 + zsh/.zsh/rc/010ssh.zsh | 6 + zsh/.zsh/rc/010zle.zsh | 3 + zsh/.zsh/rc/010zmv.zsh | 1 + zsh/.zsh/rc/015completion.zsh | 41 +++++ zsh/.zsh/rc/015prompt.zsh | 21 +++ zsh/.zsh/rc/020autosuggestions.zsh | 2 + zsh/.zsh/rc/020highlight.zsh | 13 ++ zsh/.zsh/rc/020zhashd.zsh | 4 + zsh/.zsh/rc/025mc.zsh | 4 + zsh/.zsh/rc/050autoenv.zsh | 1 + zsh/.zshenv | 98 +---------- zsh/.zshrc | 270 +---------------------------- 41 files changed, 257 insertions(+), 365 deletions(-) create mode 100644 zsh/.zsh/env/005history.zsh create mode 100644 zsh/.zsh/env/005irc.zsh create mode 100644 zsh/.zsh/env/005less.zsh create mode 100644 zsh/.zsh/env/005ls.zsh create mode 100644 zsh/.zsh/env/005lynx.zsh create mode 100644 zsh/.zsh/env/005paths.zsh create mode 100644 zsh/.zsh/env/005redo.zsh create mode 100644 zsh/.zsh/env/005sdcv.zsh create mode 100644 zsh/.zsh/env/005term.zsh create mode 100644 zsh/.zsh/env/005xdg.zsh create mode 100644 zsh/.zsh/env/010c.zsh create mode 100644 zsh/.zsh/env/010go.zsh create mode 100644 zsh/.zsh/env/010python.zsh create mode 100644 zsh/.zsh/env/010tabbed.zsh create mode 100644 zsh/.zsh/rc/005basic.zsh create mode 100644 zsh/.zsh/rc/005history.zsh create mode 100644 zsh/.zsh/rc/005home,end.zsh create mode 100644 zsh/.zsh/rc/005vi.zsh create mode 100644 zsh/.zsh/rc/010aliases.zsh create mode 100644 zsh/.zsh/rc/010cd...zsh create mode 100644 zsh/.zsh/rc/010cf.zsh create mode 100644 zsh/.zsh/rc/010f.zsh create mode 100644 zsh/.zsh/rc/010git.zsh create mode 100644 zsh/.zsh/rc/010gpg.zsh create mode 100644 zsh/.zsh/rc/010grep.zsh create mode 100644 zsh/.zsh/rc/010history.zsh create mode 100644 zsh/.zsh/rc/010mail.zsh create mode 100644 zsh/.zsh/rc/010mime.zsh create mode 100644 zsh/.zsh/rc/010popd.zsh create mode 100644 zsh/.zsh/rc/010ssh.zsh create mode 100644 zsh/.zsh/rc/010zle.zsh create mode 100644 zsh/.zsh/rc/010zmv.zsh create mode 100644 zsh/.zsh/rc/015completion.zsh create mode 100644 zsh/.zsh/rc/015prompt.zsh create mode 100644 zsh/.zsh/rc/020autosuggestions.zsh create mode 100644 zsh/.zsh/rc/020highlight.zsh create mode 100644 zsh/.zsh/rc/020zhashd.zsh create mode 100644 zsh/.zsh/rc/025mc.zsh create mode 100644 zsh/.zsh/rc/050autoenv.zsh diff --git a/zsh/.zsh/env/005history.zsh b/zsh/.zsh/env/005history.zsh new file mode 100644 index 0000000..9feeea0 --- /dev/null +++ b/zsh/.zsh/env/005history.zsh @@ -0,0 +1,3 @@ +HISTFILE=~/secure/.history +HISTSIZE=10240 +SAVEHIST=10240 diff --git a/zsh/.zsh/env/005irc.zsh b/zsh/.zsh/env/005irc.zsh new file mode 100644 index 0000000..743e10c --- /dev/null +++ b/zsh/.zsh/env/005irc.zsh @@ -0,0 +1,2 @@ +export IRCNAME="Sergey Matveev" +export IRCNICK="stargrave" diff --git a/zsh/.zsh/env/005less.zsh b/zsh/.zsh/env/005less.zsh new file mode 100644 index 0000000..a5b2212 --- /dev/null +++ b/zsh/.zsh/env/005less.zsh @@ -0,0 +1,4 @@ +export PAGER=less +export LESSHISTFILE=/tmp/.lesshst +export LESS=RWXij2 +export LESS=${LESS}"Ps?f%f .?m(%i/%m) .%lt-%lb?L/%L. [%bB?B/%B.]?B %pB\%.?x N\:%x.%t" diff --git a/zsh/.zsh/env/005ls.zsh b/zsh/.zsh/env/005ls.zsh new file mode 100644 index 0000000..eb6174a --- /dev/null +++ b/zsh/.zsh/env/005ls.zsh @@ -0,0 +1,2 @@ +export CLICOLOR=1 +export LSCOLORS=BxGxcxdxCxegDxabagacad diff --git a/zsh/.zsh/env/005lynx.zsh b/zsh/.zsh/env/005lynx.zsh new file mode 100644 index 0000000..fd8e522 --- /dev/null +++ b/zsh/.zsh/env/005lynx.zsh @@ -0,0 +1,3 @@ +export WWW_HOME=file:///home/stargrave/.lynx_bookmarks.html +export SSL_CERT_FILE=/usr/local/openssl/cert.pem +export LYNX_CFG=~/.lynx.cfg diff --git a/zsh/.zsh/env/005paths.zsh b/zsh/.zsh/env/005paths.zsh new file mode 100644 index 0000000..4ad8fdd --- /dev/null +++ b/zsh/.zsh/env/005paths.zsh @@ -0,0 +1,18 @@ +path=(~/bin ~/local/bin /usr/local/bin /usr/local/sbin /usr/bin /usr/sbin /bin /sbin) +manpath=( + ~/local/share/man + /usr/local/lib/perl5/5.26/perl/man + /usr/local/lib/perl5/site_perl/man + /usr/share/openssl/man + /usr/local/share/man + /usr/local/man + /usr/share/man +) +export -TU INFOPATH infopath +infopath=(~/local/share/info /usr/local/share/info /usr/local/info) + +export -TU PKG_CONFIG_PATH pkg_config_path +pkg_config_path=(~/local/lib/pkgconfig ~/local/libdata/pkgconfig) + +export -TU LD_LIBRARY_PATH ld_library_path +ld_library_path=(~/local/lib) diff --git a/zsh/.zsh/env/005redo.zsh b/zsh/.zsh/env/005redo.zsh new file mode 100644 index 0000000..504970d --- /dev/null +++ b/zsh/.zsh/env/005redo.zsh @@ -0,0 +1,2 @@ +export REDO_JOBS=8 +export REDO_NO_SYNC=1 diff --git a/zsh/.zsh/env/005sdcv.zsh b/zsh/.zsh/env/005sdcv.zsh new file mode 100644 index 0000000..41ea215 --- /dev/null +++ b/zsh/.zsh/env/005sdcv.zsh @@ -0,0 +1,2 @@ +export STARDICT_DATA_DIR=~/dic +export SDCV_HISTSIZE=0 diff --git a/zsh/.zsh/env/005term.zsh b/zsh/.zsh/env/005term.zsh new file mode 100644 index 0000000..59115b7 --- /dev/null +++ b/zsh/.zsh/env/005term.zsh @@ -0,0 +1,4 @@ +export COLORFGBG="default;default;0" +export COLORTERM=xterm-256color +[ "$TERM" = "screen-256color" ] || TERM=xterm-256color +export TERM diff --git a/zsh/.zsh/env/005xdg.zsh b/zsh/.zsh/env/005xdg.zsh new file mode 100644 index 0000000..bedcce7 --- /dev/null +++ b/zsh/.zsh/env/005xdg.zsh @@ -0,0 +1,4 @@ +export XDG_CACHE_HOME=/tmp/stargrave-xdg +export XDG_CONFIG_HOME=/tmp/stargrave-xdg +export XDG_DATA_HOME=/tmp/stargrave-xdg +export XDG_RUNTIME_DIR=/tmp/stargrave-xdg diff --git a/zsh/.zsh/env/010c.zsh b/zsh/.zsh/env/010c.zsh new file mode 100644 index 0000000..9f65236 --- /dev/null +++ b/zsh/.zsh/env/010c.zsh @@ -0,0 +1,3 @@ +cflags=(-I$HOME/local/include -I/usr/local/include -I/usr/local/include/PCSC) +ldflags=(-L$HOME/local/lib -L/usr/local/lib) +export CFLAGS="${(j: :)cflags}" LDFLAGS="${(j: :)ldflags}" diff --git a/zsh/.zsh/env/010go.zsh b/zsh/.zsh/env/010go.zsh new file mode 100644 index 0000000..11ef3ff --- /dev/null +++ b/zsh/.zsh/env/010go.zsh @@ -0,0 +1,5 @@ +export GOCACHE=/tmp/go-cache +export GOPROXY=off +export GOSUMDB=off +export GOPATH=~/work/gopath +path=($GOPATH/bin ~/work/go/bin $path) diff --git a/zsh/.zsh/env/010python.zsh b/zsh/.zsh/env/010python.zsh new file mode 100644 index 0000000..7c1ab3a --- /dev/null +++ b/zsh/.zsh/env/010python.zsh @@ -0,0 +1,3 @@ +export PIP_RESPECT_VIRTUALENV=true +export VIRTUAL_ENV_DISABLE_PROMPT=1 +export PYTHONDONTWRITEBYTECODE=1 diff --git a/zsh/.zsh/env/010tabbed.zsh b/zsh/.zsh/env/010tabbed.zsh new file mode 100644 index 0000000..b574aa5 --- /dev/null +++ b/zsh/.zsh/env/010tabbed.zsh @@ -0,0 +1,2 @@ +manpath=(~/src/suckless/tabbed $manpath) +path=(~/src/suckless/tabbed $path) diff --git a/zsh/.zsh/rc/005basic.zsh b/zsh/.zsh/rc/005basic.zsh new file mode 100644 index 0000000..71d696b --- /dev/null +++ b/zsh/.zsh/rc/005basic.zsh @@ -0,0 +1,8 @@ +setopt GLOB_STAR_SHORT GLOB_DOTS EXTENDED_GLOB +setopt NO_NOMATCH +setopt AUTO_PUSHD PUSHD_IGNORE_DUPS +setopt PIPE_FAIL +setopt MULTIBYTE + +setopt RM_STAR_SILENT +export LISTMAX=9999 diff --git a/zsh/.zsh/rc/005history.zsh b/zsh/.zsh/rc/005history.zsh new file mode 100644 index 0000000..8ecf82b --- /dev/null +++ b/zsh/.zsh/rc/005history.zsh @@ -0,0 +1,3 @@ +setopt APPEND_HISTORY SHARE_HISTORY INC_APPEND_HISTORY HIST_IGNORE_ALL_DUPS +setopt HIST_IGNORE_SPACE +HISTORY_IGNORE="(yt* *|t *|t|sdcv *|mmfileget *|arr)" diff --git a/zsh/.zsh/rc/005home,end.zsh b/zsh/.zsh/rc/005home,end.zsh new file mode 100644 index 0000000..d39aa72 --- /dev/null +++ b/zsh/.zsh/rc/005home,end.zsh @@ -0,0 +1,2 @@ +bindkey "^[[1~" beginning-of-line # Home +bindkey "^[[4~" end-of-line # End diff --git a/zsh/.zsh/rc/005vi.zsh b/zsh/.zsh/rc/005vi.zsh new file mode 100644 index 0000000..3a6d608 --- /dev/null +++ b/zsh/.zsh/rc/005vi.zsh @@ -0,0 +1,2 @@ +bindkey -v +export KEYTIMEOUT=1 diff --git a/zsh/.zsh/rc/010aliases.zsh b/zsh/.zsh/rc/010aliases.zsh new file mode 100644 index 0000000..07216a2 --- /dev/null +++ b/zsh/.zsh/rc/010aliases.zsh @@ -0,0 +1,12 @@ +alias l="ls -AF " +alias ll="ls -D \"%Y-%m-%d %H:%M\" -AFl " +alias vi="vim" +alias m="less " +alias -g M="| less" +alias -g W="| wc -l | sed 's/ //g'" +alias -g T="| tai64nlocal" +alias -g DN=">/dev/null" +alias -g 2DN="2>/dev/null" +alias -g DNA=">&/dev/null" +alias mc="mc --nomouse" +alias gpgkr="gpg --no-default-keyring --keyring " diff --git a/zsh/.zsh/rc/010cd...zsh b/zsh/.zsh/rc/010cd...zsh new file mode 100644 index 0000000..9fbc4de --- /dev/null +++ b/zsh/.zsh/rc/010cd...zsh @@ -0,0 +1,7 @@ +cddotdot() { + cd .. + pwd + zle reset-prompt +} +zle -N cddotdot +bindkey "OQ" cddotdot # F2 diff --git a/zsh/.zsh/rc/010cf.zsh b/zsh/.zsh/rc/010cf.zsh new file mode 100644 index 0000000..757409b --- /dev/null +++ b/zsh/.zsh/rc/010cf.zsh @@ -0,0 +1,8 @@ +cf() { + local dir=$(bfs -L ${1:-.} -mindepth 1 \ + -path "*/\.git" -prune -o \ + -path "*/\.redo" -prune -o \ + -type d -print 2>/dev/null | + fzf --height 40% --reverse --preview="tree -CN {}") + [[ -z $dir ]] || { print -s cd $dir ; cd $dir } +} diff --git a/zsh/.zsh/rc/010f.zsh b/zsh/.zsh/rc/010f.zsh new file mode 100644 index 0000000..3626ac5 --- /dev/null +++ b/zsh/.zsh/rc/010f.zsh @@ -0,0 +1,3 @@ +f() { + bfs . -name "*$1*" -print +} diff --git a/zsh/.zsh/rc/010git.zsh b/zsh/.zsh/rc/010git.zsh new file mode 100644 index 0000000..70e5167 --- /dev/null +++ b/zsh/.zsh/rc/010git.zsh @@ -0,0 +1,12 @@ +alias Ga="git add" +alias Gb="git branch" +alias Gc="git checkout" +alias Gd="git diff" +alias Gdc="git diff --cached" +alias Gs="git show --show-signature" +alias Gm="git diff --name-only --diff-filter=M --relative" +alias Gam="git commit --amend" +alias Gl="git log --oneline --graph --decorate=short" +alias Gld="git log --format=format:'%ai %Cgreen%h%Creset %s'" + +bindkey -s "OR" " git status --short\n" # F3 diff --git a/zsh/.zsh/rc/010gpg.zsh b/zsh/.zsh/rc/010gpg.zsh new file mode 100644 index 0000000..9b7b42d --- /dev/null +++ b/zsh/.zsh/rc/010gpg.zsh @@ -0,0 +1 @@ +export GPG_TTY=$(tty) diff --git a/zsh/.zsh/rc/010grep.zsh b/zsh/.zsh/rc/010grep.zsh new file mode 100644 index 0000000..e2d979e --- /dev/null +++ b/zsh/.zsh/rc/010grep.zsh @@ -0,0 +1,15 @@ +GREP_ARGS=( + --devices=skip + --colour=always + --with-filename + --line-number + --dereference-recursive + --binary-files=without-match + --exclude-dir=.git + --exclude-dir=.tags +) +g() { + grep $GREP_ARGS $@ | less +} +alias -g G="| grep --colour=always" +alias gg="git grep " diff --git a/zsh/.zsh/rc/010history.zsh b/zsh/.zsh/rc/010history.zsh new file mode 100644 index 0000000..1a0a9e6 --- /dev/null +++ b/zsh/.zsh/rc/010history.zsh @@ -0,0 +1,13 @@ +autoload -U history-search-end +zle -N history-beginning-search-backward-end history-search-end +zle -N history-beginning-search-forward-end history-search-end +bindkey "^[[A" history-beginning-search-backward-end +bindkey "^[[B" history-beginning-search-forward-end + +beginning-history-incremental-pattern-search-backward() { + zle history-incremental-pattern-search-backward ${BUFFER:gs/ /*/} +} +zle -N beginning-history-incremental-pattern-search-backward +bindkey "^[[1;2A" beginning-history-incremental-pattern-search-backward +bindkey -M isearch "^[[A" history-incremental-pattern-search-backward +bindkey -M isearch "^[[B" history-incremental-pattern-search-forward diff --git a/zsh/.zsh/rc/010mail.zsh b/zsh/.zsh/rc/010mail.zsh new file mode 100644 index 0000000..ee26e44 --- /dev/null +++ b/zsh/.zsh/rc/010mail.zsh @@ -0,0 +1,7 @@ +mailpath=( + ~/mail/mbox"?Neue Nachrichten in =mbox" + ~/mail/arbeit"?Neue Nachrichten in =arbeit" +) +alias arr="mutt -f =arbeit -e 'source ~/.mutt/accounts/stcnet.ru'" +alias sent="mutt -f =sent-\`date '+%y-%m'\`" +bindkey -s "OP" " inc\n" # F1 diff --git a/zsh/.zsh/rc/010mime.zsh b/zsh/.zsh/rc/010mime.zsh new file mode 100644 index 0000000..5711884 --- /dev/null +++ b/zsh/.zsh/rc/010mime.zsh @@ -0,0 +1,2 @@ +autoload -U zsh-mime-setup ; zsh-mime-setup +alias -s html=lynx diff --git a/zsh/.zsh/rc/010popd.zsh b/zsh/.zsh/rc/010popd.zsh new file mode 100644 index 0000000..4952b1f --- /dev/null +++ b/zsh/.zsh/rc/010popd.zsh @@ -0,0 +1,6 @@ +popdquiet() { + popd + zle reset-prompt +} +zle -N popdquiet +bindkey "OS" popdquiet # F4 diff --git a/zsh/.zsh/rc/010ssh.zsh b/zsh/.zsh/rc/010ssh.zsh new file mode 100644 index 0000000..1d25770 --- /dev/null +++ b/zsh/.zsh/rc/010ssh.zsh @@ -0,0 +1,6 @@ +alias ssh="TERM=xterm ssh" +alias sshnm="ssh -S none" +ssht() { + local t="-t 0" + TERM=xterm ssh -C -t $1 "tmux has-session $t && tmux attach-session $t || tmux new-session $t" +} diff --git a/zsh/.zsh/rc/010zle.zsh b/zsh/.zsh/rc/010zle.zsh new file mode 100644 index 0000000..c132dfb --- /dev/null +++ b/zsh/.zsh/rc/010zle.zsh @@ -0,0 +1,3 @@ +autoload -U edit-command-line +zle -N edit-command-line +bindkey -M vicmd v edit-command-line diff --git a/zsh/.zsh/rc/010zmv.zsh b/zsh/.zsh/rc/010zmv.zsh new file mode 100644 index 0000000..227c5e7 --- /dev/null +++ b/zsh/.zsh/rc/010zmv.zsh @@ -0,0 +1 @@ +autoload -U zmv diff --git a/zsh/.zsh/rc/015completion.zsh b/zsh/.zsh/rc/015completion.zsh new file mode 100644 index 0000000..98d2283 --- /dev/null +++ b/zsh/.zsh/rc/015completion.zsh @@ -0,0 +1,41 @@ +zstyle ":completion:*" list-colors "" + +zstyle ":completion:*:functions" ignored-patterns "_*" +zstyle ":completion:*:manuals" separate-sections true + +zstyle ":completion:*" group-name "" +zstyle ":completion:*:messages" format "%d" +zstyle ":completion:*:warnings" format "%F{red}no matches: %d%f" +zstyle ":completion:*:*:*:*:descriptions" format "%B... %d%b" +zstyle ":completion:*:files:*:*:descriptions" format "" + +zstyle ":completion:*" file-patterns "%p:globbed" "*" +zstyle ":completion:*" matcher-list "" "m:{a-z-}={A-Z_}" "r:|?=** m:{a-z-}={A-Z_}" +zstyle ":completion:*:man:*:*:*" matcher-list "" "m:{a-zA-Z}={A-Za-z} l:|=* r:|=*" +zstyle ":completion:*" completer _mycomp _mycomp_man:man _parameters _ignored + +_mycomp () { + [[ $CURRENT -eq 1 ]] && curcontext="${curcontext%:*:*}:-command-:" \ + _command_names && return + [[ $IPREFIX =~ ~.* ]] && _tilde && return + local has_files + curcontext=:files:${curcontext#:*:} _files && has_files=1 + [[ $has_files ]] && return + + # MAGIC_EQUAL_SUBST {{{ + [[ $PREFIX = *\=* ]] || return 1 + compstate[parameter]=${PREFIX%%\=*} + compset -P 1 "*=" + _value + # }}} +} + +_mycomp_man () { + [[ ${words[1]} == man ]] && curcontext=:man:${curcontext#:*:} \ + _dispatch "" man man "" -default- && _value && return + [[ ${words[1]} == info ]] && curcontext=:info:${curcontext#:*:} \ + _dispatch "" info info "" -default- && return +} + +autoload -U compinit ; compinit -d /tmp/.zcompdump +autoload -U complist diff --git a/zsh/.zsh/rc/015prompt.zsh b/zsh/.zsh/rc/015prompt.zsh new file mode 100644 index 0000000..cdbd0fa --- /dev/null +++ b/zsh/.zsh/rc/015prompt.zsh @@ -0,0 +1,21 @@ +function zle-line-init zle-keymap-select { + local state="%#" timer_val="?" + [[ ${KEYMAP} == vicmd ]] && state="+" + [[ $timer ]] && timer_val=$(( $SECONDS - $timer )) + prompt="%2~ " + prompt+="%U${timer_val}%u|" + prompt+="%B%?%b" + prompt+="%B%F{magenta}${state}%f%b " + PS1=$prompt + zle reset-prompt +} +zle -N zle-line-init +zle -N zle-keymap-select + +preexec() { + timer=$SECONDS +} + +precmd() { + printf "\a\033]2;\033\\" +} diff --git a/zsh/.zsh/rc/020autosuggestions.zsh b/zsh/.zsh/rc/020autosuggestions.zsh new file mode 100644 index 0000000..f54e883 --- /dev/null +++ b/zsh/.zsh/rc/020autosuggestions.zsh @@ -0,0 +1,2 @@ +. ~/work/zsh-autosuggestions/zsh-autosuggestions.zsh +ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=cyan" diff --git a/zsh/.zsh/rc/020highlight.zsh b/zsh/.zsh/rc/020highlight.zsh new file mode 100644 index 0000000..53a4595 --- /dev/null +++ b/zsh/.zsh/rc/020highlight.zsh @@ -0,0 +1,13 @@ +ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets) +. ~/work/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +typeset -A ZSH_HIGHLIGHT_STYLES +ZSH_HIGHLIGHT_STYLES[assign]="fg=yellow" +ZSH_HIGHLIGHT_STYLES[commandseparator]="fg=red" +ZSH_HIGHLIGHT_STYLES[single-hyphen-option]="fg=green,bold" +ZSH_HIGHLIGHT_STYLES[double-hyphen-option]="fg=green" +ZSH_HIGHLIGHT_STYLES[globbing]="fg=magenta" +ZSH_HIGHLIGHT_STYLES[global-alias]="fg=yellow,bold" +ZSH_HIGHLIGHT_STYLES[history-expansion]="fg=magenta" +ZSH_HIGHLIGHT_STYLES[redirection]="fg=red" +ZSH_HIGHLIGHT_STYLES[path]="fg=white,underline" +ZSH_HIGHLIGHT_STYLES[path_pathseparator]="fg=white,bold,underline" diff --git a/zsh/.zsh/rc/020zhashd.zsh b/zsh/.zsh/rc/020zhashd.zsh new file mode 100644 index 0000000..1f51fa6 --- /dev/null +++ b/zsh/.zsh/rc/020zhashd.zsh @@ -0,0 +1,4 @@ +while read w ; do + w=(${(s/=/)w}) + hash -d ${w[1]}=${~${w[2]}} +done < ~/.zsh/hashd diff --git a/zsh/.zsh/rc/025mc.zsh b/zsh/.zsh/rc/025mc.zsh new file mode 100644 index 0000000..1ca9106 --- /dev/null +++ b/zsh/.zsh/rc/025mc.zsh @@ -0,0 +1,4 @@ +[ -s $XDG_CONFIG_HOME/mc/mc.ext ] || { + mkdir $XDG_CONFIG_HOME/mc/ + cp ~dot/mc/mc.ext $XDG_CONFIG_HOME/mc/ +} diff --git a/zsh/.zsh/rc/050autoenv.zsh b/zsh/.zsh/rc/050autoenv.zsh new file mode 100644 index 0000000..fb17d89 --- /dev/null +++ b/zsh/.zsh/rc/050autoenv.zsh @@ -0,0 +1 @@ +. ~/work/zsh-autoenv/autoenv.zsh diff --git a/zsh/.zshenv b/zsh/.zshenv index 555946e..6a5dc6f 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -1,97 +1,5 @@ -# vim: foldmethod=marker:foldlevel=0 +for z (~/.zsh/env/*(on)) . $z -# History {{{ -HISTFILE=~/secure/.history -HISTSIZE=10240 -SAVEHIST=10240 -# }}} - -# Terminal {{{ -export COLORFGBG="default;default;0" -export COLORTERM=xterm-256color -[ "$TERM" = "screen-256color" ] || TERM=xterm-256color -export TERM -# }}} - -# Less options {{{ -export PAGER=less -export LESSHISTFILE=/tmp/.lesshst -export LESS=RWXij2 -export LESS=${LESS}"Ps?f%f .?m(%i/%m) .%lt-%lb?L/%L. [%bB?B/%B.]?B %pB\%.?x N\:%x.%t" -# }}} - -# ls options {{{ -export CLICOLOR=1 -export LSCOLORS=BxGxcxdxCxegDxabagacad -# }}} - -# Lynx options {{{ -export WWW_HOME=file:///home/stargrave/.lynx_bookmarks.html -export SSL_CERT_FILE=/usr/local/openssl/cert.pem -export LYNX_CFG=~/.lynx.cfg -# }}} - -# sdcv options {{{ -export STARDICT_DATA_DIR=~/dic -export SDCV_HISTSIZE=0 -# }}} - -# IRC options {{{ -export IRCNAME="Sergey Matveev" -export IRCNICK="stargrave" -# }}} - -# XDG related junk {{{ -export XDG_CACHE_HOME=/tmp/stargrave-xdg -export XDG_CONFIG_HOME=/tmp/stargrave-xdg -export XDG_DATA_HOME=/tmp/stargrave-xdg -export XDG_RUNTIME_DIR=/tmp/stargrave-xdg -# }}} - -# Paths {{{ -path=(~/bin ~/local/bin /usr/local/bin /usr/local/sbin /usr/bin /usr/sbin /bin /sbin) -manpath=( - ~/local/share/man - /usr/local/lib/perl5/5.26/perl/man - /usr/local/lib/perl5/site_perl/man - /usr/share/openssl/man - /usr/local/share/man - /usr/local/man - /usr/share/man -) -export -TU INFOPATH infopath -infopath=(~/local/share/info /usr/local/share/info /usr/local/info) - -manpath=(~/src/suckless/tabbed $manpath) -path=(~/src/suckless/tabbed $path) - -export -TU PKG_CONFIG_PATH pkg_config_path -pkg_config_path=(~/local/lib/pkgconfig ~/local/libdata/pkgconfig) -# }}} - -# Python options {{{ -export PIP_RESPECT_VIRTUALENV=true -export VIRTUAL_ENV_DISABLE_PROMPT=1 -export PYTHONDONTWRITEBYTECODE=1 -# }}} - -# Go related {{{ -export GOCACHE=/tmp/go-cache -export GOPROXY=off -export GOSUMDB=off -export GOPATH=~/work/gopath -path=($GOPATH/bin ~/work/go/bin $path) -# }}} - -# C related {{{ -cflags=(-I$HOME/local/include -I/usr/local/include -I/usr/local/include/PCSC) -ldflags=(-L$HOME/local/lib -L/usr/local/lib) -export CFLAGS="${(j: :)cflags}" LDFLAGS="${(j: :)ldflags}" -export -TU LD_LIBRARY_PATH ld_library_path -ld_library_path=(~/local/lib) -# }}} - -# Various {{{ export SHELL=/bin/zsh export EDITOR=vim export TZ=Europe/Moscow @@ -100,10 +8,8 @@ export SSH_AUTH_SOCK=~/.ssh/agent export MAILDIR=~/mail export DBUS_SESSION_BUS_ADDRESS=disabled: export MYSQL_HISTFILE=/tmp/.mysql_history -export REDO_JOBS=8 REDO_NO_SYNC=1 export SHARNESS_TEST_SRCDIR=~/local/stow/sharness/share/sharness export FZF_DEFAULT_OPTS="--color=16 --info=inline" -export AUTOENV_AUTH_FILE=~/.zautoenv-auth +export AUTOENV_AUTH_FILE=~/.zsh/autoenv-auth export TIMEFMT="user:%U sys:%S mem:%K/%M io:%I/%O %*E" export RLWRAP_HOME=/tmp -# }}} diff --git a/zsh/.zshrc b/zsh/.zshrc index 2927a91..55c0ce1 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,269 +1 @@ -# vim: foldmethod=marker:foldlevel=0 - -# Basic options {{{ -setopt GLOB_STAR_SHORT GLOB_DOTS EXTENDED_GLOB -setopt NO_NOMATCH -setopt AUTO_PUSHD PUSHD_IGNORE_DUPS -setopt PIPE_FAIL -setopt MULTIBYTE - -setopt RM_STAR_SILENT -export LISTMAX=9999 -# }}} - -# History options {{{ -setopt APPEND_HISTORY SHARE_HISTORY INC_APPEND_HISTORY HIST_IGNORE_ALL_DUPS -setopt HIST_IGNORE_SPACE -HISTORY_IGNORE="(yt* *|t *|t|sdcv *|mmfileget *|arr)" -# }}} - -# Vi mode {{{ -bindkey -v -export KEYTIMEOUT=1 -# }}} - -# Home/end {{{ -bindkey "^[[1~" beginning-of-line # Home -bindkey "^[[4~" end-of-line # End -# }}} - -# Command-line editing {{{ -autoload -U edit-command-line -zle -N edit-command-line -bindkey -M vicmd v edit-command-line -# }}} - -# History search {{{ -autoload -U history-search-end -zle -N history-beginning-search-backward-end history-search-end -zle -N history-beginning-search-forward-end history-search-end -bindkey "^[[A" history-beginning-search-backward-end -bindkey "^[[B" history-beginning-search-forward-end - -beginning-history-incremental-pattern-search-backward() { - zle history-incremental-pattern-search-backward ${BUFFER:gs/ /*/} -} -zle -N beginning-history-incremental-pattern-search-backward -bindkey "^[[1;2A" beginning-history-incremental-pattern-search-backward -bindkey -M isearch "^[[A" history-incremental-pattern-search-backward -bindkey -M isearch "^[[B" history-incremental-pattern-search-forward -# }}} - -# Prompt {{{ -function zle-line-init zle-keymap-select { - local state="%#" timer_val="?" - [[ ${KEYMAP} == vicmd ]] && state="+" - [[ $timer ]] && timer_val=$(( $SECONDS - $timer )) - prompt="%2~ " - prompt+="%U${timer_val}%u|" - prompt+="%B%?%b" - prompt+="%B%F{magenta}${state}%f%b " - PS1=$prompt - zle reset-prompt -} -zle -N zle-line-init -zle -N zle-keymap-select - -preexec() { - timer=$SECONDS -} - -precmd() { - printf "\a\033]2;\033\\" -} -# }}} - -# Aliases {{{ -alias l="ls -AF " -alias ll="ls -D \"%Y-%m-%d %H:%M\" -AFl " -alias vi="vim" -alias m="less " -alias -g M="| less" -alias -g W="| wc -l | sed 's/ //g'" -alias -g T="| tai64nlocal" -alias -g DN=">/dev/null" -alias -g 2DN="2>/dev/null" -alias -g DNA=">&/dev/null" -alias mc="mc --nomouse" -alias gpgkr="gpg --no-default-keyring --keyring " - -f() { - bfs . -name "*$1*" -print -} - -alias ssh="TERM=xterm ssh" -alias sshnm="ssh -S none" -ssht() { - local t="-t 0" - TERM=xterm ssh -C -t $1 "tmux has-session $t && tmux attach-session $t || tmux new-session $t" -} - -autoload -U zsh-mime-setup ; zsh-mime-setup -alias -s html=lynx - -autoload -U zmv -# }}} - -# Faster movement {{{ -cddotdot() { - cd .. - pwd - zle reset-prompt -} -zle -N cddotdot -bindkey "OQ" cddotdot # F2 - -popdquiet() { - popd - zle reset-prompt -} -zle -N popdquiet -bindkey "OS" popdquiet # F4 -# }}} - -# Git {{{ -alias Ga="git add" -alias Gb="git branch" -alias Gc="git checkout" -alias Gd="git diff" -alias Gdc="git diff --cached" -alias Gs="git show --show-signature" -alias Gm="git diff --name-only --diff-filter=M --relative" -alias Gam="git commit --amend" -alias Gl="git log --oneline --graph --decorate=short" -alias Gld="git log --format=format:'%ai %Cgreen%h%Creset %s'" - -bindkey -s "OR" " git status --short\n" # F3 -# }}} - -# grep {{{ -GREP_ARGS=( - --devices=skip - --colour=always - --with-filename - --line-number - --dereference-recursive - --binary-files=without-match - --exclude-dir=.git - --exclude-dir=.tags -) -g() { - grep $GREP_ARGS $@ | less -} -alias -g G="| grep --colour=always" -alias gg="git grep " -# }}} - -# GPG agent {{{ -export GPG_TTY=$(tty) -# }}} - -# Mail {{{ -mailpath=( - ~/mail/mbox"?Neue Nachrichten in =mbox" - ~/mail/arbeit"?Neue Nachrichten in =arbeit" -) -alias arr="mutt -f =arbeit -e 'source ~/.mutt/accounts/stcnet.ru'" -alias sent="mutt -f =sent-\`date '+%y-%m'\`" -bindkey -s "OP" " inc\n" # F1 -# }}} - -# Completion {{{ -zstyle ":completion:*" list-colors "" - -zstyle ":completion:*:functions" ignored-patterns "_*" -zstyle ":completion:*:manuals" separate-sections true - -zstyle ":completion:*" group-name "" -zstyle ":completion:*:messages" format "%d" -zstyle ":completion:*:warnings" format "%F{red}no matches: %d%f" -zstyle ":completion:*:*:*:*:descriptions" format "%B... %d%b" -zstyle ":completion:*:files:*:*:descriptions" format "" - -zstyle ":completion:*" file-patterns "%p:globbed" "*" -zstyle ":completion:*" matcher-list "" "m:{a-z-}={A-Z_}" "r:|?=** m:{a-z-}={A-Z_}" -zstyle ":completion:*:man:*:*:*" matcher-list "" "m:{a-zA-Z}={A-Za-z} l:|=* r:|=*" -zstyle ":completion:*" completer _mycomp _mycomp_man:man _parameters _ignored - -_mycomp () { - [[ $CURRENT -eq 1 ]] && curcontext="${curcontext%:*:*}:-command-:" \ - _command_names && return - [[ $IPREFIX =~ ~.* ]] && _tilde && return - local has_files - curcontext=:files:${curcontext#:*:} _files && has_files=1 - [[ $has_files ]] && return - - # MAGIC_EQUAL_SUBST {{{ - [[ $PREFIX = *\=* ]] || return 1 - compstate[parameter]=${PREFIX%%\=*} - compset -P 1 "*=" - _value - # }}} -} - -_mycomp_man () { - [[ ${words[1]} == man ]] && curcontext=:man:${curcontext#:*:} \ - _dispatch "" man man "" -default- && _value && return - [[ ${words[1]} == info ]] && curcontext=:info:${curcontext#:*:} \ - _dispatch "" info info "" -default- && return -} - -autoload -U compinit ; compinit -d /tmp/.zcompdump -autoload -U complist -# }}} - -# Highlighting {{{ -ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets) -. ~/work/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh -typeset -A ZSH_HIGHLIGHT_STYLES -ZSH_HIGHLIGHT_STYLES[assign]="fg=yellow" -ZSH_HIGHLIGHT_STYLES[commandseparator]="fg=red" -ZSH_HIGHLIGHT_STYLES[single-hyphen-option]="fg=green,bold" -ZSH_HIGHLIGHT_STYLES[double-hyphen-option]="fg=green" -ZSH_HIGHLIGHT_STYLES[globbing]="fg=magenta" -ZSH_HIGHLIGHT_STYLES[global-alias]="fg=yellow,bold" -ZSH_HIGHLIGHT_STYLES[history-expansion]="fg=magenta" -ZSH_HIGHLIGHT_STYLES[redirection]="fg=red" -ZSH_HIGHLIGHT_STYLES[path]="fg=white,underline" -ZSH_HIGHLIGHT_STYLES[path_pathseparator]="fg=white,bold,underline" -# }}} - -# Autosuggestion {{{ -. ~/work/zsh-autosuggestions/zsh-autosuggestions.zsh -ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=cyan" -# }}} - -# fzf {{{ -cf() { - local dir=$(bfs -L ${1:-.} -mindepth 1 \ - -path "*/\.git" -prune -o \ - -path "*/\.redo" -prune -o \ - -type d -print 2>/dev/null | - fzf --height 40% --reverse --preview="tree -CN {}") - [[ -z $dir ]] || { print -s cd $dir ; cd $dir } -} -# }}} - -# Named directories {{{ -while read w ; do - w=(${(s/=/)w}) - hash -d ${w[1]}=${~${w[2]}} -done < ~/.zhashd -# }}} - -# Midnight commander extensions configuration {{{ -[ -s $XDG_CONFIG_HOME/mc/mc.ext ] || { - mkdir $XDG_CONFIG_HOME/mc/ - cp ~dot/mc/mc.ext $XDG_CONFIG_HOME/mc/ -} -# }}} - -# Virtualenv {{{ -venv() { - . /usr/local/bin/virtualenvwrapper.sh -} -# }}} - -# autoenv {{{ -. ~/work/zsh-autoenv/autoenv.zsh -# }}} +for z (~/.zsh/rc/*(on)) . $z -- 2.44.0