Add fish, scripts and git
This commit is contained in:
11
fish/config.fish
Normal file
11
fish/config.fish
Normal file
@@ -0,0 +1,11 @@
|
||||
set -x DOTFILES $HOME/DOTFILES
|
||||
|
||||
if test -z "$FISH_SETUP_PATH"
|
||||
set -x PATH $HOME/dotfiles/bin $PATH
|
||||
set -x PATH . $PATH
|
||||
|
||||
set -x FISH_SETUP_PATH
|
||||
end
|
||||
|
||||
set -x LANG sv_SE.UTF-8
|
||||
set -x LC_ALL sv_SE.UTF-8
|
||||
3
fish/functions/fish_greeting.fish
Normal file
3
fish/functions/fish_greeting.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
function fish_greeting
|
||||
|
||||
end
|
||||
23
fish/functions/fish_prompt.fish
Normal file
23
fish/functions/fish_prompt.fish
Normal file
@@ -0,0 +1,23 @@
|
||||
function fish_prompt
|
||||
set -l status_copy $status
|
||||
|
||||
set -l host (hostname -s)
|
||||
if set -q DEVCONTAINER
|
||||
set host DEV
|
||||
end
|
||||
set_color (echo "$host" | md5sum | cut -c-6)
|
||||
echo -sn $host
|
||||
|
||||
set_color yellow
|
||||
echo -sn ':'
|
||||
|
||||
set_color normal
|
||||
echo -sn (prompt_pwd)
|
||||
|
||||
if test "$status_copy" -ne 0
|
||||
set_color red
|
||||
else
|
||||
set_color green
|
||||
end
|
||||
echo -sn ' > '
|
||||
end
|
||||
27
fish/functions/fish_right_prompt.fish
Normal file
27
fish/functions/fish_right_prompt.fish
Normal file
@@ -0,0 +1,27 @@
|
||||
function fish_right_prompt
|
||||
set -l ref (git symbolic-ref HEAD ^/dev/null)
|
||||
if test -z $ref
|
||||
return
|
||||
end
|
||||
|
||||
git diff --no-ext-diff --quiet --exit-code ^/dev/null
|
||||
or set -l dirty 'yes'
|
||||
|
||||
git diff-index --cached --quiet HEAD -- ^/dev/null
|
||||
or set -l staged 'yes'
|
||||
|
||||
set_color normal
|
||||
echo -sn '['
|
||||
|
||||
if set -q staged
|
||||
set_color yellow
|
||||
else if set -q dirty
|
||||
set_color red
|
||||
else
|
||||
set_color green
|
||||
end
|
||||
echo -sn (string replace refs/heads/ '' -- $ref)
|
||||
|
||||
set_color normal
|
||||
echo -sn ']'
|
||||
end
|
||||
8
fish/functions/g.fish
Normal file
8
fish/functions/g.fish
Normal file
@@ -0,0 +1,8 @@
|
||||
function g --wraps git
|
||||
if count $argv >/dev/null
|
||||
git $argv
|
||||
else
|
||||
git status
|
||||
git l -5
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user