配置zsh
This commit is contained in:
parent
81661d222b
commit
103e9e951c
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "zsh/plugins/autosuggestions"]
|
||||||
|
path = zsh/plugins/autosuggestions
|
||||||
|
url = git@github.com:zsh-users/zsh-autosuggestions.git
|
||||||
7
aliases/aliases
Normal file
7
aliases/aliases
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# +----+
|
||||||
|
# | ls |
|
||||||
|
# +----+
|
||||||
|
alias ls='ls --color=auto'
|
||||||
|
|
||||||
|
|
@ -1,35 +1,40 @@
|
||||||
# generated by Git for Windows
|
# generated by Git for Windows
|
||||||
test -f ~/.profile && . ~/.profile
|
test -f ~/.profile && . ~/.profile
|
||||||
test -f ~/.bashrc && . ~/.bashrc
|
test -f ~/.bashrc && . ~/.bashrc
|
||||||
PS1='\w $ '
|
|
||||||
export LANG=zh_CN.UTF-8
|
export DOTFILES=$HOME/dotfiles
|
||||||
|
|
||||||
export _JAVA_OPTIONS="-Dfile.encoding=UTF-8"
|
test -f $DOTFILES/aliases/aliases && . $DOTFILES/aliases/aliases
|
||||||
export JAVA_OPTS="-Dfile.encoding=UTF-8"
|
|
||||||
export JAVA_TOOLS_OPTIONS="-Dfile.encoding=UTF-8"
|
PS1='\w $ '
|
||||||
export MAVEN_OPTS="-Dfile.encoding=UTF-8"
|
export LANG=zh_CN.UTF-8
|
||||||
|
|
||||||
export VAGRANT_PREFER_SYSTEM_BIN=1
|
export _JAVA_OPTIONS="-Dfile.encoding=UTF-8"
|
||||||
|
export JAVA_OPTS="-Dfile.encoding=UTF-8"
|
||||||
env=/tmp/agent.env
|
export JAVA_TOOLS_OPTIONS="-Dfile.encoding=UTF-8"
|
||||||
|
export MAVEN_OPTS="-Dfile.encoding=UTF-8"
|
||||||
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
|
|
||||||
|
export VAGRANT_PREFER_SYSTEM_BIN=1
|
||||||
agent_start () {
|
|
||||||
(umask 077; ssh-agent >| "$env")
|
env=/tmp/agent.env
|
||||||
. "$env" >| /dev/null ; }
|
|
||||||
|
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
|
||||||
agent_load_env
|
|
||||||
|
agent_start () {
|
||||||
# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running
|
(umask 077; ssh-agent >| "$env")
|
||||||
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)
|
. "$env" >| /dev/null ; }
|
||||||
|
|
||||||
if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
|
agent_load_env
|
||||||
agent_start
|
|
||||||
ssh-add
|
# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running
|
||||||
elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then
|
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)
|
||||||
ssh-add
|
|
||||||
fi
|
if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
|
||||||
|
agent_start
|
||||||
unset env
|
ssh-add
|
||||||
|
elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then
|
||||||
|
ssh-add
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset env
|
||||||
|
|
||||||
|
|
|
||||||
1
zsh/plugins/autosuggestions
Submodule
1
zsh/plugins/autosuggestions
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit a411ef3e0992d4839f0732ebeb9823024afaaaa8
|
||||||
24
zsh/zshenv
Normal file
24
zsh/zshenv
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
###############################
|
||||||
|
# EXPORT ENVIRONMENT VARIABLE #
|
||||||
|
###############################
|
||||||
|
|
||||||
|
export TERM='rxvt-256color'
|
||||||
|
export DOTFILES="$HOME/dotfiles"
|
||||||
|
|
||||||
|
# XDG
|
||||||
|
export XDG_CONFIG_HOME=$HOME/.config
|
||||||
|
export XDG_DATA_HOME=$XDG_CONFIG_HOME/local/share
|
||||||
|
export XDG_CACHE_HOME=$XDG_CONFIG_HOME/cache
|
||||||
|
|
||||||
|
# editor
|
||||||
|
export EDITOR="vim"
|
||||||
|
export VISUAL="vim"
|
||||||
|
|
||||||
|
# zsh
|
||||||
|
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
|
||||||
|
export HISTFILE="$ZDOTDIR/.zhistory" # History filepath
|
||||||
|
export HISTSIZE=10000 # Maximum events for internal history
|
||||||
|
export SAVEHIST=10000 # Maximum events in history file
|
||||||
|
|
||||||
73
zsh/zshrc
Executable file
73
zsh/zshrc
Executable file
|
|
@ -0,0 +1,73 @@
|
||||||
|
setopt EXTENDED_HISTORY
|
||||||
|
setopt HIST_EXPIRE_DUPS_FIRST
|
||||||
|
setopt HIST_IGNORE_DUPS
|
||||||
|
setopt HIST_IGNORE_ALL_DUPS
|
||||||
|
setopt HIST_IGNORE_SPACE
|
||||||
|
setopt HIST_FIND_NO_DUPS
|
||||||
|
setopt HIST_SAVE_NO_DUPS
|
||||||
|
setopt HIST_BEEP
|
||||||
|
|
||||||
|
autoload -Uz compinit
|
||||||
|
compinit
|
||||||
|
|
||||||
|
export LANG=zh_CN.UTF-8
|
||||||
|
|
||||||
|
export _JAVA_OPTIONS="-Dfile.encoding=UTF-8"
|
||||||
|
export JAVA_OPTS="-Dfile.encoding=UTF-8"
|
||||||
|
export JAVA_TOOLS_OPTIONS="-Dfile.encoding=UTF-8"
|
||||||
|
export MAVEN_OPTS="-Dfile.encoding=UTF-8"
|
||||||
|
|
||||||
|
export VAGRANT_PREFER_SYSTEM_BIN=1
|
||||||
|
|
||||||
|
# +---------+
|
||||||
|
# | ALIASES |
|
||||||
|
# +---------+
|
||||||
|
|
||||||
|
source $DOTFILES/aliases/aliases
|
||||||
|
|
||||||
|
|
||||||
|
# +-----------+
|
||||||
|
# | SSH_AGENT |
|
||||||
|
# +-----------+
|
||||||
|
|
||||||
|
env=/tmp/agent.env
|
||||||
|
|
||||||
|
agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; }
|
||||||
|
|
||||||
|
agent_start () {
|
||||||
|
(umask 077; ssh-agent >| "$env")
|
||||||
|
. "$env" >| /dev/null ; }
|
||||||
|
|
||||||
|
agent_load_env
|
||||||
|
|
||||||
|
# agent_run_state: 0=agent running w/ key; 1=agent w/o key; 2= agent not running
|
||||||
|
agent_run_state=$(ssh-add -l >| /dev/null 2>&1; echo $?)
|
||||||
|
|
||||||
|
if [ ! "$SSH_AUTH_SOCK" ] || [ $agent_run_state = 2 ]; then
|
||||||
|
agent_start
|
||||||
|
ssh-add
|
||||||
|
elif [ "$SSH_AUTH_SOCK" ] && [ $agent_run_state = 1 ]; then
|
||||||
|
ssh-add
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset env
|
||||||
|
|
||||||
|
# +-----+
|
||||||
|
# | VIM |
|
||||||
|
# +-----+
|
||||||
|
|
||||||
|
# Vi mode
|
||||||
|
bindkey -v
|
||||||
|
export KEYTIMEOUT=1
|
||||||
|
|
||||||
|
# +--------+
|
||||||
|
# | PROMPT |
|
||||||
|
# +--------+
|
||||||
|
|
||||||
|
export PROMPT='%F{blue}(%n)%f %~ %# '
|
||||||
|
|
||||||
|
# +-----------------+
|
||||||
|
# | auto-suggestion |
|
||||||
|
# +-----------------+
|
||||||
|
source $DOTFILES/zsh/plugins/autosuggestions/zsh-autosuggestions.zsh
|
||||||
|
|
||||||
Loading…
Reference in a new issue