Created
May 22, 2019 15:00
-
-
Save onokatio/f0a609bf63f38df80fd6009fbd5a903b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#zmodload zsh/zprof && zprof | |
if [[ -z "$CTG" ]];then | |
source ~/.zprofile | |
fi | |
if [[ "$TTY" == "/dev/tty1" ]];then | |
startx > /dev/null 2>&1 | |
# fbterm | |
elif echo "$TTY" | grep "/dev/tty" ;then | |
# fbterm | |
fi | |
if [[ -z "$TMUX" ]] && [[ -z ${REMOTEHOST}${SSH_CONNECTION} ]];then | |
tmux | |
fi | |
#umask 0022 | |
autoload -Uz colors && colors | |
autoload -Uz add-zsh-hook | |
autoload -Uz select-word-style && select-word-style default | |
autoload -Uz vcs_info | |
autoload -Uz terminfo | |
autoload -Uz compinit | |
autoload -Uz bashcompinit | |
zmodload zsh/zpty | |
#autoload -Uz zed | |
export ZPFX=$CTG/run/zplugin-polaris | |
export ZSH_PLUGINS_ALIAS_TIPS_TEXT='alias-tips: ' | |
local -A ZPLGM | |
ZPLGM[HOME_DIR]=$CTG/run/zplugin | |
source $CTG/modules/zplugin/zplugin.zsh | |
zplugin snippet 'OMZ::lib/clipboard.zsh' | |
zplugin snippet 'OMZ::lib/completion.zsh' | |
zplugin snippet 'OMZ::lib/compfix.zsh' | |
zplugin snippet 'OMZ::plugins/dotenv/dotenv.plugin.zsh' | |
zplugin snippet 'OMZ::plugins/git/git.plugin.zsh' | |
zplugin ice blockf | |
zplugin light 'zsh-users/zsh-completions' | |
compinit | |
bashcompinit | |
#zplugin ice atload'tmp="/usr/share/bash-completion/bash_completion" ; test -r "$tmp" && source $tmp' | |
#zplugin light chrissicool/zsh-bash | |
#### async ### | |
zplugin ice wait'0' atload'_zsh_highlight' | |
zplugin light zdharma/fast-syntax-highlighting | |
zplugin ice wait'0' atload'_zsh_autosuggest_start' | |
zplugin light zsh-users/zsh-autosuggestions | |
zplugin light b4b4r07/zsh-vimode-visual | |
zplugin ice wait'0' as'program' pick'bin/anyenv' atload'export ANYENV_ROOT=$PWD ; eval "$(anyenv init -)"' | |
zplugin light riywo/anyenv | |
zplugin ice as'program' pick'anyenv-update' | |
zplugin snippet 'https://github.com/znz/anyenv-update/blob/master/bin/anyenv-update' | |
zplugin ice wait'0' | |
zplugin light b4b4r07/emoji-cli | |
zplugin ice wait'0' | |
zplugin light b4b4r07/enhancd | |
zplugin ice as"program" make"PREFIX=$ZPFX" pick"$ZPFX/bin/git-*" | |
zplugin light tj/git-extras | |
zplugin ice as"program" make"PREFIX=$ZPFX" pick"$ZPFX/bin/git-issue" | |
zplugin light dspinellis/git-issue | |
zplugin ice as"program" pick"diff-so-fancy" | |
zplugin snippet https://raw.githubusercontent.com/so-fancy/diff-so-fancy/master/third_party/build_fatpack/diff-so-fancy | |
#zplugin ice as'program' mv'yarn-1.10.1.js -> yarn' pick'yarn' | |
#zplugin snippet https://github.com/yarnpkg/yarn/releases/download/v1.10.1/yarn-1.10.1.js | |
#zplugin ice as'program' mv'nvim.appimage -> nvim' pick'nvim' | |
#zplugin snippet 'https://github.com/neovim/neovim/releases/download/v0.3.1/nvim.appimage' | |
zplugin ice as'program' atclone"mkdir -p ~/.themes && ./install.sh --dest ~/.themes --color light -s standard && rm -rf .git src" | |
zplugin light nana-4/materia-theme | |
zplugin ice as'program' atclone"mkdir -p ~/.icons && cat ./install.sh | DESTDIR=\"$HOME/.icons\" THEMES=Papirus sh" | |
zplugin snippet 'https://raw.githubusercontent.com/PapirusDevelopmentTeam/papirus-icon-theme/master/install.sh' | |
zstyle ':zle:*' word-chars "*?_.~-=&!#$%^(){}[]<>./;:@,| " | |
#zstyle ':zle:*' word-chars ' /=;@:{}[]()<>,|.' | |
zstyle ':zle:*' word-style unspecified | |
zstyle ':completion:*' format '%B%F{blue}%d%f%b' | |
zstyle ':completion:*' group-name '' | |
zstyle ':completion:*:default' menu select=2 | |
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" | |
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' | |
zstyle ':completion:*' keep-prefix | |
zstyle ':completion:*' recent-dirs-insert both | |
#zstyle ':completion:*' completer _expand _complete _list _oldlist _history | |
zstyle ':completion:*' completer _complete | |
zstyle ':completion:*' use-cache yes | |
zstyle ':completion:*' cache-path ~/.cache/zsh_cache | |
zstyle ':completion:*' verbose yes | |
zstyle ':completion:*' use-cache true | |
zstyle ':completion:*' list-separator '-->' | |
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters | |
zstyle ':completion:*:sudo:*' command-path /usr/bin | |
### 補完候補 | |
### _oldlist 前回の補完結果を再利用する。 | |
### _complete: 補完する。 | |
### _match: globを展開しないで候補の一覧から補完する。 | |
### _history: ヒストリのコマンドも補完候補とする。 | |
### _ignored: 補完候補にださないと指定したものも補完候補とする。 | |
### _approximate: 似ている補完候補も補完候補とする。 | |
### _prefix: カーソル以降を無視してカーソル位置までで補完する。 | |
setopt notify | |
setopt correct | |
setopt auto_list | |
setopt auto_menu | |
setopt share_history | |
setopt histignorealldups | |
setopt auto_cd | |
setopt hist_ignore_all_dups | |
setopt list_packed | |
setopt list_types | |
setopt auto_param_slash | |
setopt mark_dirs | |
setopt auto_param_keys | |
setopt magic_equal_subst | |
setopt complete_in_word | |
setopt always_last_prompt | |
setopt print_eight_bit | |
setopt no_beep | |
setopt ignore_eof | |
setopt auto_pushd | |
setopt hist_ignore_dups | |
setopt hist_ignore_space | |
setopt hist_save_no_dups | |
setopt append_history | |
setopt inc_append_history | |
setopt hist_no_store | |
setopt hist_reduce_blanks | |
setopt prompt_subst | |
setopt no_nomatch | |
setopt transient_rprompt | |
setopt hist_verify | |
setopt extended_history | |
setopt hist_expand | |
setopt rec_exact | |
setopt no_flow_control | |
setopt interactive_comments | |
setopt glob | |
setopt globdots | |
setopt extended_glob | |
setopt auto_name_dirs | |
setopt auto_resume | |
unsetopt auto_remove_slash | |
setopt MULTIOS | |
function targz(){tar xvf $@ --use-compress-prog=pigz } | |
function tarxz(){tar xvf $@ --use-compress-prog=pixz } | |
function tarbzip2(){tar xvf $@ --use-compress-prog=pbzip2 } | |
alias sudo='sudo ' | |
#alias sudo='sudo' | |
alias vi="nvim -u $HOME/.vimrc" | |
alias vim="nvim -u $HOME/.vimrc" | |
alias d='popd' | |
alias hs=history | |
#alias git=hub | |
#alias df=dfc | |
#alias top=htop | |
#alias diff=colordiff | |
alias info=pinfo | |
#alias wget="axel -n 10 -v -a" | |
alias ks=ls | |
alias xs=cd | |
alias apt=apt-fast | |
alias apt-get=apt-fast | |
alias mkdir='mkdir -p' | |
alias bat="upower -i /org/freedesktop/UPower/devices/battery_BAT0|grep 'percentage'|sed -e 's/ //g'|sed -e 's/percentage://'|sed -e 's/%//'" | |
alias grep="grep --color -n -I" | |
alias ls='ls -hqp --color=auto' | |
alias l='ls -hqp --color=auto' | |
alias ll='ls -lZ -hqp --color=auto' | |
#alias make='make -j4' | |
alias crontab='echo "dont use crontab !!"' | |
alias chromekill='ps ax|/bin/grep [c]hrome|cut -c-6|xargs sudo renice -19' | |
alias pingg="ping 8.8.8.8" | |
alias curlg="curl https://google.com" | |
#alias cat='vimcat' | |
alias trace-mtr='mtr' | |
alias open='xdg-open' | |
alias rm='rm -v --one-file-system' | |
alias poweroff='echo dontuse' | |
alias reboot='echo dontuse' | |
#alias sed='gsed' | |
alias alpine="docker run -it --rm alpine:edge /bin/sh" | |
alias ubuntu="docker run -it --rm ubuntu /bin/bash" | |
alias aria2c="aria2c --bt-max-peers=0 --bt-request-peer-speed-limit=100M --max-connection-per-server=10 --split=10" | |
bindkey -v | |
terminfo_down_sc=$terminfo[cud1]$terminfo[cuu1]$terminfo[sc]$terminfo[cud1] | |
left_down_prompt_preexec() { | |
print -rn -- $terminfo[el] | |
} | |
add-zsh-hook preexec left_down_prompt_preexec | |
function zle-keymap-select zle-line-init zle-line-finish | |
{ | |
case $KEYMAP in | |
main|viins) | |
PROMPT_2="$fg[cyan]-- INSERT --$reset_color" | |
;; | |
vicmd) | |
PROMPT_2="$fg[white]-- NORMAL --$reset_color" | |
;; | |
vivis|vivli) | |
PROMPT_2="$fg[yellow]-- VISUAL --$reset_color" | |
;; | |
esac | |
BINDKEY_MODE="%{$terminfo_down_sc$PROMPT_2$terminfo[rc]%}" | |
zle reset-prompt | |
} | |
zle -N zle-line-init | |
zle -N zle-line-finish | |
zle -N zle-keymap-select | |
zle -N edit-command-line | |
bindkey ";5C" forward-word | |
bindkey ";5D" backward-word | |
#function command_not_found_handler(){ | |
# if [ -e /usr/bin/jp2a ];then | |
# if [ -e ~/kirino.jpg ];then | |
# jp2a ~/kirino.jpg -i | |
# fi | |
# fi | |
# echo "ハァ…?$1とか何言ってんの? | |
#コマンドもろくに覚えられないなんて、アンタどうしようもないクズね。" | |
#} | |
preexec() { | |
_pre="$1" | |
} | |
precmd(){ | |
_r=$? | |
case "${_pre}" in | |
cd*|git*|vi*|:) | |
#psvar=() | |
#LANG=en_US.UTF-8 vcs_info | |
vcs_info | |
#[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_" | |
;; | |
esac | |
_pre="" | |
return ${_r} | |
} | |
do_enter() { | |
if [[ -n $BUFFER ]]; then | |
zle accept-line | |
return $status | |
fi | |
echo | |
if [[ ! -z "${vcs_info_msg_0_}" ]]; then | |
if [[ -n "$(git status --short)" ]]; then | |
git status | |
fi | |
else | |
# do nothing | |
: | |
fi | |
zle reset-prompt | |
} | |
zle -N do_enter | |
bindkey '^m' do_enter | |
bindkey "\C-m" do_enter | |
#function command_not_found_handler(){ | |
# if [ -e /usr/bin/jp2a ];then | |
# if [ -e ~/kirino.jpg ];then | |
# jp2a ~/kirino.jpg -i | |
# fi | |
# fi | |
# echo "ハァ…?$1とか何言ってんの? | |
#コマンドもろくに覚えられないなんて、アンタどうしようもないクズね。" | |
#} | |
chpwd(){ ls -qp --color=auto } | |
if [ ${UID} -eq 0 ]; then | |
PROMPT="%K{green}%B%F{black}ROOT%b%k %F{cyan}%~ %f$ " | |
else | |
setopt prompt_subst | |
zstyle ':vcs_info:*' enable git | |
zstyle ':vcs_info:git:*' check-for-changes true | |
zstyle ':vcs_info:git:*' stagedstr "%K{white}%F{yellow}" # %c | |
zstyle ':vcs_info:git:*' unstagedstr "%K{white}%F{red}" # %u | |
zstyle ':vcs_info:*' formats "%F{green}%K{white}%c%u[%b]%f" | |
zstyle ':vcs_info:*' actionformats '[%b|%a]' | |
#LANG=en_US.UTF-8 vcs_info | |
vcs_info | |
local PNAME | |
if [[ -n "${REMOTEHOST}${SSH_CONNECTION}" ]];then | |
PNAME="%K{yellow}%F{black}SSH " | |
fi | |
UUU="%K{white}%F{black}(」・ω・)」うー" | |
NYA="\(・ω・\)にゃー!" | |
#SAN="\(・ω・\)SAN値!" | |
#PIN="(/・ω・)/ピンチ!" | |
PROMPT='${BINDKEY_MODE}${PNAME}%K{blue}%F{black} %~ %F{blue}%K{white}%k%F{blue}${vcs_info_msg_0_}%k%F{white}%f%k ' | |
fi | |
NAME=~/.tmux/plugins/tpm | |
[[ -x "$NAME" ]] || { | |
echo "[WARN] tpm not found" | |
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm | |
} | |
#if [[ ! -e ~/.zcompdump ]];then | |
# echo -n 'Running compinit ...' | |
# autoload -Uz compinit && compinit | |
# echo 'done !' | |
#fi | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment