-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.fish
58 lines (51 loc) · 1.55 KB
/
config.fish
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# git clone https://github.com/oh-my-fish/plugin-foreign-env.git
set fish_function_path $fish_function_path ~/plugin-foreign-env/functions
fenv source ~/.profile
# fenv source ~/.nix-profile/etc/profile.d/nix.sh
alias g="git status"
alias gc="git commit"
alias gap="git add -p"
alias gcp="git checkout -p"
alias gca="git commit --amend"
alias gdp="git diff -p"
alias gdc="git diff --cached"
alias grp="git reset -p"
alias gs="git stash"
alias gsp="git stash pop"
alias gss="git stash show"
alias gd="git difftool"
alias gl="git lg"
alias gll="git log"
alias gri="git revise -i"
set -g -x EDITOR vim
set -g -x NOTESDIR ~/notes
function fish_greeting
echo "Here's what's at the top of your TODO list:"
head -n 3 $NOTESDIR/next.txt
end
funcsave fish_greeting
set fish_git_dirty_color red
set fish_git_not_dirty_color green
function parse_git_branch
set -l branch (git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/\1/')
set -l git_diff (git diff)
if test -n "$git_diff"
echo (set_color $fish_git_dirty_color)$branch(set_color normal)
else
echo (set_color $fish_git_not_dirty_color)$branch(set_color normal)
end
end
function job_count
set -l count (jobs | wc -l | string trim)
if not test $count -eq 0
echo " ($count)"
end
end
function fish_prompt
set -g R (git rev-parse --show-toplevel)
if test -n "$R"
printf '%s%s%s:%s:%s%s> ' (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) (parse_git_branch) (job_count)
else
printf '%s%s%s%s> ' (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) (job_count)
end
end