Archive unused files, pending deletion
This commit is contained in:
2
archive/fish/.gitignore
vendored
Normal file
2
archive/fish/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
fish_history
|
||||
fishd.*
|
||||
5
archive/fish/apps/direnv.fish
Normal file
5
archive/fish/apps/direnv.fish
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env fish
|
||||
|
||||
if type -q direnv
|
||||
eval (direnv hook fish)
|
||||
end
|
||||
101
archive/fish/apps/iterm2.fish
Normal file
101
archive/fish/apps/iterm2.fish
Normal file
@@ -0,0 +1,101 @@
|
||||
if begin; status --is-interactive; and not functions -q -- iterm2_status; and [ "$TERM" != screen ]; and [ (uname) = Darwin ]; end
|
||||
function iterm2_status
|
||||
printf "\033]133;D;%s\007" $argv
|
||||
end
|
||||
|
||||
# Mark start of prompt
|
||||
function iterm2_prompt_mark
|
||||
printf "\033]133;A\007"
|
||||
end
|
||||
|
||||
# Mark end of prompt
|
||||
function iterm2_prompt_end
|
||||
printf "\033]133;B\007"
|
||||
end
|
||||
|
||||
# Tell terminal to create a mark at this location
|
||||
function iterm2_preexec
|
||||
# For other shells we would output status here but we can't do that in fish.
|
||||
printf "\033]133;C;\007"
|
||||
end
|
||||
|
||||
# Usage: iterm2_set_user_var key value
|
||||
# These variables show up in badges (and later in other places). For example
|
||||
# iterm2_set_user_var currentDirectory "$PWD"
|
||||
# Gives a variable accessible in a badge by \(user.currentDirectory)
|
||||
# Calls to this go in iterm2_print_user_vars.
|
||||
function iterm2_set_user_var
|
||||
printf "\033]1337;SetUserVar=%s=%s\007" "$argv[1]" (printf "%s" "$argv[2]" | base64 | tr -d "\n")
|
||||
end
|
||||
|
||||
# iTerm2 inform terminal that command starts here
|
||||
function iterm2_precmd
|
||||
printf "\033]1337;RemoteHost=%s@%s\007\033]1337;CurrentDir=$PWD\007" $USER $iterm2_hostname
|
||||
|
||||
# Users can define a function called iterm2_print_user_vars.
|
||||
# It should call iterm2_set_user_var and produce no other output.
|
||||
if functions -q -- iterm2_print_user_vars
|
||||
iterm2_print_user_vars
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
functions -c fish_prompt iterm2_fish_prompt
|
||||
|
||||
if functions -q -- fish_mode_prompt
|
||||
# This path for fish 2.2. Works nicer with fish_vi_mode.
|
||||
functions -c fish_mode_prompt iterm2_fish_mode_prompt
|
||||
function fish_mode_prompt --description 'Write out the mode prompt; do not replace this. Instead, change fish_mode_prompt before sourcing .iterm2_shell_integration.fish, or modify iterm2_fish_mode_prompt instead.'
|
||||
set -l last_status $status
|
||||
|
||||
iterm2_status $last_status
|
||||
if not functions iterm2_fish_prompt | grep iterm2_prompt_mark > /dev/null
|
||||
iterm2_prompt_mark
|
||||
end
|
||||
sh -c "exit $last_status"
|
||||
|
||||
iterm2_fish_mode_prompt
|
||||
end
|
||||
|
||||
function fish_prompt --description 'Write out the prompt; do not replace this. Instead, change fish_prompt before sourcing .iterm2_shell_integration.fish, or modify iterm2_fish_prompt instead.'
|
||||
# Remove the trailing newline from the original prompt. This is done
|
||||
# using the string builtin from fish, but to make sure any escape codes
|
||||
# are correctly interpreted, use %b for printf.
|
||||
printf "%b" (string join "\n" (iterm2_fish_prompt))
|
||||
|
||||
iterm2_prompt_end
|
||||
end
|
||||
else
|
||||
# Pre-2.2 path
|
||||
function fish_prompt --description 'Write out the prompt; do not replace this. Instead, change fish_prompt before sourcing .iterm2_shell_integration.fish, or modify iterm2_fish_prompt instead.'
|
||||
# Save our status
|
||||
set -l last_status $status
|
||||
|
||||
iterm2_status $last_status
|
||||
if not functions iterm2_fish_prompt | grep iterm2_prompt_mark > /dev/null
|
||||
iterm2_prompt_mark
|
||||
end
|
||||
|
||||
# Restore the status
|
||||
sh -c "exit $last_status"
|
||||
iterm2_fish_prompt
|
||||
iterm2_prompt_end
|
||||
end
|
||||
end
|
||||
|
||||
function underscore_change -v _
|
||||
if [ x$_ = xfish ]
|
||||
iterm2_precmd
|
||||
else
|
||||
iterm2_preexec
|
||||
end
|
||||
end
|
||||
|
||||
# If hostname -f is slow for you, set iterm2_hostname before sourcing this script
|
||||
if not set -q iterm2_hostname
|
||||
set iterm2_hostname (hostname -f)
|
||||
end
|
||||
|
||||
iterm2_precmd
|
||||
printf "\033]1337;ShellIntegrationVersion=5;shell=fish\007"
|
||||
end
|
||||
35
archive/fish/apps/rvm.fish
Normal file
35
archive/fish/apps/rvm.fish
Normal file
@@ -0,0 +1,35 @@
|
||||
function rvm --description='Ruby enVironment Manager'
|
||||
# run RVM and capture the resulting environment
|
||||
set --local env_file (mktemp -t rvm.fish.XXXXXXXXXX)
|
||||
bash -c 'source ~/.rvm/scripts/rvm; rvm "$@"; status=$?; env > "$0"; exit $status' $env_file $argv
|
||||
|
||||
# apply rvm_* and *PATH variables from the captured environment
|
||||
and eval (grep '^rvm\|^[^=]*PATH\|^GEM_HOME' $env_file | grep -v '_clr=' | sed '/^[^=]*PATH/y/:/ /; s/^/set -xg /; s/=/ /; s/$/ ;/; s/(//; s/)//')
|
||||
# clean up
|
||||
rm -f $env_file
|
||||
end
|
||||
|
||||
function __handle_rvmrc_stuff --on-variable PWD
|
||||
# Source a .rvmrc file in a directory after changing to it, if it exists.
|
||||
# To disable this fature, set rvm_project_rvmrc=0 in $HOME/.rvmrc
|
||||
if test "$rvm_project_rvmrc" != 0
|
||||
set -l cwd $PWD
|
||||
while true
|
||||
if contains $cwd "" $HOME "/"
|
||||
if test "$rvm_project_rvmrc_default" = 1
|
||||
rvm default 1>/dev/null 2>&1
|
||||
end
|
||||
break
|
||||
else
|
||||
if begin; test -s ".rvmrc"; or test -s ".ruby-version"; or test -s ".ruby-gemset"; end
|
||||
eval "rvm reload" > /dev/null
|
||||
break
|
||||
else
|
||||
set cwd (dirname "$cwd")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set -e cwd
|
||||
end
|
||||
end
|
||||
3
archive/fish/apps/zoxide.fish
Normal file
3
archive/fish/apps/zoxide.fish
Normal file
@@ -0,0 +1,3 @@
|
||||
if which zoxide &> /dev/null
|
||||
zoxide init fish --cmd j --hook pwd | source
|
||||
end
|
||||
5
archive/fish/completions/adb.fish
Normal file
5
archive/fish/completions/adb.fish
Normal file
@@ -0,0 +1,5 @@
|
||||
function __fish_adb_devices
|
||||
adb devices | tail -n +2 | cut -f 1
|
||||
end
|
||||
|
||||
complete -c adb -n '__fish_contains_opt -s s' -a '(__fish_adb_devices)' -d 'Device' -f
|
||||
49
archive/fish/config.fish
Normal file
49
archive/fish/config.fish
Normal file
@@ -0,0 +1,49 @@
|
||||
# ============
|
||||
# Basics, etc…
|
||||
# ============
|
||||
|
||||
# Default editor
|
||||
set -g -x EDITOR "emacsclient"
|
||||
set -g -x ALTERNATE_EDITOR "vim"
|
||||
set -g -x TERMINAL "kitty"
|
||||
|
||||
# Setup PATH
|
||||
ensure_path ~/.dotfiles/bin
|
||||
ensure_path ~/.local/bin
|
||||
ensure_path ~/bin
|
||||
ensure_path ~/.emacs.d/bin
|
||||
|
||||
# Disable Fish greeting banner
|
||||
set --universal fish_greeting
|
||||
|
||||
# Configuration for apps
|
||||
for app in ~/.config/fish/apps/*.fish
|
||||
source $app
|
||||
end
|
||||
|
||||
# OS-specific configuration
|
||||
source ~/.config/fish/os/os.fish
|
||||
|
||||
# Machine-local config
|
||||
if test -e ~/.config/fish/local.fish
|
||||
source ~/.config/fish/local.fish
|
||||
end
|
||||
|
||||
# Hybrid Vi Mode
|
||||
set -g fish_key_bindings hybrid_bindings
|
||||
|
||||
# Fix prompt for Emacs TRAMP
|
||||
# https://github.com/oh-my-fish/theme-bobthefish/issues/148
|
||||
if test "$TERM" = "dumb"
|
||||
function fish_prompt
|
||||
echo "\$ "
|
||||
end
|
||||
function fish_right_prompt; end
|
||||
function fish_greeting; end
|
||||
function fish_title; end
|
||||
end
|
||||
|
||||
# Starship prompt
|
||||
if which starship &> /dev/null
|
||||
starship init fish | source
|
||||
end
|
||||
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
|
||||
0
archive/fish/os/linux.fish
Normal file
0
archive/fish/os/linux.fish
Normal file
9
archive/fish/os/os.fish
Normal file
9
archive/fish/os/os.fish
Normal file
@@ -0,0 +1,9 @@
|
||||
# OS-specific configuration
|
||||
switch (uname)
|
||||
case Linux
|
||||
source ~/.config/fish/os/linux.fish
|
||||
case Darwin
|
||||
source ~/.config/fish/os/osx.fish
|
||||
case '*'
|
||||
echo 'Unknown OS. No specifc config'
|
||||
end
|
||||
1
archive/fish/os/osx.fish
Normal file
1
archive/fish/os/osx.fish
Normal file
@@ -0,0 +1 @@
|
||||
set -x JAVA_HOME (/usr/libexec/java_home)
|
||||
Reference in New Issue
Block a user