From 913b4dc17d1eb698b6ebf5f6a3cf02417cb61b80 Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Wed, 21 Nov 2018 23:16:02 -0600
Subject: [PATCH] Lots: Move .local/bin, add pip compatibility God fucking
 dammit Alright, so this is too damn long for a commit message but I don't
 care. Debian apparrently adds a patch to pip that forces it to use the --user
 flag. This COMPLETELY BREAKS defining target or prefix in pip.conf As a
 workaround, I have to move all of my custom binaries to a different directory
 and just hand .local/bin over to pip. It's really dumb.

---
 .bashrc     |  2 +-
 .bin        |  1 +
 .gitmodules |  2 +-
 .kshrc      |  2 +-
 .local/bin  |  1 -
 .profile    | 36 ++++++++++++++++++++++++++++++------
 .zshrc      |  2 +-
 7 files changed, 35 insertions(+), 11 deletions(-)
 create mode 160000 .bin
 delete mode 160000 .local/bin

diff --git a/.bashrc b/.bashrc
index 7f3223d3..8f937257 120000
--- a/.bashrc
+++ b/.bashrc
@@ -1 +1 @@
-.local/bin/shrc/bashrc
\ No newline at end of file
+.bin/shrc/bashrc
\ No newline at end of file
diff --git a/.bin b/.bin
new file mode 160000
index 00000000..03b31b1d
--- /dev/null
+++ b/.bin
@@ -0,0 +1 @@
+Subproject commit 03b31b1da6c8ea901ef51616bb82ba783d0b321e
diff --git a/.gitmodules b/.gitmodules
index b749373d..82c93bb6 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -20,7 +20,7 @@
 	path = .vim/bundle/incsearch.vim
 	url = https://github.com/haya14busa/incsearch.vim.git
 [submodule ".local/bin"]
-	path = .local/bin
+	path = .bin
 	url = git@gitlab.com:rehashedsalt/bin
 [submodule ".vim/bundle/lightline.vim"]
 	path = .vim/bundle/lightline.vim
diff --git a/.kshrc b/.kshrc
index 966df152..4e687e88 120000
--- a/.kshrc
+++ b/.kshrc
@@ -1 +1 @@
-.local/bin/shrc/kshrc
\ No newline at end of file
+.bin/shrc/kshrc
\ No newline at end of file
diff --git a/.local/bin b/.local/bin
deleted file mode 160000
index d6ea041d..00000000
--- a/.local/bin
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit d6ea041d745103045598f797827324be15f48960
diff --git a/.profile b/.profile
index 9d04f876..c46d490f 100755
--- a/.profile
+++ b/.profile
@@ -27,14 +27,11 @@
 
 # Environment variables
 # Use Vim if we have it
-if `which vim > /dev/null 2>&1`; then
-	export EDITOR="vim"
-else
-	export EDITOR="vi"
-fi
+export EDITOR="vi"
+which vim > /dev/null 2>&1 && export EDITOR="vim"
 
 # Patch PATH
-desiredpath="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/games:/usr/games:$HOME/.local/bin"
+desiredpath="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/games:/usr/games:$HOME/.local/bin:$HOME/.local/bin/pip"
 # Here, we eliminate the parts of the environment-supplied PATH that we already
 # plan on using
 IFS=":"
@@ -52,6 +49,33 @@ PATH="$desiredpath:$PATH"
 # Grab bash_completion, if it exists
 [ -f "/etc/profile.d/bash_completion.sh" ] && . "/etc/profile.d/bash_completion.sh"
 
+# Grab pip completion, if it exists
+if which pip > /dev/null 2>&1; then
+	case "$(basename "$SHELL")" in
+		*bash)
+			if ! [ -f "$HOME/.pip-completion-bash" ]; then
+				pip completion --bash > "$HOME/.pip-completion-bash"
+				echo ".profile: Created pip completion for bash"
+			fi
+			source "$HOME/.pip-completion-bash"
+			;;
+		zsh)
+			if ! [ -f "$HOME/.pip-completion-zsh" ]; then
+				pip completion --zsh > "$HOME/.pip-completion-zsh"
+				echo ".profile: Created pip completion for zsh"
+			fi
+			source "$HOME/.pip-completion-zsh"
+			;;
+		*)
+			;;
+	esac
+	# Debian patches pip to assume the --user flag by default
+	# This breaks using installation targets and prefixes
+	# It's really dumb
+	pipargs="--system"
+	alias pip="pip $pipargs"
+fi
+
 # If emerge exists, add emerge aliases
 if `which emerge > /dev/null 2>&1` ; then
 	alias e-depclean='sudo emerge -a --depclean'
diff --git a/.zshrc b/.zshrc
index b06ee911..a4b99fba 120000
--- a/.zshrc
+++ b/.zshrc
@@ -1 +1 @@
-.local/bin/shrc/zshrc
\ No newline at end of file
+.bin/shrc/zshrc
\ No newline at end of file