diff options
| author | tslil clingman <> | 2019-09-11 19:18:14 -0400 |
|---|---|---|
| committer | tslil clingman <> | 2019-09-11 19:18:14 -0400 |
| commit | ac1a4884d03fc0495c773500d8a13f84b695fa43 (patch) | |
| tree | 29e5ec49e0ce957d80d8f11a155b47840c74f488 /fish | |
Init
Diffstat (limited to 'fish')
| -rw-r--r-- | fish/config.fish | 48 | ||||
| -rw-r--r-- | fish/functions/fish_prompt.fish | 32 | ||||
| -rw-r--r-- | fish/functions/fish_right_prompt.fish | 8 | ||||
| -rw-r--r-- | fish/functions/setup_env.fish | 41 | ||||
| -rw-r--r-- | fish/functions/vcs_string.fish | 51 |
5 files changed, 180 insertions, 0 deletions
diff --git a/fish/config.fish b/fish/config.fish new file mode 100644 index 0000000..7825d8b --- /dev/null +++ b/fish/config.fish @@ -0,0 +1,48 @@ +setup_env + +alias rm "rm -i" +alias ls 'ls --group-directories-first -vhF --color=always' +alias hh 'cd $HOME' +alias bk 'cd $OLDPWD' +alias um 'udevil mount' +alias uu 'udevil umount' +alias t "date +%H\ %M\ %S | dc -e '6k???86400/r1440/+r24/+p'" + +alias .. 'cd ..' +alias ... 'cd ../..' +alias .... 'cd ../../..' +alias ..... 'cd ../../../..' +alias ...... 'cd ../../../../..' + +alias performance 'sudo cpupower frequency-set -g performance' +alias powersave 'sudo cpupower frequency-set -g powersave' + +alias lower "tr '[:upper:]' '[:lower:]'" +alias upper "tr '[:lower:]' '[:upper:]'" + +function fish_user_key_bindings + bind \eh backward-kill-word +end + +function j + ce $argv + cd (head -n 1 "$HOME/.local/share/dir_lst") +end + +function c + echo 'scale=13;' $argv | bc -l +end + +function hd + hexdump -e '"%08.8_ax " 8/1 "%02X " " - " 8/1 "%02X "' -e '" |" "%_p"' -e '"|\n"' "$argv" +end + +function fish_title + echo fsh +end + +if status is-login + if test -z "$DISPLAY"; and test $XDG_VTNR -eq 1; + exec startx -- -keeptty + end +end diff --git a/fish/functions/fish_prompt.fish b/fish/functions/fish_prompt.fish new file mode 100644 index 0000000..8037fc4 --- /dev/null +++ b/fish/functions/fish_prompt.fish @@ -0,0 +1,32 @@ +function fish_prompt + set -l fail $status + tput bold + echo -ne "[" + set_color magenta + echo -ne (pwd) | sed 's#.*/\(.*\)/\(.*\)#\1/\2#' + #echo -ne (pwd) | sed 's#.*/\(.*\)#\1#' + set_color normal + tput bold + echo -ne "](" + set_color -o cyan + echo -ne (date "+%y.%m.%d %Hh%M") + set_color normal + tput bold + echo -ne ")" + set_color normal + + vcs_string + + if [ $fail = 0 ]; + set_color -o green; + else + set_color -o red; + end; + + if test (id -u) -eq 0; + echo -ne "\# " + else + echo -ne "\$ " + end + set_color normal +end diff --git a/fish/functions/fish_right_prompt.fish b/fish/functions/fish_right_prompt.fish new file mode 100644 index 0000000..800203c --- /dev/null +++ b/fish/functions/fish_right_prompt.fish @@ -0,0 +1,8 @@ +function fish_right_prompt + set -l fail $status + + if [ $fail != 0 ]; + set_color red; + echo -ne "<$fail>"; + end; +end diff --git a/fish/functions/setup_env.fish b/fish/functions/setup_env.fish new file mode 100644 index 0000000..50e8f44 --- /dev/null +++ b/fish/functions/setup_env.fish @@ -0,0 +1,41 @@ +function setup_env + + set -l envs (keychain --eval -q) + for expr in $envs; + set -l nexpr (echo $expr | sed "s/^\([^=]*\)=\([^;]*\); export.*/set -x -g \1 \2/") + eval $nexpr + end; + + set -g -x BROWSER "iceweasel" + set -g -x XDG_DOWNLOAD_DIR "$HOME/store" + + set -g -x EDITOR "zile" + set -g -x LC_ALL "en_ZA.UTF-8" + set -g -x PATH /usr/local/bin $PATH {$HOME}/bin . + set -g -x SUDO_EDITOR "zile" + set -g -x TERMINAL "st" + set -g -x VISUAL "emacs" + + set -g -x USER_AGENT 'Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0' + + set -g -x LESS "-S -R" + set -g -x LESSCHARSET "utf-8" + set -g -x LESSHISTFILE "-" + set -g -x LS_COLORS 'rs=0:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:' + + set -g -x LESSOPEN "|/usr/bin/lesspipe.sh %s" + set -g -x LESS_ADVANCED_PREPROCESSOR 1 + + stty -ixon + umask 077 + + set fish_greeting + + set -g -x fish_color_operator cyan + set -g -x fish_color_escape green + set -g -x fish_pager_color_prefix --underline --bold 508050 + set -g -x fish_color_search_match EAFFFF + set -g -x fish_color_match EAEA9E + set -g -x fish_color_selection darkgreen + set -g -x fish_color_command 8888cc +end diff --git a/fish/functions/vcs_string.fish b/fish/functions/vcs_string.fish new file mode 100644 index 0000000..56ae1f9 --- /dev/null +++ b/fish/functions/vcs_string.fish @@ -0,0 +1,51 @@ +function vcs_string + set -l green (set_color -o 00A000) + set -l yellow (set_color -o FF9900) + set -l red (set_color -o red) + set -l blue (set_color -o blue) + set -l brown (set_color brown) + set -l normal (set_color normal) + + set -l nstr " $red●" + set -l mstr " $yellow●" + set -l rstr " $green●" + set vcs_str "" + + if begin test -d ".git"; or test -d "../.git"; or test -d "../../.git"; end; + set -l outp (git status) + set vcs_str "×" + set vcs_inf (echo $outp | head -n 1 | cut -d' ' -f 3) + + if echo $outp | grep -q "Untracked files:"; + set vcs_new $nstr; + end + if echo $outp | grep -q 'Changes not staged for commit:'; + set vcs_mod $mstr; + end + if echo $outp | grep -q 'Changes to be committed:'; + set vcs_rec $rstr + end + else if begin test -d "_darcs"; or test -d "../_darcs"; or test -d "../../_darcs"; end; + set fls (darcs show files) + set vcs_str "+" + set vcs_inf (darcs show repo | grep Default | cut -d : -f 3-) + # TODO: Find a way to use darcs to set vcs_new + # This is very inefficient, have to basically check all files in + # the current directory to see if they match the listing. + # for f in ./*; + # if not echo $fls | grep -q $f; + # set vcs_new $nstr + # break + # end + # end + if not darcs what | grep -q "No changes"; + set vcs_rec $rstr + end + end + + if not [ "$vcs_str" = "" ]; + echo -ne "$normal$vcs_str$normal{$blue$vcs_inf$vcs_rec$vcs_mod$vcs_new$normal}" + end + return 0 +end + |
