From b115eb98e3a39d21d36c2b1c7f783ade38750379 Mon Sep 17 00:00:00 2001
From: Daniel Lundin <dln@eintr.org>
Date: Thu, 4 May 2017 22:55:33 +0200
Subject: [PATCH] Clean up bash init a bit

---
 .bash_completion      | 18 ++++++++++++++++--
 .bashrc               | 12 ++++--------
 .config/nvim/init.vim |  5 +++++
 3 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/.bash_completion b/.bash_completion
index 4404dc0..64f1506 100644
--- a/.bash_completion
+++ b/.bash_completion
@@ -1,6 +1,20 @@
+function _src {
+  [ -f $1 ] && source $1
+}
+
+# Bash
+_src /etc/bash_completion
+
 # Bazel
-[ -f /usr/local/lib/bazel/bin/bazel-complete.bash ] && source /usr/local/lib/bazel/bin/bazel-complete.bash
+_src /usr/local/lib/bazel/bin/bazel-complete.bash
 
 # Rust
-[ -f /usr/local/etc/bash_completion.d/cargo ] && source /usr/local/etc/bash_completion.d/cargo
+_src /usr/local/etc/bash_completion.d/cargo
+
+# fzf
+_src /usr/share/fzf/completion.bash
+_src /usr/share/fzf/key-bindings.bash
+
+# Kubernetes
+source <(kubectl completion bash)
 
diff --git a/.bashrc b/.bashrc
index d8a1fac..bfadef4 100644
--- a/.bashrc
+++ b/.bashrc
@@ -22,12 +22,6 @@ if [ -f "$HOME/.bash_completion_git" ] ; then
     source ~/.bash_completion_git
 fi
 
-# Check for interactive shell.
-if [ -n "$PS1" ]; then
-    if [ -f /etc/bash_completion ]; then
-        . /etc/bash_completion
-    fi
-fi
 unset bash bminor bmajor
 
 # Bash settings
@@ -110,9 +104,11 @@ tput smkx
 #fi
 #. /tmp/gpg-agent.env
 
-source <(kubectl completion bash)
+# Check for interactive shell.
+if [ -n "$PS1" ]; then
+  source $HOME/.bash_completion
+fi
 
 source $HOME/.bash_aliases
 source $HOME/.bash_exports
 source $HOME/.bash_prompt
-source $HOME/.bash_completion
diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim
index 5bc4452..9bca797 100644
--- a/.config/nvim/init.vim
+++ b/.config/nvim/init.vim
@@ -287,6 +287,11 @@ au FileType xml
     \ set makeprg=tidy\ -qe\ -access\ 3\ % |
     \ set errorformat=line\ %l\ column\ %c\ \-\ %m
 
+"" fzf
+
+let g:fzf_layout = { 'up': '~40%' }
+
+
 ""
 "" Color theme
 ""