mirror of
https://github.com/danbee/dotfiles-local
synced 2025-03-04 08:49:07 +00:00
Compare commits
No commits in common. "ec9723a5d2e6920f51a06a9e2f757aac34c84e18" and "212e77944ca2b39035514cbc1e8ba16e8e92cc6a" have entirely different histories.
ec9723a5d2
...
212e77944c
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
|||||||
[submodule "zsh/lib/gitstatus"]
|
|
||||||
path = zsh/lib/gitstatus
|
|
||||||
url = git@github.com:romkatv/gitstatus.git
|
|
||||||
@ -1 +0,0 @@
|
|||||||
map <C-P> :FZF<CR>
|
|
||||||
@ -11,11 +11,6 @@ Plug 'rizzatti/dash.vim'
|
|||||||
|
|
||||||
Plug 'ryanoasis/vim-devicons'
|
Plug 'ryanoasis/vim-devicons'
|
||||||
|
|
||||||
" Search
|
|
||||||
UnPlug 'ctrlp.vim'
|
|
||||||
Plug '/usr/local/opt/fzf'
|
|
||||||
Plug 'junegunn/fzf.vim'
|
|
||||||
|
|
||||||
" Language additions
|
" Language additions
|
||||||
Plug 'briancollins/vim-jst', { 'for': ['jst', 'ejs'] }
|
Plug 'briancollins/vim-jst', { 'for': ['jst', 'ejs'] }
|
||||||
Plug 'elixir-editors/vim-elixir'
|
Plug 'elixir-editors/vim-elixir'
|
||||||
@ -35,7 +30,6 @@ Plug 'vim-ruby/vim-ruby', { 'for': 'ruby' }
|
|||||||
Plug 'keith/swift.vim', { 'for': 'swift' }
|
Plug 'keith/swift.vim', { 'for': 'swift' }
|
||||||
Plug 'tpope/vim-markdown', { 'for': 'markdown' }
|
Plug 'tpope/vim-markdown', { 'for': 'markdown' }
|
||||||
Plug 'AndrewRadev/splitjoin.vim'
|
Plug 'AndrewRadev/splitjoin.vim'
|
||||||
Plug 'dearrrfish/vim-applescript'
|
|
||||||
|
|
||||||
Plug 'junegunn/goyo.vim'
|
Plug 'junegunn/goyo.vim'
|
||||||
Plug 'reedes/vim-pencil'
|
Plug 'reedes/vim-pencil'
|
||||||
|
|||||||
@ -1,31 +1,69 @@
|
|||||||
source "$HOME/.zsh/lib/gitstatus/gitstatus.plugin.zsh"
|
source "$HOME/.zsh/lib/async.zsh"
|
||||||
|
|
||||||
gitstatus_start MY
|
async_init
|
||||||
|
|
||||||
export GIT_PROMPT=""
|
async_register_callback git_prompt_worker git_prompt_callback
|
||||||
|
|
||||||
update_git_prompt() {
|
export PROMPT_GIT_BRANCH=""
|
||||||
typeset -g GIT_PROMPT=""
|
export PROMPT_GIT_DIRTY=""
|
||||||
|
|
||||||
gitstatus_query -t 5 MY || return
|
git_prompt_callback() {
|
||||||
[[ $VCS_STATUS_RESULT == ok-sync ]] || return
|
case $1 in
|
||||||
|
git_branch)
|
||||||
|
PROMPT_GIT_BRANCH=$3
|
||||||
|
;;
|
||||||
|
git_dirty)
|
||||||
|
PROMPT_GIT_DIRTY=$3
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
GIT_PROMPT+="%{$fg[blue]%}[%{$fg_bold[blue]%}${VCS_STATUS_LOCAL_BRANCH}%{$reset_color%}"
|
zle reset-prompt
|
||||||
|
|
||||||
if [[ $VCS_STATUS_HAS_STAGED == 1 ]]; then
|
|
||||||
GIT_PROMPT+="%{$fg_bold[yellow]%}+%{$reset_color%}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $VCS_STATUS_HAS_UNSTAGED == 1 ]]; then
|
|
||||||
GIT_PROMPT+="%{$fg_bold[red]%}∗%{$reset_color%}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
GIT_PROMPT+="%{$fg[blue]%}]%{$reset_color%} "
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# gets whether git is currently dirty
|
||||||
|
git_dirty() {
|
||||||
|
git diff --ignore-submodules --quiet
|
||||||
|
if [[ $? == 1 ]]; then
|
||||||
|
echo "✱"
|
||||||
|
else
|
||||||
|
git diff --staged --ignore-submodules --quiet
|
||||||
|
[[ $? == 1 ]] && echo "✱"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# gets the current git branch
|
||||||
|
git_branch() {
|
||||||
|
git rev-parse --abbrev-ref HEAD 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# adds the current branch name in green
|
||||||
|
git_prompt_info() {
|
||||||
|
if [[ -n $PROMPT_GIT_BRANCH ]]; then
|
||||||
|
echo "%{$fg_bold[green]%}${PROMPT_GIT_BRANCH}%{$reset_color%}%{$fg_bold[red]%}${PROMPT_GIT_DIRTY}%{$reset_color%} "
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
git_branch_async() {
|
||||||
|
async_job git_prompt_worker git_branch
|
||||||
|
}
|
||||||
|
|
||||||
|
git_status_async() {
|
||||||
|
async_job git_prompt_worker git_dirty
|
||||||
|
}
|
||||||
|
|
||||||
|
worker_change_directory() {
|
||||||
|
PROMPT_GIT_BRANCH=""
|
||||||
|
PROMPT_GIT_DIRTY=""
|
||||||
|
async_worker_eval git_prompt_worker builtin cd -q "$PWD"
|
||||||
|
}
|
||||||
|
|
||||||
|
async_start_worker git_prompt_worker
|
||||||
|
|
||||||
autoload -Uz add-zsh-hook
|
autoload -Uz add-zsh-hook
|
||||||
|
|
||||||
add-zsh-hook precmd update_git_prompt
|
add-zsh-hook chpwd worker_change_directory
|
||||||
|
add-zsh-hook precmd git_branch_async
|
||||||
|
add-zsh-hook precmd git_status_async
|
||||||
|
|
||||||
# makes color constants available
|
# makes color constants available
|
||||||
autoload -U colors
|
autoload -U colors
|
||||||
@ -38,7 +76,7 @@ export CLICOLOR=1
|
|||||||
setopt promptsubst
|
setopt promptsubst
|
||||||
|
|
||||||
# prompt
|
# prompt
|
||||||
export PROMPT='${SSH_CONNECTION+"%{$fg[yellow]%}%n@%m%{$reset_color%}:"}%{$fg_bold[green]%}%2c%{$reset_color%} ${GIT_PROMPT}%{$fg_bold[cyan]%}❯%{$reset_color%} '
|
export PROMPT='$(git_prompt_info)${SSH_CONNECTION+"%{$fg[yellow]%}%n@%m%{$reset_color%}:"}%{$fg_bold[blue]%}%2c%{$reset_color%} %{$fg_bold[cyan]%}❯%{$reset_color%} '
|
||||||
export RPROMPT='%D{%K:%M:%S}'
|
export RPROMPT='%D{%K:%M:%S}'
|
||||||
|
|
||||||
# update the prompt on carriage return
|
# update the prompt on carriage return
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
Subproject commit 86bc4a8f04429c5920674ef5b8136dbf10f436fe
|
|
||||||
Loading…
Reference in New Issue
Block a user