Archive unused files, pending deletion
This commit is contained in:
4
archive/fish/functions/ec.fish
Normal file
4
archive/fish/functions/ec.fish
Normal file
@@ -0,0 +1,4 @@
|
||||
# Emacs Client
|
||||
function ec
|
||||
emacsclient -n --alternate-editor=emacs $argv
|
||||
end
|
||||
7
archive/fish/functions/ensure_path.fish
Normal file
7
archive/fish/functions/ensure_path.fish
Normal file
@@ -0,0 +1,7 @@
|
||||
function ensure_path --description "Ensures directories are in $PATH"
|
||||
for pathdir in $argv
|
||||
if not set -l index (contains -i $pathdir $PATH)
|
||||
set -g -x PATH $pathdir $PATH
|
||||
end
|
||||
end
|
||||
end
|
||||
26
archive/fish/functions/fish_prompt.fish
Normal file
26
archive/fish/functions/fish_prompt.fish
Normal file
@@ -0,0 +1,26 @@
|
||||
function fish_prompt
|
||||
# $status gets nuked as soon as something else is run, e.g. set_color
|
||||
# so it has to be saved asap.
|
||||
set -l last_status $status
|
||||
|
||||
fish_prompt_colors
|
||||
|
||||
# Clear the line because fish seems to emit the prompt twice. The initial
|
||||
# display, then when you press enter.
|
||||
# printf "\033[K"
|
||||
|
||||
# Current Directory
|
||||
# 1st sed for colourising forward slashes
|
||||
# 2nd sed for colourising the deepest path (the 'm' is the last char in the
|
||||
# ANSI colour code that needs to be stripped)
|
||||
printf $c1
|
||||
printf (prompt_pwd | sed "s,/,$c0/$c1,g" | sed "s,\(.*\)/[^m]*m,\1/$c3,")
|
||||
|
||||
if test ! $last_status = "0"
|
||||
printf $ce
|
||||
else
|
||||
printf $c4
|
||||
end
|
||||
printf " > "
|
||||
printf $c4
|
||||
end
|
||||
10
archive/fish/functions/fish_prompt_colors.fish
Normal file
10
archive/fish/functions/fish_prompt_colors.fish
Normal file
@@ -0,0 +1,10 @@
|
||||
function fish_prompt_colors
|
||||
# c0 to c4 progress from dark to bright
|
||||
# ce is the error colour
|
||||
set -g c0 (set_color 005284)
|
||||
set -g c1 (set_color 0075cd)
|
||||
set -g c2 (set_color 009eff)
|
||||
set -g c3 (set_color 6dc7ff)
|
||||
set -g c4 (set_color ffffff)
|
||||
set -g ce (set_color $fish_color_error)
|
||||
end
|
||||
41
archive/fish/functions/fish_right_prompt.fish
Normal file
41
archive/fish/functions/fish_right_prompt.fish
Normal file
@@ -0,0 +1,41 @@
|
||||
# prints "ARG1:ARG2" with appropriate colors
|
||||
function section
|
||||
printf ", "
|
||||
printf $c1
|
||||
printf $argv[1]
|
||||
printf $c0
|
||||
printf ":"
|
||||
printf $c3
|
||||
printf $argv[2]
|
||||
printf $c0
|
||||
end
|
||||
|
||||
function machine_tag
|
||||
hostname | cut -f1 -d. - | tr '[a-z]' '[A-Z]'
|
||||
end
|
||||
|
||||
function fish_right_prompt
|
||||
# Current time
|
||||
printf $c0
|
||||
printf "["
|
||||
printf (date "+$c2%H$c0:$c2%M")
|
||||
|
||||
# Show last execution time
|
||||
if test $CMD_DURATION
|
||||
set secs (math "$CMD_DURATION / 1000")
|
||||
if test $secs -gt 2
|
||||
section took {$secs}s
|
||||
end
|
||||
end
|
||||
|
||||
printf $c0
|
||||
printf "]"
|
||||
|
||||
if set -q SSH_CLIENT
|
||||
printf "["
|
||||
printf $c1
|
||||
printf (machine_tag)
|
||||
printf $c0
|
||||
printf "]"
|
||||
end
|
||||
end
|
||||
9
archive/fish/functions/fuck.fish
Normal file
9
archive/fish/functions/fuck.fish
Normal file
@@ -0,0 +1,9 @@
|
||||
function fuck -d "Correct your previous console command"
|
||||
set -l fucked_up_command $history[1]
|
||||
env TF_SHELL=fish TF_ALIAS=fuck PYTHONIOENCODING=utf-8 thefuck $fucked_up_command | read -l unfucked_command
|
||||
if [ "$unfucked_command" != "" ]
|
||||
eval $unfucked_command
|
||||
builtin history delete --exact --case-sensitive -- $fucked_up_command
|
||||
builtin history merge ^ /dev/null
|
||||
end
|
||||
end
|
||||
6
archive/fish/functions/hybrid_bindings.fish
Normal file
6
archive/fish/functions/hybrid_bindings.fish
Normal file
@@ -0,0 +1,6 @@
|
||||
function hybrid_bindings --description "Vi-style bindings that inherit emacs-style bindings in all modes"
|
||||
for mode in default insert visual
|
||||
fish_default_key_bindings -M $mode
|
||||
end
|
||||
fish_vi_key_bindings --no-erase
|
||||
end
|
||||
4
archive/fish/functions/pubip.fish
Normal file
4
archive/fish/functions/pubip.fish
Normal file
@@ -0,0 +1,4 @@
|
||||
# Prints current public IP address
|
||||
function pubip
|
||||
curl icanhazip.com
|
||||
end
|
||||
4
archive/fish/functions/pulsefix.fish
Normal file
4
archive/fish/functions/pulsefix.fish
Normal file
@@ -0,0 +1,4 @@
|
||||
function pulsefix
|
||||
pulseaudio --kill
|
||||
pulseaudio --start
|
||||
end
|
||||
4
archive/fish/functions/src.fish
Normal file
4
archive/fish/functions/src.fish
Normal file
@@ -0,0 +1,4 @@
|
||||
# reload your Fish config
|
||||
function src
|
||||
source ~/.config/fish/config.fish; and clear
|
||||
end
|
||||
29
archive/fish/functions/vv.fish
Normal file
29
archive/fish/functions/vv.fish
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
function vv
|
||||
pushd . &> /dev/null
|
||||
function find_root
|
||||
set -l dir $PWD
|
||||
|
||||
if test -d $dir/venv
|
||||
echo $dir
|
||||
return 0
|
||||
end
|
||||
|
||||
if test -d .git -o "$dir" = "/"
|
||||
return 1
|
||||
end
|
||||
|
||||
cd ..
|
||||
find_root
|
||||
end
|
||||
|
||||
if not find_root &> /dev/null
|
||||
echo "Couldn't find venv"
|
||||
popd &> /dev/null
|
||||
return 1
|
||||
end
|
||||
|
||||
source (find_root)/venv/bin/activate.fish
|
||||
popd &> /dev/null
|
||||
end
|
||||
Reference in New Issue
Block a user