first commit
This commit is contained in:
parent
98a9fc2853
commit
8a907b554a
5 changed files with 95 additions and 0 deletions
7
README.md
Normal file
7
README.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# My Zsh Config
|
||||||
|
|
||||||
|
```sh
|
||||||
|
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions
|
||||||
|
git clone https://code.waks.be/nishiki/zsh-config.git ~/.zsh/nishiki
|
||||||
|
echo 'source "~/.zsh/nishiki/plugin.zsh" > ~/.zshrc'
|
||||||
|
```
|
4
aliases.zsh
Normal file
4
aliases.zsh
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
alias vim="nvim"
|
||||||
|
alias vimdiff="nvim -d"
|
||||||
|
alias grep="rg"
|
||||||
|
alias cat="batcat -p"
|
21
completion.zsh
Normal file
21
completion.zsh
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
autoload -Uz compinit
|
||||||
|
compinit
|
||||||
|
|
||||||
|
zstyle ':completion:*' auto-description 'specify: %d'
|
||||||
|
zstyle ':completion:*' completer _expand _complete _correct _approximate
|
||||||
|
zstyle ':completion:*' format 'Completing %d'
|
||||||
|
zstyle ':completion:*' group-name ''
|
||||||
|
zstyle ':completion:*' menu select=2
|
||||||
|
eval "$(dircolors -b)"
|
||||||
|
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
||||||
|
zstyle ':completion:*' list-colors ''
|
||||||
|
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
|
||||||
|
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
|
||||||
|
zstyle ':completion:*' menu select=long
|
||||||
|
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
|
||||||
|
zstyle ':completion:*' use-compctl false
|
||||||
|
zstyle ':completion:*' verbose true
|
||||||
|
|
||||||
|
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
|
||||||
|
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
|
||||||
|
|
8
plugin.zsh
Normal file
8
plugin.zsh
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
HISTSIZE=1000
|
||||||
|
SAVEHIST=1000
|
||||||
|
HISTFILE=~/.zsh_history
|
||||||
|
|
||||||
|
source "${0:h}/aliases.zsh"
|
||||||
|
source "${0:h}/prompt.zsh"
|
||||||
|
source "${0:h}/completion.zsh"
|
||||||
|
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
|
55
prompt.zsh
Normal file
55
prompt.zsh
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
autoload -U colors && colors
|
||||||
|
|
||||||
|
function set_prompt() {
|
||||||
|
PS1="[%{$fg[yellow]%}%D{%H:%M:%S}%{$reset_color%}] %{$fg[green]%}%n%{$fg[cyan]%}@%m %{$fg[magenta]%}%~%{$reset_color%} $(git_prompt_info)%(?..%{$fg[red]%})$ %{$reset_color%}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function __git_prompt_git() {
|
||||||
|
GIT_OPTIONAL_LOCKS=0 command git "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function git_prompt_info() {
|
||||||
|
if ! __git_prompt_git rev-parse --git-dir &> /dev/null ; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
echo "%{$reset_color%}\ue725 on %{$fg[green]%}$(git_current_branch)$(parse_git_dirty)%{$reset_color%} "
|
||||||
|
}
|
||||||
|
|
||||||
|
function git_current_branch() {
|
||||||
|
local ref
|
||||||
|
ref=$(__git_prompt_git symbolic-ref --quiet HEAD 2> /dev/null)
|
||||||
|
local ret=$?
|
||||||
|
if [[ $ret != 0 ]]; then
|
||||||
|
[[ $ret == 128 ]] && return # no git repo.
|
||||||
|
ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) || return
|
||||||
|
fi
|
||||||
|
echo ${ref#refs/heads/}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parse_git_dirty() {
|
||||||
|
local STATUS
|
||||||
|
local -a FLAGS
|
||||||
|
FLAGS=('--porcelain')
|
||||||
|
if [[ "$(__git_prompt_git config --get oh-my-zsh.hide-dirty)" != "1" ]]; then
|
||||||
|
if [[ "${DISABLE_UNTRACKED_FILES_DIRTY:-}" == "true" ]]; then
|
||||||
|
FLAGS+='--untracked-files=no'
|
||||||
|
fi
|
||||||
|
case "${GIT_STATUS_IGNORE_SUBMODULES:-}" in
|
||||||
|
git)
|
||||||
|
# let git decide (this respects per-repo config in .gitmodules)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# if unset: ignore dirty submodules
|
||||||
|
# other values are passed to --ignore-submodules
|
||||||
|
FLAGS+="--ignore-submodules=${GIT_STATUS_IGNORE_SUBMODULES:-dirty}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
STATUS=$(__git_prompt_git status ${FLAGS} 2> /dev/null | tail -n 1)
|
||||||
|
fi
|
||||||
|
if [[ -n $STATUS ]]; then
|
||||||
|
echo "%{$fg[yellow]%}%1{±%}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
set_prompt
|
||||||
|
chpwd_functions+=(set_prompt)
|
Loading…
Reference in a new issue